/**
 * FUS ALIANZ Brand Stylesheet — LiPb Expert System
 * Based on FUS ALIANZ Brand Design Guide v1.0 (Feb 2026)
 * Typography: Inter (primary), JetBrains Mono (technical)
 */

/* ─── CSS Custom Properties ────────────────────────────────── */
:root {
    /* Primary Colors */
    --fus-deep-navy:    #0A1628;
    --fus-navy:         #1B3A5C;
    --fus-medium-blue:  #2B5F8E;
    --fus-cyan:         #00B4D8;

    /* Accent & Status */
    --fus-amber:        #F77F00;
    --fus-green:        #10B981;
    --fus-red:          #EF4444;

    /* Neutral Scale */
    --fus-900:          #111827;
    --fus-700:          #374151;
    --fus-400:          #9CA3AF;
    --fus-200:          #E5E7EB;
    --fus-100:          #F3F4F6;
    --fus-white:        #FFFFFF;

    /* Functional */
    --sidebar-width:    260px;
    --sidebar-collapsed: 64px;
    --topbar-height:    56px;
    --border-radius:    8px;
    --border-radius-sm: 4px;
    --shadow-card:      0 4px 6px rgba(0,0,0,0.07);
    --shadow-hover:     0 8px 16px rgba(0,0,0,0.10);
    --transition:       200ms ease;
}

/* ─── Base Reset & Typography ──────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.625;
    color: var(--fus-700);
    background-color: var(--fus-100);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--fus-900);
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0;
}

h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
h2 { font-size: clamp(1.5rem, 2.5vw, 1.75rem); }
h3 { font-size: clamp(1.125rem, 2vw, 1.375rem); font-weight: 600; }

.font-mono, code, .data-label {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

a {
    color: var(--fus-cyan);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--fus-medium-blue);
}

/* ─── Layout: Sidebar + Content ────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--fus-deep-navy) 0%, var(--fus-navy) 100%);
    color: var(--fus-white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: width var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand img {
    height: 32px;
    width: auto;
}

.sidebar-brand h2 {
    color: var(--fus-white);
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.sidebar-brand .brand-subtitle {
    font-size: 0.65rem;
    color: var(--fus-cyan);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
}

.sidebar-section {
    padding: 0.75rem 0;
}

.sidebar-section-title {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fus-400);
    padding: 0.25rem 1.25rem 0.5rem;
    font-weight: 600;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--fus-white);
}

.sidebar-nav li a.active {
    background: rgba(0,180,216,0.10);
    color: var(--fus-cyan);
    border-left-color: var(--fus-cyan);
}

.sidebar-nav li a i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.75rem;
    color: var(--fus-400);
}

/* ─── Main Content ─────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    transition: margin-left var(--transition);
}

.topbar {
    height: var(--topbar-height);
    background: var(--fus-white);
    border-bottom: 1px solid var(--fus-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 500;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fus-900);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-area {
    padding: 1.5rem;
    max-width: 1280px;
}

/* ─── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--fus-white);
    border: 1px solid var(--fus-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fus-200);
    font-weight: 600;
    color: var(--fus-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* Stat cards on dashboard */
.stat-card {
    border-top: 3px solid var(--fus-cyan);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--fus-navy);
    font-family: 'JetBrains Mono', monospace;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--fus-400);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card.accent-amber  { border-top-color: var(--fus-amber); }
.stat-card.accent-green  { border-top-color: var(--fus-green); }
.stat-card.accent-navy   { border-top-color: var(--fus-navy); }

/* ─── Buttons (Brand) ─────────────────────────────────────── */
.btn-fus-primary {
    background: var(--fus-cyan);
    color: var(--fus-white);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-fus-primary:hover {
    background: #009ab8;
    color: var(--fus-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,180,216,0.3);
}

.btn-fus-secondary {
    background: transparent;
    color: var(--fus-navy);
    border: 1px solid var(--fus-200);
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-fus-secondary:hover {
    border-color: var(--fus-cyan);
    color: var(--fus-cyan);
}

.btn-fus-amber {
    background: var(--fus-amber);
    color: var(--fus-white);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-fus-amber:hover {
    background: #e06f00;
    color: var(--fus-white);
}

/* ─── Forms ────────────────────────────────────────────────── */
.form-control, .form-select {
    border: 1px solid var(--fus-200);
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 0.875rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    height: 42px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--fus-cyan);
    box-shadow: 0 0 0 2px rgba(0,180,216,0.15);
    outline: none;
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--fus-900);
    margin-bottom: 0.25rem;
}

.input-unit {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--fus-400);
}

