:root {
    --primary: #1e3a8a; /* Deep Blue */
    --primary-light: #3b82f6;
    --secondary: #0f172a; /* Slate */
    --accent: #14b8a6; /* Teal */
    --background: #f8fafc;
    --sidebar-bg: #1e293b;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 260px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    height: 100%;
}

/* Modern Responsive Layout */
.page {
    display: flex !important;
    flex-direction: row !important;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background-color: var(--background);
}

#sidebar-toggle {
    display: none;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    height: 100vh;
    overflow: hidden;
}

.sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: white;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-toggler-mini {
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    color: rgba(255,255,255,0.6);
}

.sidebar-toggler-mini:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-brand i {
    color: var(--accent);
}

/* Header Styling (Glassmorphism) */
.main-header {
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
}

.sidebar-toggler {
    font-size: 1.5rem;
    color: var(--text-main) !important;
    cursor: pointer;
    margin-right: 1.5rem;
    width: 45px;
    height: 45px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.2s;
    background: rgba(0,0,0,0.03);
}

.sidebar-toggler:hover {
    background: rgba(0,0,0,0.08);
    color: var(--primary) !important;
}

.page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.fy-badge {
    background: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.2);
    display: flex;
    align-items: center;
}

/* User Profile in Header */
.user-profile {
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.user-info {
    margin-left: 0.75rem;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.top-row .ms-auto {
    min-width: 120px; /* Protect FY display */
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar Nav */
.nav-menu {
    padding: 1rem 0;
}

/* Sidebar Nav Scrollable */
.nav-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 2rem;
}

/* Custom thin scrollbar for sidebar */
.nav-scrollable::-webkit-scrollbar {
    width: 8px;
}

.nav-scrollable::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.nav-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.nav-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.65);
    background-clip: content-box;
}

.nav-item {
    padding: 0.25rem 1rem;
}


.nav-header {
    padding: 1.5rem 1.5rem 0.5rem 2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    opacity: 0.8;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.active {
    background-color: var(--primary);
    color: white;
}

.nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.nav-sub-menu {
    background: rgba(0, 0, 0, 0.1);
    margin: 0.25rem 0.75rem;
    padding: 0.25rem 0;
    border-radius: 0.5rem;
}

.nav-sub-menu .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Cards & Layout */
.card {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-light);
}

/* Dashboard KPI Styles */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.bg-primary-soft { background-color: #eff6ff; }
.bg-success-soft { background-color: #f0fdf4; }
.bg-warning-soft { background-color: #fffbeb; }
.bg-danger-soft { background-color: #fef2f2; }
.bg-info-soft { background-color: #f0f9ff; }

.fw-black { font-weight: 900; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-down {
    animation: fadeInDown 0.3s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Main Content Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--background);
    position: relative;
    min-width: 0;
}

.auth-page .main-header {
    justify-content: center;
}

.auth-page main {
    background-color: #f1f5f9; /* Slightly different bg for auth */
}

.content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Desktop Collapsed Sidebar Logic */
@media (min-width: 992px) {
    #sidebar-toggle:checked ~ .page .sidebar {
        width: 70px;
        min-width: 70px;
    }

    #sidebar-toggle:checked ~ .page .sidebar .sidebar-brand span,
    #sidebar-toggle:checked ~ .page .sidebar .sidebar-brand div,
    #sidebar-toggle:checked ~ .page .sidebar .nav-text,
    #sidebar-toggle:checked ~ .page .sidebar .user-info,
    #sidebar-toggle:checked ~ .page .sidebar .fa-chevron-down,
    #sidebar-toggle:checked ~ .page .sidebar .fa-chevron-right {
        display: none !important;
    }

    #sidebar-toggle:checked ~ .page .sidebar .sidebar-brand {
        justify-content: center;
        padding: 0;
    }

    #sidebar-toggle:checked ~ .page .sidebar .sidebar-toggler-mini {
        display: flex !important;
        color: white;
    }

    #sidebar-toggle:checked ~ .page .sidebar .nav-link {
        justify-content: center;
        padding: 0.75rem 0;
    }

    #sidebar-toggle:checked ~ .page .sidebar .nav-link i {
        margin-right: 0;
        font-size: 1.25rem;
    }

    #sidebar-toggle:checked ~ .page .sidebar .sidebar-brand {
        padding: 0;
        justify-content: center;
    }
}

