/* ==========================================================================
   Locus Fleet Roster Operations Console - Corporate Design System
   ========================================================================== */

:root {
    /* Corporate Color Palette - Light Theme Default */
    --bg-app: #f8fafc;
    --bg-header: #0f172a;
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f1f5f9;
    --bg-surface-hover: #e2e8f0;
    
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-focus: #2563eb;

    /* Text */
    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-header: #f8fafc;

    /* Corporate Accents */
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --success-green: #059669;
    --success-green-hover: #047857;
    --amber-warning: #d97706;
    --rose-danger: #dc2626;

    /* Shadows & Radii */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Dark Theme Overrides */
body.dark-theme {
    --bg-app: #0b0f19;
    --bg-header: #131b2e;
    --bg-surface: #131b2e;
    --bg-surface-secondary: #1c2742;
    --bg-surface-hover: #263354;
    
    --border-subtle: #1e293b;
    --border-strong: #334155;
    --border-focus: #3b82f6;

    --text-heading: #f8fafc;
    --text-body: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --text-header: #f8fafc;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-body);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

/* Header Navbar */
.app-header {
    background-color: var(--bg-header);
    color: var(--text-header);
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo-wrap {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-logo-img {
    height: 34px;
    width: auto;
    object-fit: contain;
}

.brand-meta {
    display: flex;
    flex-direction: column;
}

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

.brand-title h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.env-tag {
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    color: #93c5fd;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.03em;
}

.brand-sub {
    font-size: 0.78rem;
    color: #94a3b8;
}

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

.divider-vertical {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 4px;
}

/* Workspace Grid Layout */
.workspace-container {
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .workspace-container {
        grid-template-columns: 1fr;
    }
}

/* Panel Cards */
.panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.step-num {
    width: 20px;
    height: 20px;
    background: var(--primary-blue);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-title h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-heading);
}

.card-body {
    padding: 16px;
}

/* File Drop Zone */
.drop-zone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    background: var(--bg-surface-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.drop-zone:hover {
    border-color: var(--primary-blue);
    background: rgba(37, 99, 235, 0.04);
}

.file-input-hidden { display: none; }

.drop-icon {
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.drop-primary {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-heading);
}

.file-browse-link {
    color: var(--primary-blue);
    text-decoration: underline;
    cursor: pointer;
}

.drop-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* File Stats Box */
.file-stats-box {
    margin-top: 14px;
    padding: 12px;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.stat-key { color: var(--text-muted); }
.stat-val { font-weight: 600; color: var(--text-heading); }
.text-truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stat-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 4px 0;
}

.mini-stat {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.mini-val { font-size: 1.1rem; font-weight: 700; color: var(--text-heading); display: block; }
.mini-lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* Audit Counts Grid */
.audit-counts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-subtle);
}

.audit-item {
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid transparent;
}

.audit-val { font-size: 1rem; font-weight: 700; display: block; line-height: 1.2; }
.audit-lbl { font-size: 0.65rem; text-transform: uppercase; font-weight: 600; }

.audit-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success-green);
    border-color: rgba(5, 150, 105, 0.2);
}

.audit-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--rose-danger);
    border-color: rgba(220, 38, 38, 0.2);
}

.audit-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--amber-warning);
    border-color: rgba(217, 119, 6, 0.2);
}

/* Form Controls */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-field:last-child { margin-bottom: 0; }

.label-with-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.label-with-count label, .form-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-heading);
}

.count-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-blue);
    background: rgba(37, 99, 235, 0.1);
    padding: 1px 6px;
    border-radius: 10px;
}

