/* style.css - Premium Light-Theme Neo-Bank Design System for Dubai Accounting Dashboard */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #f8fafc; /* Soft clean gray-white background */
    --bg-panel: #ffffff; /* Pure white sidebar and cards */
    --bg-panel-solid: #ffffff;
    --border-color: #e2e8f0; /* Fine light border */
    --border-glow: rgba(14, 165, 233, 0.15); /* Soft sky blue glow */
    
    --text-primary: #0f172a; /* Deep slate gray */
    --text-muted: #64748b; /* Cool slate gray */
    
    --primary: #0284c7; /* Sky blue primary accent */
    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    --success: #10b981; /* Emerald green */
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --danger: #ef4444; /* Rose red */
    --danger-bg: #fff1f2;
    --danger-border: #fecdd3;
    --warning: #f59e0b; /* Amber yellow */
    --warning-bg: #fef3c7;
    --warning-border: #fde68a;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.45rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3.5rem;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    border-radius: 9px;
    position: relative;
}

.brand-icon::after {
    content: '';
    position: absolute;
    inset: 7px;
    background: var(--bg-panel);
    border-radius: 4px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item a:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

.nav-item.active a {
    color: var(--primary);
    background: #e0f2fe;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0f2fe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
}

.user-info .username {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info .user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2.5rem 3.5rem;
    min-height: 100vh;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title h1 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

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

/* Currency Switcher Toggle */
.currency-selector {
    display: flex;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: 11px;
}

.currency-btn {
    padding: 0.4rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}

.currency-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Premium White Cards */
.glass-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    position: relative;
    box-shadow: var(--shadow-premium);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.01);
    border-color: #cbd5e1;
}

/* Stat Cards */
.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 125px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.receivables {
    background: #f0fdf4;
    border-color: #dcfce7;
}
.stat-card.receivables .stat-icon-wrapper {
    background: #bbf7d0;
    color: #166534;
}
.stat-card.receivables .stat-value {
    color: #166534;
}

.stat-card.payables {
    background: #fff5f5;
    border-color: #fee2e2;
}
.stat-card.payables .stat-icon-wrapper {
    background: #fecaca;
    color: #991b1b;
}
.stat-card.payables .stat-value {
    color: #991b1b;
}

.stat-card.balance {
    background: #f0f9ff;
    border-color: #e0f2fe;
}
.stat-card.balance .stat-icon-wrapper {
    background: #bae6fd;
    color: #075985;
}
.stat-card.balance .stat-value {
    color: #075985;
}

.stat-value {
    font-size: 1.95rem;
    font-family: var(--font-heading);
    font-weight: 700;
    margin-top: 0.5rem;
    letter-spacing: -0.02em;
}

/* Grid Layout for Charts & Lists */
.content-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    min-height: 350px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Tables & Lists */
.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-link {
    font-size: 0.88rem;
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
}

.btn-link:hover {
    color: #0369a1;
}

/* Custom Table styling */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.custom-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.92rem;
    vertical-align: middle;
    color: #334155;
}

.custom-table tbody tr {
    transition: var(--transition);
}

.custom-table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid var(--success-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid var(--danger-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid var(--warning-border);
}

.badge-info {
    background: #f0f9ff;
    color: #075985;
    border: 1px solid #bae6fd;
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 0.65rem 1.3rem;
    border-radius: 10px;
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.15);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(2, 132, 199, 0.25);
    background: #0369a1;
}

/* Filters & Inputs */
.filter-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-input {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    outline: none;
    min-width: 170px;
    transition: var(--transition);
}

.filter-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.08);
}

/* Reports Styles */
.report-section {
    margin-bottom: 2rem;
}

.report-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    color: var(--primary);
}

.report-row {
    display: flex;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: #334155;
}

.report-row.subtotal {
    font-weight: 600;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-primary);
}

.report-row.total {
    font-weight: 700;
    font-size: 1.2rem;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px double var(--border-color);
    background: #f0f9ff;
    color: var(--primary);
}

.report-row.indent {
    padding-left: 2rem;
}

.reports-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}