/* Mobile Responsiveness (For Sidebar) */
@media (max-width: 991.98px) {
    .sidebar-toggler-mini {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 280px;
        z-index: 2000;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 1900;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    #sidebar-toggle:checked ~ .page .sidebar {
        transform: translateX(0);
    }

    #sidebar-toggle:checked ~ .page .sidebar-overlay {
        display: block;
        opacity: 1;
    }

    .main-header {
        padding: 0 1rem;
    }

    .content {
        padding: 1rem;
    }
}

/* --- Universal Responsive Patterns --- */

/* Stacked Table Pattern (Important for Mobile) */
@media (max-width: 767.98px) {
    .table-responsive-stack thead {
        display: none; /* Hide headers on mobile */
    }

    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid var(--border) !important;
        border-radius: 1rem;
        background: white;
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right !important;
        padding: 0.75rem 1rem !important;
        border: none !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.7rem;
        color: var(--text-muted);
        text-align: left;
        flex: 1;
        margin-right: 1rem;
    }

    .table-responsive-stack td:last-child {
        border-bottom: none !important;
        background: #f8fafc;
        justify-content: center;
    }
}

/* Grid Stacking Utilities */
@media (max-width: 575.98px) {
    .d-mobile-block { display: block !important; }
    .w-mobile-100 { width: 100% !important; }
    .mb-mobile-3 { margin-bottom: 1rem !important; }
    
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group-mobile .btn {
        width: 100%;
        border-radius: 0.5rem !important;
    }
}

/* Dashboard Responsive Tweaks */
@media (max-width: 991.98px) {
    .stat-card {
        margin-bottom: 1rem;
    }
}

/* Modal Responsive Fixes */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: none;
    }
    .modal-content {
        border-radius: 1rem;
    }
}

/* Universal Table Stack Pattern — labels only on mobile */
@media (max-width: 767px) {
    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--primary);
        float: left;
    }
}

/* Print Styles - Professional Templates (A4, A5, Thermal, Dot Matrix) */
.print-only {
    display: none !important;
}