/* ─── Tables ───────────────────────────────────────────────── */
.table-fus {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-fus thead th {
    background: var(--fus-deep-navy);
    color: var(--fus-white);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table-fus tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--fus-200);
    vertical-align: middle;
}

.table-fus tbody tr:hover {
    background: rgba(0,180,216,0.03);
}

.table-fus .cell-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
}

/* ─── Badges ───────────────────────────────────────────────── */
.badge-fus {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-cyan    { background: rgba(0,180,216,0.12); color: var(--fus-cyan); }
.badge-amber   { background: rgba(247,127,0,0.12); color: var(--fus-amber); }
.badge-green   { background: rgba(16,185,129,0.12); color: var(--fus-green); }
.badge-red     { background: rgba(239,68,68,0.12); color: var(--fus-red); }
.badge-navy    { background: rgba(27,58,92,0.12); color: var(--fus-navy); }

/* ─── Alerts ───────────────────────────────────────────────── */
.alert-fus {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success { background: rgba(16,185,129,0.08); border-left: 3px solid var(--fus-green); color: #065f46; }
.alert-error   { background: rgba(239,68,68,0.08); border-left: 3px solid var(--fus-red); color: #991b1b; }
.alert-info    { background: rgba(0,180,216,0.08); border-left: 3px solid var(--fus-cyan); color: var(--fus-navy); }

/* ─── Plot Viewer ──────────────────────────────────────────── */
.plot-container {
    background: var(--fus-white);
    border: 1px solid var(--fus-200);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.plot-container img {
    max-width: 100%;
    height: auto;
    cursor: zoom-in;
    transition: transform var(--transition);
}

.plot-container.zoomed img {
    transform: scale(2);
    cursor: zoom-out;
}

.plot-toolbar {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

/* ─── Auth Pages ───────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fus-deep-navy) 0%, var(--fus-navy) 60%, var(--fus-medium-blue) 100%);
    padding: 2rem;
}

.auth-card {
    background: var(--fus-white);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card .auth-logo img {
    height: 48px;
}

.auth-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--fus-400);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* ─── LaTeX / Formula Display ──────────────────────────────── */
.formula-display {
    background: var(--fus-100);
    border: 1px solid var(--fus-200);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    .sidebar .sidebar-brand h2,
    .sidebar .sidebar-section-title,
    .sidebar-nav li a span,
    .sidebar-footer {
        display: none;
    }
    .sidebar-nav li a {
        justify-content: center;
        padding: 0.8rem;
    }
    .main-content {
        margin-left: var(--sidebar-collapsed);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        overflow-x: auto;
    }
    .sidebar .sidebar-brand h2,
    .sidebar .sidebar-section-title,
    .sidebar-footer {
        display: none;
    }
    .sidebar-section {
        display: flex;
        padding: 0;
    }
    .sidebar-nav {
        display: flex;
    }
    .sidebar-nav li a {
        padding: 0.75rem;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        font-size: 0.75rem;
    }
    .sidebar-nav li a.active {
        border-bottom-color: var(--fus-cyan);
        border-left-color: transparent;
    }
    .sidebar-nav li a span { display: none; }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: 1rem;
    }
}

/* ─── Utility ──────────────────────────────────────────────── */
.text-cyan  { color: var(--fus-cyan) !important; }
.text-amber { color: var(--fus-amber) !important; }
.text-navy  { color: var(--fus-navy) !important; }
.bg-navy    { background-color: var(--fus-deep-navy) !important; }
.border-cyan { border-color: var(--fus-cyan) !important; }
.font-mono  { font-family: 'JetBrains Mono', monospace !important; }
