/* ============================================================
   YOLO Annotation Tool — Minimal CSS (Tailwind supplement)
   Only covers what Tailwind cannot handle:
   - Canvas / annotate layout
   - Keypoint panel styles
   - Custom scrollbar
   - Animations
   - Tool-active state
   - Live-status dot
   - Review-banner
   ============================================================ */

/* ── Base reset (Tailwind preflight covers most, keep minimal) ── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Keyboard shortcut badges in legend ── */
kbd.kbd {
    display: inline-block;
    background: #2a2d3a;
    border: 1px solid #3a3d4a;
    border-radius: 4px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-family: inherit;
    color: #cbd5e1;
    line-height: 1.6;
}

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f1117; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ============================================================
   ANNOTATE LAYOUT  (flex canvas page — cannot be done with
   responsive Tailwind alone due to dynamic canvas sizing)
   ============================================================ */
body.annotate-body {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.ann-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar */
.ann-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #13151f;
    border-right: 1px solid #2a2d3a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-list {
    flex: 1;
    overflow-y: auto;
}

.image-list-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    transition: background 0.1s;
    border-left: 3px solid transparent;
    color: #aaa;
}
.image-list-item:hover { background: #1a1d27; }
.image-list-item.active { background: #1a2a4a; border-left-color: #1a56db; }

.ann-status { font-size: 0.85rem; flex-shrink: 0; }
.image-list-item.annotated .ann-status { color: #16a34a; }
.image-list-item.status-item-submitted .ann-status { color: #d97706; }
.image-list-item.status-item-approved  .ann-status { color: #16a34a; }
.image-list-item.status-item-rejected  .ann-status { color: #dc2626; }

.img-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.lock-icon { font-size: 0.75rem; margin-left: auto; flex-shrink: 0; opacity: 0.7; }

/* Right legend panel */
.ann-legend {
    width: 130px;
    flex-shrink: 0;
    background: #13151f;
    border-left: 1px solid #2a2d3a;
    display: flex;
    flex-direction: column;
    padding: 0.6rem 0.5rem;
    gap: 0.35rem;
    overflow-y: auto;
    font-size: 0.68rem;
    color: #6b7280;
    line-height: 1.4;
}
.ann-legend-title {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4b5563;
    margin-bottom: 0.15rem;
}
.ann-legend > span {
    display: block;
}
.ann-legend kbd.kbd {
    display: inline-block;
    margin-bottom: 1px;
}

/* Main annotation area */
.ann-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Canvas wrapper */
.canvas-wrap {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #0a0c12;
    position: relative;
    padding: 10px;
}

#mainCanvas {
    cursor: crosshair;
    display: block;
    flex-shrink: 0;
}

/* Toolbar separator */
.tool-sep {
    width: 1px;
    height: 24px;
    background: #2a2d3a;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

/* Tool active state (JS-driven, cannot use Tailwind) */
.tool-btn { background: #2a2d3a; border: 1px solid #333; color: #e0e0e0; }
.tool-btn.tool-active { background: #1a56db !important; border-color: #1a56db !important; color: #fff !important; }

/* img counter */
#imgCounter { color: #888; font-size: 0.85rem; min-width: 60px; text-align: center; }

/* ============================================================
   KEYPOINT PANEL
   ============================================================ */
.keypoint-panel {
    background: #13151f;
    border-top: 1px solid #2a2d3a;
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.kp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.kp-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #1a1d27;
    border: 1px solid #2a2d3a;
    cursor: pointer;
    transition: border-color 0.1s, background 0.1s;
}

.kp-item.set-visible  { border-color: #16a34a; background: #0f2a1a; }
.kp-item.set-occluded { border-color: #d97706; background: #2a1f0a; }
.kp-item.set-hidden   { border-color: #555;    background: #1a1d27; }
.kp-item.active       { border-color: #1a56db !important; background: #1a2a4a !important; }

.kp-num   { color: #666; min-width: 18px; font-size: 0.7rem; }
.kp-name  { flex: 1; color: #aaa; }
.kp-status { font-size: 0.75rem; font-weight: bold; min-width: 14px; text-align: center; }
.kp-item.set-visible  .kp-status { color: #16a34a; }
.kp-item.set-occluded .kp-status { color: #d97706; }
.kp-item.set-hidden   .kp-status { color: #555; }

/* ── Animations ── */
@keyframes kp-blink {
    0%, 100% { background: #1a2a4a; }
    50%       { background: #2a4a8a; }
}
.kp-flash { animation: kp-blink 0.2s ease 2; }

/* ============================================================
   LIVE-STATUS DOT  (injected by live.js)
   ============================================================ */
.live-status { font-size: 0.7rem; margin-left: 2px; flex-shrink: 0; }

/* ============================================================
   REVIEW BANNER
   ============================================================ */
.review-banner {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    flex-shrink: 0;
}
.review-banner.rejected  { background: #2a1010; color: #f87171; border-color: #dc2626; }
.review-banner.approved  { background: #0a2a0a; color: #4ade80; border-color: #16a34a; }
.review-banner.submitted { background: #1a1810; color: #fbbf24; border-color: #d97706; }

/* ============================================================
   IMAGE GRID — Upload page (delete button overlay needs CSS)
   ============================================================ */
.delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220,38,38,0.85);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: none;
}
.image-thumb:hover .delete-btn { display: block; }

/* ============================================================
   BADGE COLORS  (semantic, can't do with Tailwind arbitrary
   values in PHP-generated class names)
   ============================================================ */
.badge-detection    { background: #1a3a6a; color: #7bb3ff; }
.badge-pose         { background: #3a1a6a; color: #bb7bff; }
.badge-segmentation { background: #1a4a4a; color: #7bffdb; }

.ann-badge { position: absolute; top: 4px; left: 4px; font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 4px; color: #fff; }
.ann-badge.status-submitted { background: #d97706; }
.ann-badge.status-approved  { background: #16a34a; }
.ann-badge.status-rejected  { background: #dc2626; }

/* Progress bar fill (JS-driven width) */
.progress-fill {
    height: 100%;
    background: #1a56db;
    transition: width 0.2s;
    width: 0%;
}