@media print {
    /* ── Show ONLY the invoice/receipt ─────────────────────────────────── */
    /* Hide every direct child of body, then reveal the print-template */
    body > * {
        display: none !important;
    }

    /* The Blazor app root — make it visible but only as a pass-through */
    body > app,
    body > #app,
    body > div[b-] {
        display: block !important;
    }

    /* Hide everything except .d-print-block wrappers */
    .d-print-none,
    .sidebar, .navbar, .top-row, .no-print,
    .spinner-border, .sidebar-overlay, .alert {
        display: none !important;
    }

    /* Show .d-print-block (our PrintTemplate wrapper) */
    .d-print-block {
        display: block !important;
    }

    /* Show the invoice itself */
    .print-template {
        display: block !important;
    }

    body {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .page, main, .content, .main-content {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    @page {
        margin: 10mm;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        background: transparent !important;
    }

    .table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-bottom: 1rem !important;
    }

    .table th, .table td {
        padding: 8px !important;
        color: black !important;
        border: 1px solid #dee2e6 !important;
    }
    
    .table thead th {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Print Format Classes */
    
    /* --- Format 1: A4 Professional Corporate --- */
    .print-format-a4 {
        width: 100%;
        padding: 0;
        margin: 0;
        font-family: 'Segoe UI', Arial, sans-serif !important;
        font-size: 11pt !important;
    }
    .print-format-a4 .invoice-header { border-bottom: 3px solid #1e3a8a; padding-bottom: 8px; margin-bottom: 12px; }
    .print-format-a4 .company-name { font-size: 20pt; font-weight: 800; color: #1e3a8a !important; text-transform: uppercase; }
    .print-format-a4 .table thead th { border-bottom: 2px solid #1e3a8a !important; color: #1e3a8a !important; font-weight: 600; font-size: 10pt; background: #f0f4ff !important; }
    .print-format-a4 .summary-box { background-color: #f8f9fa !important; border-left: 5px solid #1e3a8a; padding: 12px; border-radius: 4px; }
    .print-format-a4 .watermark { position: absolute; top: 300px; left: 50%; transform: translateX(-50%) rotate(-45deg); font-size: 80pt; color: rgba(0,0,0,0.025); z-index: -1; font-weight: 900; pointer-events: none; width: 100%; text-align: center; }

    /* --- Format 2: A5 Compact Business --- */
    .print-format-a5 {
        width: 100%;
        padding: 0;
        margin: 0;
        font-family: 'Segoe UI', Arial, sans-serif !important;
        font-size: 9pt !important;
        line-height: 1.4;
    }
    .print-format-a5 .invoice-header { 
        border-bottom: 2px solid #1e40af; 
        padding-bottom: 8px; 
        margin-bottom: 15px; 
    }
    .print-format-a5 .company-name { 
        font-size: 16pt; 
        font-weight: 800; 
        color: #1e40af !important; 
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .print-format-a5 .table thead th { 
        background: #f1f5f9 !important; 
        border-bottom: 2px solid #1e40af !important; 
        color: #1e3a8a !important; 
        font-weight: 700; 
        text-transform: uppercase;
        font-size: 8pt;
    }
    .print-format-a5 .summary-box { 
        border-left: 4px solid #1e40af; 
        background: #f8fafc !important; 
        padding: 10px; 
        border-radius: 0 5px 5px 0;
    }

    /* --- Format 3: Thermal Receipt (Suprint Style) --- */
    .print-format-thermal {
        width: 100%;
        padding: 0 1mm !important;
        margin: 0 !important;
        font-family: 'Arial Narrow', sans-serif !important;
        font-size: 7.5pt !important;
        line-height: 1.1 !important;
        color: black !important;
    }
    .print-format-thermal .company-name { 
        font-size: 12pt; 
        font-weight: 950; 
        text-align: center; 
        margin-bottom: 1px; 
        text-transform: uppercase; 
        letter-spacing: -0.2px;
    }
    .print-format-thermal .invoice-header { text-align: center; margin-bottom: 4px; }
    .print-format-thermal .tax-invoice-label { 
        border-top: 1.2px solid #000; 
        border-bottom: 1.2px solid #000; 
        padding: 2px 0; 
        margin: 3px 0; 
        font-weight: 900; 
        text-transform: uppercase; 
        font-size: 8.5pt; 
    }
    .print-format-thermal .table { 
        font-size: 7pt !important; 
        border-collapse: collapse !important;
    }
    .print-format-thermal .table th { 
        border-top: 1px solid #000 !important; 
        border-bottom: 1px solid #000 !important; 
        padding: 3px 0 !important; 
        font-weight: 900 !important; 
    }
    .print-format-thermal .table td { padding: 2px 0 !important; }
    .print-format-thermal .bill-total { 
        font-size: 12pt; 
        font-weight: 950; 
        border-top: 1px dashed #000; 
        border-bottom: 1px dashed #000; 
        padding: 4px 0; 
        margin: 4px 0; 
    }
    .print-format-thermal .savings-msg { 
        background: #000 !important; 
        color: #fff !important; 
        font-weight: bold; 
        margin: 6px 0; 
        padding: 2px; 
        -webkit-print-color-adjust: exact; 
        font-size: 7pt;
    }
    
    /* Width constraints for different paper sizes */
    .width-2in { width: 54mm !important; }
    .width-3in { width: 72mm !important; }
    .width-4in { width: 100mm !important; }
    
    @page {
        margin: 0 !important;
    }
    
    /* Hide browser headers/footers */
    header, footer { display: none !important; }

}

/* UI Utilities */
.modal-backdrop { z-index: 1040; }
.hover-bg-light:hover:not(.active) { background-color: #f8f9fa !important; }
.list-group-item.active { z-index: 2; background-color: #0d6efd !important; border-color: #0d6efd !important; color: white !important; }
.list-group-item.active .text-muted { color: rgba(255,255,255,0.8) !important; }
.list-group-item.active .text-light { color: white !important; }

/* Barcode Label Printing */
.barcode-print-container {
    display: none;
}

@media print {
    @page { margin: 0; }
    body { margin: 1cm; }

    /* Hide everything when printing barcodes using visibility trick */
    body.printing-barcodes {
        visibility: hidden;
    }
    
    body.printing-barcodes .barcode-print-container,
    body.printing-barcodes .barcode-print-container * {
        visibility: visible;
    }

    body.printing-barcodes .barcode-print-container {
        display: block !important;
        background: white;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 9999;
    }

    .barcode-label-page {
        padding: 0;
        margin: 0;
        display: grid;
        grid-template-columns: repeat(var(--barcode-cols, 1), 1fr);
        gap: 2mm;
        width: 100%;
    }

    .barcode-label {
        width: var(--barcode-width, 38mm);
        height: var(--barcode-height, 25mm);
        padding: 2mm;
        border: 0.1mm solid #eee;
        text-align: center;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        page-break-inside: avoid;
        margin: 0 auto;
    }
    
    .barcode-label .item-name {
        font-size: 6.5pt;
        font-weight: bold;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        margin-bottom: 0.5mm;
        line-height: 1;
    }

    .barcode-label svg {
        width: 100% !important;
        height: auto !important;
        max-height: calc(var(--barcode-height, 25mm) - 10mm) !important;
        min-height: 8mm;
    }

    .barcode-label .price-row {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 5px;
        align-items: baseline;
        margin-top: 0.5mm;
        line-height: 1;
    }

    .barcode-label .mrp {
        font-size: 6pt;
        text-decoration: line-through;
        color: #666;
        font-weight: normal;
    }

    .barcode-label .price {
        font-size: 8pt;
        font-weight: 900;
        color: #000;
    }
}

/* Bulk Transaction Excel-like Grid */
.excel-grid-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.excel-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.excel-grid th {
    background-color: #f1f5f9;
    color: var(--text-main);
    font-weight: 600;
    padding: 12px 10px;
    border: 1px solid #cbd5e1;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.excel-grid td {
    border: 1px solid #e2e8f0;
    padding: 0;
    vertical-align: middle;
}

.excel-grid .cell-input {
    width: 100%;
    height: 38px;
    border: none;
    padding: 8px 10px;
    background: transparent;
    outline: none;
    transition: all 0.1s;
    font-family: inherit;
    font-size: inherit;
}

.excel-grid .cell-input:focus {
    background-color: #f0f9ff;
    box-shadow: inset 0 0 0 2px var(--primary-light);
    z-index: 5;
}

.excel-grid select.cell-input {
    appearance: none;
    cursor: pointer;
}

.excel-grid tr:nth-child(even) {
    background-color: #f8fafc;
}

.excel-grid tr:hover {
    background-color: #f1f5f9;
}

.excel-grid .row-index {
    width: 40px;
    text-align: center;
    background-color: #f1f5f9;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: bold;
    user-select: none;
    border-right: 2px solid #cbd5e1 !important;
}

.excel-grid .btn-delete-row {
    color: var(--danger);
    opacity: 0.3;
    transition: all 0.2s;
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    width: 100%;
}

.excel-grid tr:hover .btn-delete-row {
    opacity: 1;
}

.excel-grid .invalid-cell {
    background-color: #fee2e2 !important;
}

.excel-grid .text-end {
    text-align: right;
}

.excel-grid .text-center {
    text-align: center;
}

.bulk-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    z-index: 20;
}

/* ============================================================
   NAVIGATION PROGRESS BAR
   ============================================================ */

@keyframes progress-run {
    0%   { left: -40%; width: 40%; }
    60%  { left: 100%; width: 40%; }
    100% { left: 100%; width: 0; }
}

.nav-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    z-index: 99998;
    overflow: hidden;
    pointer-events: none;
    background: transparent;
}

.nav-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #3b82f6, #14b8a6, #3b82f6);
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.nav-progress-bar.nav-progress-active::after {
    opacity: 1;
    animation: progress-run 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* =====================================================
   Company Switcher — Sidebar
   ===================================================== */
.company-switcher-wrapper {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 0.75rem;
    margin: 0.5rem 0.75rem 0.25rem;
    padding: 0.6rem 0.75rem !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.company-switcher-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 0.4rem;
}

.company-switcher-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.company-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    color: white;
}

.company-switcher-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.co-avatar {
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #4e73df, #224abe);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* Collapsed sidebar — hide company switcher entirely */
#sidebar-toggle:checked ~ .page .sidebar .company-switcher-wrapper {
    display: none !important;
}