/* ===========================
   VECTOR — ATC Workflow UI
   Design: Neumorphism-Light
   Palette: Deep Navy / Golden Amber
   =========================== */

:root {
    --bg-deep: #0f1923;
    --bg-surface: #162231;
    --bg-card: #1c2d42;
    --bg-card-light: #233750;
    --accent: #f5b731;
    --accent-dim: #d9a028;
    --accent-glow: rgba(245, 183, 49, 0.12);
    --text-primary: #e2e8f0;
    --text-secondary: #8899aa;
    --text-muted: #506070;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --shadow-dark: rgba(0, 0, 0, 0.5);
    --shadow-light: rgba(255, 255, 255, 0.03);
    --priority-red: #e05555;
    --priority-yellow: #f5b731;
    --priority-green: #5a9a6b;
    --freeze-color: #4a9eed;
    --cocked-offset: 30px;
    --strip-height: 52px;
    --detail-width: 360px;
    --radius-bay: 20px;
    --radius-strip: 12px;
    --radius-btn: 10px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

/* ===== TOP BAR ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 22px;
    color: var(--accent);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-primary);
}

.btn-quick-add {
    background: var(--accent-dim);
    color: var(--bg-deep);
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-btn);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-quick-add:hover {
    background: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
}

/* ===== APP LAYOUT (board + detail panel) ===== */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== BOARD (4-column grid) ===== */
.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 16px 24px;
    flex: 1;
    overflow: hidden;
    transition: flex 0.3s ease;
}

/* ===== SECTOR BAY ===== */
.sector-bay {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-bay);
    padding: 14px;
    display: flex;
    flex-direction: column;
    box-shadow:
        inset 2px 2px 6px var(--shadow-dark),
        inset -1px -1px 3px var(--shadow-light);
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sector-bay.over-limit {
    box-shadow:
        inset 2px 2px 6px var(--shadow-dark),
        inset -1px -1px 3px var(--shadow-light),
        0 0 0 2px var(--priority-red);
}

/* Frozen sector */
.sector-bay.is-frozen {
    border-top: 3px solid var(--freeze-color);
}

.sector-bay.is-frozen .sector-strips {
    opacity: 0.6;
    pointer-events: none;
}

.sector-bay.is-frozen .sector-header h2 {
    color: var(--freeze-color);
}

.sector-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.sector-header h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.sector-count {
    background: var(--bg-card);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    min-width: 24px;
    text-align: center;
}

.sector-limit {
    font-size: 11px;
    color: var(--text-muted);
}

/* Freeze button */
.btn-freeze {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-freeze:hover {
    opacity: 1;
}

.sector-bay.is-frozen .btn-freeze {
    opacity: 1;
}

/* ===== STRIP CONTAINER (scrollable) ===== */
.sector-strips {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 4px 2px 0;
    min-height: 60px;
}

.sector-strips::-webkit-scrollbar {
    width: 4px;
}

.sector-strips::-webkit-scrollbar-track {
    background: transparent;
}

.sector-strips::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

/* ===== DROP ZONE INDICATOR ===== */
.sector-strips.drag-over {
    background: var(--accent-glow);
    border-radius: var(--radius-strip);
}

/* ===== VECTOR STRIP ===== */
.vector-strip {
    background: linear-gradient(145deg, var(--bg-card-light), var(--bg-card));
    border-radius: var(--radius-strip);
    padding: 10px 14px;
    margin-bottom: 8px;
    cursor: grab;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.2s ease;
    user-select: none;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--strip-height);
    box-shadow: 0 2px 6px var(--shadow-dark);
}

.vector-strip:hover {
    box-shadow: 0 4px 14px var(--shadow-dark), 0 0 0 1px var(--border-subtle);
}

.vector-strip:active {
    cursor: grabbing;
}

.vector-strip.dragging {
    opacity: 0.4;
    transform: scale(0.97);
}

.vector-strip.selected {
    box-shadow: 0 0 0 2px var(--accent), 0 4px 14px var(--shadow-dark);
}

/* Priority indicator bar */
.strip-priority {
    width: 4px;
    height: 28px;
    border-radius: 2px;
    flex-shrink: 0;
}

.strip-priority.RED { background: var(--priority-red); }
.strip-priority.YELLOW { background: var(--priority-yellow); }
.strip-priority.GREEN { background: var(--priority-green); }

/* Strip content */
.strip-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.strip-id-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.strip-id {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.strip-assignee {
    font-size: 9px;
    font-weight: 600;
    color: var(--bg-deep);
    background: var(--text-secondary);
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.strip-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.strip-title[contenteditable="true"] {
    outline: none;
    border-bottom: 1px dashed var(--accent-dim);
    white-space: normal;
    cursor: text;
}

/* Strip meta (deadline, timer) */
.strip-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
}

.strip-deadline {
    font-size: 9px;
    color: var(--text-muted);
}

.strip-deadline.overdue {
    color: var(--priority-red);
    font-weight: 600;
}

.strip-timer {
    font-size: 9px;
    color: var(--freeze-color);
    font-weight: 500;
}

/* Landing strip fade */
.vector-strip.landing-expiring {
    opacity: 0.5;
}

/* Strip actions */
.strip-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.vector-strip:hover .strip-actions {
    opacity: 1;
}

.btn-strip-action {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.btn-strip-action:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
}

.btn-strip-action.btn-delete:hover {
    color: var(--priority-red);
}

/* ===== COCKING (blocked strip) ===== */
.vector-strip.is-cocked {
    margin-left: var(--cocked-offset);
    border-left: 4px solid var(--accent);
    background: linear-gradient(145deg, #283f58, #1e3348);
}

.vector-strip.is-cocked .strip-priority {
    display: none;
}

/* ===== DROP PLACEHOLDER ===== */
.drop-placeholder {
    height: 6px;
    margin: 4px 0;
    background: var(--accent);
    border-radius: 3px;
    opacity: 0.6;
    transition: all 0.15s ease;
}

/* ===== DETAIL PANEL (Sidebar) ===== */
.detail-panel {
    width: 0;
    overflow: hidden;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    transition: width 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.detail-panel.open {
    width: var(--detail-width);
}

.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.detail-panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close-panel {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s;
}

.btn-close-panel:hover {
    color: var(--text-primary);
}

.detail-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.detail-panel-body .form-group {
    margin-bottom: 14px;
}

.detail-panel-body textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
}

.detail-panel-body textarea:focus {
    border-color: var(--accent-dim);
}

.detail-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.detail-section h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Handover log */
.handover-log {
    max-height: 200px;
    overflow-y: auto;
}

.handover-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 11px;
}

.handover-entry:last-child {
    border-bottom: none;
}

.handover-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 3px;
}

.handover-info {
    flex: 1;
}

.handover-sectors {
    color: var(--text-primary);
    font-weight: 500;
}

.handover-time {
    color: var(--text-muted);
    font-size: 10px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-bay);
    padding: 28px 32px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
}

.modal h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-dim);
}

.form-group select {
    cursor: pointer;
    appearance: none;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel {
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: var(--radius-btn);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-confirm {
    background: var(--accent-dim);
    border: none;
    color: var(--bg-deep);
    padding: 8px 18px;
    border-radius: var(--radius-btn);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-confirm:hover {
    background: var(--accent);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .board {
        grid-template-columns: repeat(2, 1fr);
    }
    .detail-panel.open {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
    }
}

@media (max-width: 600px) {
    .board {
        grid-template-columns: 1fr;
    }
}