/* Icons */
.lucide {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 2.5rem 0.5rem;
        align-items: center;
    }
    
    .brand-icon {
        margin-bottom: 0;
    }
    
    .brand span, .nav-item span, .user-info, .sidebar-footer {
        display: none;
    }
    
    .brand {
        margin-bottom: 2.5rem;
    }
    
    .main-content {
        margin-left: 80px;
        padding: 2.5rem 1.5rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .content-grid-2-1 {
        grid-template-columns: 1fr;
    }
    
    .reports-layout-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Refined Corporate Letterhead System (Single-Page Luxury Dubai Layout)
   ========================================================================== */

.lh-container {
    width: 100%;
    margin-bottom: 1.25rem;
    font-family: var(--font-body);
}

.lh-top-bar {
    height: 4px;
    background: linear-gradient(90deg, #d4af37 0%, #0f172a 50%, #d4af37 100%);
    border-radius: 2px;
    margin-bottom: 0.85rem;
}

/* Single Line Header: English Left, Arabic Right (No Logo) */
.lh-header-single-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.65rem;
    padding: 0.25rem 0;
}

.lh-brand-en-single {
    text-align: left;
    flex: 1;
}

.lh-en-title-single {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #0f172a;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
}

.lh-brand-ar-single {
    text-align: right;
    flex: 1;
}

.lh-ar-title-single {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    direction: rtl;
    font-family: 'Amiri', 'Traditional Arabic', 'Segoe UI', sans-serif;
    white-space: nowrap;
    line-height: 1;
}

/* Address Strip */
.lh-address-strip {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    padding: 0.35rem 0;
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px dashed #cbd5e1;
    margin-bottom: 0.85rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
}

.lh-bullet {
    color: #d4af37;
    font-size: 1rem;
}

/* Document Banner (Light High-Contrast Corporate Banner) */
.lh-doc-banner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #b8860b;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.lh-main-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 900;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    line-height: 1.1;
}

.lh-sub-title {
    font-size: 0.8rem;
    color: #64748b;
    display: block;
    margin-top: 2px;
    font-weight: 500;
}

.lh-doc-meta {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    font-size: 0.85rem;
}

.lh-meta-item {
    color: #475569;
}

.lh-meta-item stroke, .lh-meta-item strong {
    color: #0f172a;
}

.lh-meta-status {
    display: inline-block;
}

/* FOOTER COMPONENT (STAMP, EMAIL, SIGNATURE) */
.lh-footer-container {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1.5px solid #cbd5e1;
    page-break-inside: avoid;
}

.lh-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Corporate Blue Ink Stamp */
.lh-stamp-wrapper {
    flex-shrink: 0;
    position: relative;
}

.lh-ink-stamp {
    transform: rotate(-10deg);
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(30, 64, 175, 0.15));
}

.lh-center-contact {
    text-align: center;
    flex: 1;
}

.lh-email-pill {
    display: inline-block;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a !important;
    margin-bottom: 0.35rem;
    white-space: nowrap;
}

.lh-footer-address-sm {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
}

/* Signature Section */
.lh-sig-wrapper {
    text-align: center;
    min-width: 170px;
    flex-shrink: 0;
}

.lh-sig-art {
    margin-bottom: 0;
}

.lh-sig-name {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0f172a;
    font-family: var(--font-heading);
    line-height: 1.1;
}

.lh-sig-role {
    font-size: 0.68rem;
    font-weight: 700;
    color: #b8860b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* COMPACT INVOICE CARD & TABLE SPACING FOR SINGLE-PAGE PRINT */
.b2b-meta-grid {
    padding: 1rem 0 !important;
    margin-bottom: 1.5rem !important;
}

.b2b-table th, .b2b-table td {
    padding: 0.65rem 0.85rem !important;
}

.totals-container {
    margin-top: 1rem !important;
}

/* AUTHENTICATION & SIDEBAR USER CONTROLS */
.profile-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.btn-profile-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: #f8fafc;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.btn-profile-action:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

.btn-profile-action.logout:hover {
    background-color: #fef2f2;
    color: #ef4444;
    border-color: #fecdd3;
}

/* MODAL SYSTEM */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #ffffff;
    width: 90%;
    max-width: 480px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(20px);
    transition: all 0.25s ease;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* TOAST NOTIFICATION SYSTEM */
.auth-toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.auth-toast-notification.success {
    border-left: 4px solid var(--success);
}

.auth-toast-notification.error {
    border-left: 4px solid var(--danger);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

/* PRINT MEDIA OVERRIDES (FORCE PERFECT SINGLE PAGE) */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm 10mm;
    }

    .print-hide, .lh-style-selector-bar {
        display: none !important;
    }

    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        height: auto !important;
        font-size: 11.5px !important;
    }

    .app-container, .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .invoice-card, .glass-card, .receipt-card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        page-break-inside: avoid !important;
    }

    .lh-top-bar {
        background: #000000 !important;
    }

    .lh-en-title {
        color: #000000 !important;
        -webkit-text-fill-color: #000000 !important;
    }

    .lh-doc-banner {
        background: #f8fafc !important;
        color: #000000 !important;
        border: 1px solid #cbd5e1 !important;
        border-left: 4px solid #b8860b !important;
    }

    .lh-main-title {
        color: #000000 !important;
    }

    .lh-sub-title {
        color: #475569 !important;
    }

    .lh-meta-item {
        color: #000000 !important;
    }

    .lh-footer-container {
        page-break-inside: avoid !important;
        margin-top: 1.25rem !important;
        padding-top: 0.75rem !important;
    }

    .lh-ink-stamp {
        filter: none !important;
    }
}
