/* ==========================================================================
   CarmPOS Modern Premium Styling & Theme System (Dark / Light Glassmorphism)
   ========================================================================== */

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

:root {
    --font-primary: 'Outfit', sans-serif;
    
    /* Dark Theme (Default) */
    --bg-main: #0f172a;
    --bg-secondary: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.75);
    --card-hover: rgba(30, 41, 59, 0.95);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --sidebar-bg: #0b1329;
    --topbar-bg: rgba(15, 23, 42, 0.85);

    /* Accents */
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #ef4444;
    --accent-cyan: #06b6d4;

    /* Glass Effect */
    --backdrop-blur: blur(12px);
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-secondary: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-hover: rgba(255, 255, 255, 1);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-bg: #1e293b;
    --topbar-bg: rgba(255, 255, 255, 0.85);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Card Utility */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.glass-card:hover {
    background: var(--card-hover);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4);
}

/* Main Layout Setup */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* Sidebar Component */
#sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sidebar.collapsed {
    margin-left: -260px;
}

/* 1. Top Section (Fixed Header) */
.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 2. Middle Section (Scrollable Menu) */
.sidebar-scrollable {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
}

/* Custom Thin Dark Scrollbar */
.sidebar-scrollable::-webkit-scrollbar {
    width: 5px;
}

.sidebar-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

.sidebar-scrollable {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

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

.sidebar-menu .menu-header {
    padding: 0.75rem 1.5rem 0.35rem 1.5rem;
    font-size: 0.725rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.sidebar-menu li a,
.sidebar-footer-menu li a {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a,
.sidebar-footer-menu li a:hover,
.sidebar-footer-menu li.active a {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.15);
    border-left-color: var(--accent-blue);
}

/* 3. Bottom Section (Fixed Footer) */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.85rem 0;
    background: var(--sidebar-bg);
    flex-shrink: 0;
}

.sidebar-user-box {
    padding: 0 1.25rem 0.65rem 1.25rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
}

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

/* Page Content Wrapper */
#content-wrapper {
    width: 100%;
    padding-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#content-wrapper.expanded {
    padding-left: 0;
}

/* Top Navbar */
.topbar {
    height: 70px;
    background: var(--topbar-bg);
    backdrop-filter: var(--backdrop-blur);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

/* Form Controls & Input Styling */
.form-control, .form-select {
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
}

[data-theme="light"] .form-control, [data-theme="light"] .form-select {
    background-color: #ffffff;
    color: #0f172a;
}

.form-control:focus, .form-select:focus {
    background-color: transparent;
    border-color: var(--accent-blue);
    color: var(--text-main);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Custom Table Styling */
.table-custom {
    color: var(--text-main);
    margin-bottom: 0;
}

.table-custom th {
    background: rgba(15, 23, 42, 0.3);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
}

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

.table-custom tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* POS Terminal UI Specifics */
.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.product-card {
    cursor: pointer;
    border-radius: 0.85rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.product-card:hover {
    transform: scale(1.02);
    border-color: var(--accent-blue);
}

.product-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
}

/* Badge System */
.badge-soft-success { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.badge-soft-warning { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.badge-soft-danger { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.badge-soft-primary { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }

/* Thermal Receipt & Report Print Styles */
.print-only-header {
    display: none;
}

@media print {
    /* Hide non-printable app UI elements */
    .no-print, nav, header, footer, .btn, .sidebar, #sidebar, .topbar, .sidebar-backdrop, form, .modal {
        display: none !important;
    }

    /* Reset page containers for unclipped printing */
    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #content-wrapper {
        padding-left: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
    }

    .glass-card {
        background: #ffffff !important;
        box-shadow: none !important;
        border: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Target Printable Report Container */
    #printableReport {
        display: block !important;
        position: static !important;
        width: 100% !important;
        color: #000000 !important;
        background: #ffffff !important;
        padding: 10px !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        overflow: visible !important;
    }

    #printableReport .print-only-header {
        display: block !important;
    }

    /* High Contrast Text & Header Formatting */
    #printableReport h3, 
    #printableReport h4, 
    #printableReport h5, 
    #printableReport p, 
    #printableReport small, 
    #printableReport td, 
    #printableReport th, 
    #printableReport span {
        color: #000000 !important;
    }

    #printableReport .print-only-header h3 {
        font-size: 20pt !important;
        font-weight: bold !important;
    }

    #printableReport .print-only-header h5 {
        font-size: 14pt !important;
        font-weight: bold !important;
    }

    /* Table & Summary Row Formatting */
    #printableReport table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 15px !important;
    }

    #printableReport th {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
        border: 1px solid #94a3b8 !important;
        padding: 8px !important;
        font-size: 10pt !important;
        text-align: left !important;
    }

    #printableReport td {
        color: #000000 !important;
        border: 1px solid #cbd5e1 !important;
        padding: 6px 8px !important;
        font-size: 9.5pt !important;
    }

    #printableReport .bg-dark-subtle,
    #printableReport tr.fw-bold {
        background-color: #f8fafc !important;
        color: #000000 !important;
    }

    #printableReport .badge {
        border: 1px solid #64748b !important;
        color: #000000 !important;
        background: transparent !important;
        padding: 2px 5px !important;
        font-size: 8.5pt !important;
    }

    /* Pagination Rules */
    tr {
        page-break-inside: avoid !important;
    }

    /* Thermal Receipts */
    #printable-receipt {
        position: static !important;
        width: 100% !important;
        color: #000000 !important;
        background: #ffffff !important;
        font-family: monospace;
        font-size: 12px;
        padding: 5px;
    }

    .receipt-80mm {
        width: 80mm;
        margin: 0 auto;
    }
    .receipt-58mm {
        width: 58mm;
        margin: 0 auto;
    }
}

/* Sidebar Drawer Backdrop Overlay for Mobile */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    display: none;
}

.sidebar-backdrop.show {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    #sidebar {
        margin-left: -260px;
        box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
    }
    #sidebar.show {
        margin-left: 0;
    }
    #content-wrapper {
        padding-left: 0;
    }
}