.form-select, .form-input {
    width: 100%;
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    color: var(--text-heading);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select:focus, .form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-select:disabled, .form-input:disabled {
    background-color: var(--bg-surface-secondary);
    color: var(--text-light);
    cursor: not-allowed;
}

.field-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.form-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Searchable Custom Dropdowns */
.searchable-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.88rem;
    color: var(--text-heading);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dropdown-trigger:hover:not(.disabled) {
    border-color: var(--border-focus);
}

.dropdown-trigger.disabled {
    background-color: var(--bg-surface-secondary);
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.dropdown-trigger.active {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dropdown-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.dropdown-trigger.active .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
}

.dropdown-search-box {
    position: relative;
    padding: 8px;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface-secondary);
    display: flex;
    align-items: center;
}

.search-menu-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.dropdown-search-input {
    width: 100%;
    padding: 6px 28px 6px 30px;
    font-size: 0.82rem;
    color: var(--text-heading);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
}

.dropdown-search-input:focus {
    border-color: var(--border-focus);
}

.search-clear-btn {
    position: absolute;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.search-clear-btn:hover { color: var(--text-heading); }

.dropdown-menu-header {
    padding: 4px 12px;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.dropdown-options-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
}

.dropdown-option {
    padding: 8px 12px;
    font-size: 0.84rem;
    color: var(--text-body);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease;
    gap: 8px;
}

.dropdown-option:hover, .dropdown-option.highlighted {
    background-color: var(--bg-surface-secondary);
    color: var(--text-heading);
}

.dropdown-option.selected {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
    font-weight: 600;
}

.dropdown-option-main {
    font-weight: 600;
}

.dropdown-option-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.no-options {
    padding: 16px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Preset Pills */
.preset-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.pills-title { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.pill-btn {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-body);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pill-btn:hover {
    background: var(--primary-blue);
    color: #ffffff;
    border-color: var(--primary-blue);
}

/* Action Card & Summary Matrix */
.action-card {
    padding: 16px;
    background: var(--bg-surface-secondary);
}

.summary-matrix {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 12px;
}

.matrix-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.matrix-lbl { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; }
.matrix-val { font-size: 1rem; font-weight: 700; color: var(--text-heading); }
.matrix-operator { font-size: 0.9rem; color: var(--text-light); font-weight: 600; }

.total-item .matrix-val { color: var(--primary-blue); font-size: 1.15rem; }

.rules-summary-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    padding: 8px 10px;
    background: rgba(37, 99, 235, 0.05);
    border-left: 3px solid var(--primary-blue);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.rule-line {
    font-size: 0.74rem;
    color: var(--text-body);
    display: flex;
    align-items: center;
    gap: 6px;
}

.rule-line code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.rule-icon-check { width: 12px; height: 12px; color: var(--success-green); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn i { width: 16px; height: 16px; }

.btn-primary {
    background-color: var(--primary-blue);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-blue-hover);
}

.btn-success {
    background-color: var(--success-green);
    color: #ffffff;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-green-hover);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-body);
    border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-surface-hover);
    color: var(--text-heading);
}

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; padding: 10px; font-size: 0.92rem; }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tabs */
.panel-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: var(--text-heading);
    background: var(--bg-surface-secondary);
}

.tab-btn.active {
    background: var(--primary-blue);
    color: #ffffff;
    border-color: var(--primary-blue);
}

/* Output Panel & Data Table */
.output-panel {
    margin-bottom: 0;
}

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

.output-title-group h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
}

.output-meta-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.output-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-subtle);
    gap: 16px;
    flex-wrap: wrap;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-muted);
}

.search-input {
    padding-left: 32px;
    height: 32px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.select-sm { padding: 4px 8px; font-size: 0.78rem; height: 32px; }
.page-btns { display: flex; gap: 4px; }

/* Table Styling */
.table-container {
    overflow-x: auto;
    max-height: calc(100vh - 230px);
    min-height: 400px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    white-space: nowrap;
}

.data-table th {
    background: var(--bg-surface-secondary);
    color: var(--text-heading);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
    position: sticky;
    top: 0;
    z-index: 5;
}

.data-table td {
    padding: 8px 14px;
    color: var(--text-body);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-sans);
}

.data-table td.mono-cell {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.highlight-pjp {
    color: var(--primary-blue);
    font-weight: 700;
}

.badge {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-rose {
    background: rgba(220, 38, 38, 0.12);
    color: var(--rose-danger);
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.badge-amber {
    background: rgba(217, 119, 6, 0.12);
    color: var(--amber-warning);
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.data-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015);
}

body.dark-theme .data-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.06);
}

.empty-state-row td {
    padding: 60px 20px;
    text-align: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.empty-icon { width: 36px; height: 36px; color: var(--text-light); }

.empty-state h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
}

/* Modal Spec */
.hidden { display: none !important; }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close-icon:hover { color: var(--text-heading); }

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.spec-section h4 { font-size: 0.88rem; color: var(--primary-blue); margin-bottom: 6px; }
.spec-list { padding-left: 18px; font-size: 0.82rem; color: var(--text-body); }
.spec-list li { margin-bottom: 4px; }

.spec-grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: 6px;
}

.spec-grid-table th, .spec-grid-table td {
    padding: 8px 10px;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.spec-grid-table th { background: var(--bg-surface-secondary); }

/* Toast Notifications */
.toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-header);
    color: #ffffff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.84rem;
    animation: toastIn 0.2s ease-out;
}

.toast-item i { width: 16px; height: 16px; }
.toast-success i { color: #34d399; }
.toast-error i { color: #f87171; }
.toast-info i { color: #60a5fa; }

@keyframes toastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
