/* Freight-AI - Core Design System & Glassmorphism Theme */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-dark: #07090e;
    --bg-surface-1: #0d121d;
    --bg-surface-2: #131b2e;
    --bg-surface-3: #1a243d;
    --bg-glass: rgba(13, 18, 29, 0.72);
    --bg-glass-card: rgba(19, 27, 46, 0.65);
    --bg-glass-elevated: rgba(26, 36, 61, 0.85);

    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-bright: rgba(6, 182, 212, 0.35);
    --border-glass-glow: rgba(99, 102, 241, 0.4);

    --primary-cyan: #06b6d4;
    --primary-cyan-glow: rgba(6, 182, 212, 0.4);
    --accent-indigo: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-sky: #38bdf8;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --text-cyan: #22d3ee;
    --text-emerald: #34d399;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.55);
    --shadow-glow-cyan: 0 0 24px rgba(6, 182, 212, 0.25);
    --shadow-glow-indigo: 0 0 24px rgba(99, 102, 241, 0.25);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 25%, rgba(6, 182, 212, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
    background-attachment: fixed;
}

/* App Header & Top Navigation */
.app-header {
    background: var(--bg-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.85rem 1.75rem;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1720px;
    margin: 0 auto;
    gap: 1.5rem;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-badge {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-cyan), var(--accent-indigo));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: var(--shadow-glow-cyan);
    position: relative;
    overflow: hidden;
}

.brand-info h1 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, var(--primary-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.4px;
}

.header-telemetry {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

.telemetry-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8rem;
}

.telemetry-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--primary-cyan);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
    animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.branch-select {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
}

.btn-cyber {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(99, 102, 241, 0.2));
    border: 1px solid var(--border-glass-bright);
    color: var(--primary-cyan);
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.btn-cyber:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.4), rgba(99, 102, 241, 0.4));
    border-color: var(--primary-cyan);
    box-shadow: var(--shadow-glow-cyan);
    transform: translateY(-1px);
}

.btn-solid {
    background: linear-gradient(135deg, var(--primary-cyan), var(--accent-indigo));
    border: none;
    color: #ffffff;
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
    transition: var(--transition-smooth);
}

.btn-solid:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

/* Secondary Navigation / Module Tabs */
.nav-tab-bar {
    background: rgba(13, 18, 29, 0.6);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.5rem 1.75rem;
    backdrop-filter: blur(12px);
    position: sticky;
    top: 65px;
    z-index: 90;
    overflow-x: auto;
}

.tab-list {
    display: flex;
    gap: 0.5rem;
    max-width: 1720px;
    margin: 0 auto;
    list-style: none;
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    background: var(--bg-surface-2);
    color: var(--primary-cyan);
    border-color: var(--border-glass-bright);
    box-shadow: 0 2px 12px rgba(6, 182, 212, 0.15);
    font-weight: 600;
}

.tab-badge {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary-cyan);
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
}

/* Main Layout */
.app-container {
    max-width: 1720px;
    margin: 1.5rem auto;
    padding: 0 1.75rem 4rem 1.75rem;
}

.view-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view-panel.active {
    display: block;
}

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

/* Grid & Cards */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.glass-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    box-shadow: var(--shadow-glass);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.14);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-glass);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-main);
}

/* KPI Summary Cards */
.kpi-card {
    background: linear-gradient(135deg, rgba(19, 27, 46, 0.85), rgba(26, 36, 61, 0.6));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid var(--border-glass-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.kpi-data h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.kpi-data .kpi-num {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: #ffffff;
}

.kpi-trend {
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.25rem;
}

.trend-up { color: var(--accent-emerald); }
.trend-alert { color: var(--accent-amber); }

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.cyber-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.cyber-table th {
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.6px;
}

.cyber-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    vertical-align: middle;
}

.cyber-table tr:hover td {
    background: rgba(255, 255, 255, 0.025);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--text-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--text-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-rose {
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

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

.modal-window {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-glass-bright);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), var(--shadow-glow-cyan);
    position: relative;
    animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-glass);
}

.modal-body {
    padding: 1.75rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: var(--accent-rose);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-surface-3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-cyan);
}
