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

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.5);
    --border-glass: rgba(255, 255, 255, 0.07);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --primary: #0d9488; /* Premium Teal */
    --primary-glow: rgba(13, 148, 136, 0.3);
    --secondary: #0284c7; /* Ocean Blue */
    --secondary-glow: rgba(2, 132, 199, 0.3);
    
    --accent: #f43f5e; /* Coral Pink */
    --success: #10b981;
    --warning: #f59e0b;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Premium Light Theme Redefinition (v7.5.0)
   ========================================================================== */
body.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(13, 148, 136, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(2, 132, 199, 0.08) 0px, transparent 50%);
    color: var(--text-primary);
}

/* Light mode adjustments for inputs, select elements, textareas */
body.light-theme input, 
body.light-theme select, 
body.light-theme textarea {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

body.light-theme .sidebar {
    background: rgba(255, 255, 255, 0.8) !important;
    border-right: 1px solid rgba(15, 23, 42, 0.08) !important;
}

body.light-theme .top-header {
    background: rgba(255, 255, 255, 0.6) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
}

body.light-theme .nav-item a {
    color: #475569 !important;
}

body.light-theme .nav-item.active a,
body.light-theme .nav-item a:hover {
    color: var(--primary) !important;
    background: rgba(13, 148, 136, 0.08) !important;
}

body.light-theme .nav-dropdown-toggle {
    color: #475569 !important;
}

body.light-theme .nav-dropdown-menu {
    background: rgba(15, 23, 42, 0.02) !important;
}

body.light-theme .custom-table th {
    background: #f1f5f9 !important;
    color: #334155 !important;
}

body.light-theme .custom-table td {
    color: #334155 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .custom-table tr:hover {
    background: rgba(13, 148, 136, 0.03) !important;
}

body.light-theme .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.8) !important;
    border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05) !important;
}

body.light-theme .bottom-nav-item {
    color: #64748b !important;
}

body.light-theme .bottom-nav-item.active {
    color: var(--primary) !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(13, 148, 136, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(2, 132, 199, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Card Utility */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-smooth);
}

/* Sidebar navigation scroll area (v7.7.0) */
.sidebar nav {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-right: -8px;
    padding-right: 8px;
}

.sidebar nav::-webkit-scrollbar {
    width: 4px;
}

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

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

.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-glass);
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--primary-glow);
    font-weight: 800;
    font-size: 20px;
}

.brand-name {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.nav-item.active a, .nav-item a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 4px 0 0 var(--primary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    margin-top: 20px;
}

.avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
}

.profile-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.profile-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Main Content area */
.main-wrapper {
    flex-grow: 1;
    margin-left: 280px;
    padding: 40px;
    width: calc(100% - 280px);
}

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

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Status Network Badge */
.network-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-glass);
    background: rgba(15, 23, 42, 0.6);
    transition: var(--transition-smooth);
}

.network-badge.online {
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.network-badge.offline {
    border-color: rgba(244, 63, 94, 0.2);
    color: var(--accent);
}

.network-badge.syncing {
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

.dot.blink {
    animation: pulse-glow 1.5s infinite;
}

/* Dashboard Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

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

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

.custom-table th {
    padding: 16px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-glass);
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 14px;
}

.custom-table tr:last-child td {
    border-bottom: none;
}

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

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

/* Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-badge.approved {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-badge.rejected {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.25);
    transition: var(--transition-smooth);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Modal and Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* POS Cashier Layout Grid */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    height: calc(100vh - 150px);
}

.pos-catalog {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    overflow: hidden;
}

.pos-search-bar {
    display: flex;
    gap: 12px;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding-right: 8px;
    height: 100%;
}

/* Catalog Card */
.product-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 190px;
    position: relative;
    cursor: pointer;
}

.product-sku {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
    line-height: 1.3;
}

.product-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    margin-top: auto;
}

.product-stock {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.product-stock span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Cart Panel */
.pos-cart {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px;
}

.cart-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.cart-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    max-width: 60%;
}

.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.cart-item-price {
    font-size: 12px;
    color: var(--primary);
    margin-top: 2px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-val {
    font-size: 13px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
}

/* Cart calculations */
.cart-summary {
    border-top: 1px solid var(--border-glass);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    border-top: 1px dashed var(--border-glass);
    padding-top: 10px;
}

/* Animations */
@keyframes pulse-glow {
    0% {
        opacity: 0.4;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    70% {
        opacity: 1;
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        opacity: 0.4;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Sidebar Nav Dropdown / Tree Menu Styling
   ========================================================================== */
.nav-dropdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 500;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.nav-dropdown-toggle:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-dropdown.open .nav-dropdown-toggle {
    color: var(--text-primary);
}

.nav-dropdown-toggle .arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.nav-dropdown.open .nav-dropdown-toggle .arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 16px;
    border-left: 1px dashed rgba(255, 255, 255, 0.1);
    margin-left: 24px;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease-out;
}

.nav-dropdown.open .nav-dropdown-menu {
    max-height: 200px;
    opacity: 1;
    margin-top: 4px;
    margin-bottom: 6px;
}

/* ==========================================================================
   Mobile Responsive & Sidebar Collapsing (Screens <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Responsive Table converted to Cards on Mobile Viewports */
    .custom-table, 
    .custom-table thead, 
    .custom-table tbody, 
    .custom-table tr, 
    .custom-table td {
        display: block !important;
        width: 100% !important;
    }
    
    .custom-table thead {
        display: none !important; /* Hide standard column headers */
    }
    
    .custom-table tbody tr {
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid var(--border-glass) !important;
        border-radius: 14px !important;
        padding: 16px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
        transition: var(--transition-smooth) !important;
    }

    .custom-table tbody tr:hover {
        background: rgba(255, 255, 255, 0.04) !important;
        border-color: rgba(255, 255, 255, 0.12) !important;
    }
    
    .custom-table td {
        border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
        padding: 10px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 13px !important;
        text-align: right !important;
    }
    
    .custom-table td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    .custom-table td:first-child {
        padding-top: 0 !important;
    }
    
    /* Inject bold labels on the left using data-label attribute */
    .custom-table td:before {
        content: attr(data-label) !important;
        font-weight: 700 !important;
        color: var(--text-secondary) !important;
        text-align: left !important;
        margin-right: 16px !important;
        font-size: 12px !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .table-responsive {
        border: none !important;
        background: none !important;
        margin-bottom: 16px;
    }

    /* Collapsible Sidebar */
    .sidebar {
        transform: translateX(-100%);
        width: 260px !important;
        position: fixed !important;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 200 !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay background when mobile sidebar is active */
    .sidebar-overlay {
        display: none;
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        z-index: 150;
    }
    .sidebar-overlay.active {
        display: block;
    }

    /* Fullscreen Main Wrapper */
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 16px !important;
    }

    /* Top Header hamburger display */
    .sidebar-toggle-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.04);
        border: 1px solid var(--border-glass);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 20px;
        width: 40px;
        height: 40px;
        cursor: pointer;
        margin-right: 12px;
        transition: var(--transition-smooth);
    }
    
    .sidebar-toggle-btn:hover {
        background: rgba(255,255,255,0.08);
    }

    /* POS Layout specific responsive */
    .pos-layout {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        height: auto !important;
    }

    /* Tabs styled navigation on mobile POS */
    .pos-mobile-tabs {
        display: flex !important;
        background: var(--bg-card);
        border: 1px solid var(--border-glass);
        border-radius: 12px;
        padding: 4px;
        margin-bottom: 16px;
        gap: 4px;
    }
    
    .pos-mobile-tab {
        flex: 1;
        text-align: center;
        padding: 12px 8px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 13px;
        color: var(--text-secondary);
        cursor: pointer;
        transition: var(--transition-smooth);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    .pos-mobile-tab.active {
        color: var(--text-primary);
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        box-shadow: 0 4px 10px var(--primary-glow);
    }

    /* Hide catalog or cart depending on active mobile state */
    .pos-catalog, .pos-cart {
        display: none !important;
    }
    .pos-catalog.active, .pos-cart.active {
        display: flex !important;
    }
    
    .pos-search-bar {
        flex-direction: column;
        gap: 8px;
    }
    
    .pos-search-bar select {
        width: 100% !important;
    }

    /* Global Responsive Grid and Element Alignments */
    *[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .top-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }

    .top-header > div {
        width: 100% !important;
    }

    .page-title {
        font-size: 20px !important;
    }

    .network-badge {
        width: 100% !important;
        justify-content: center !important;
        font-size: 11px !important;
        padding: 6px 12px !important;
    }

    .form-group button, .form-group a.btn-secondary {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }

    /* Flex-based head layouts collapse */
    .glass-panel h3[style*="display: flex"], 
    .glass-panel div[style*="display: flex; justify-content: space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .glass-panel h3[style*="display: flex"] span[style*="font-size: 13px"],
    .glass-panel h3[style*="display: flex"] span[style*="color: var(--text-secondary)"] {
        display: block !important;
        margin-top: 4px !important;
        text-align: left !important;
    }
}

/* ==========================================================================
   Dual-Mode Print Stylesheet (v7.0.0)
   Mode 1: Thermal Receipt (triggered via JS class 'printing-receipt')
   Mode 2: Report Page (triggered via JS class 'printing-report')
   ========================================================================== */
@media print {

    /* ---- SHARED: Basics for all print contexts ---- */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ---- MODE 1: Thermal Receipt Printing ---- */
    /* Applied when body has class 'printing-receipt' */
    body.printing-receipt * {
        visibility: hidden !important;
    }
    body.printing-receipt #system-print-invoice,
    body.printing-receipt #system-print-invoice * {
        visibility: visible !important;
    }
    body.printing-receipt #system-print-invoice {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #000000 !important;
        background: #ffffff !important;
    }

    /* ---- MODE 2: Report / Page Printing ---- */
    /* Applied when body has class 'printing-report' — also works without class as default */
    body:not(.printing-receipt) {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: 'Inter', Arial, sans-serif !important;
        font-size: 12px !important;
    }

    /* Hide non-content chrome */
    body:not(.printing-receipt) .sidebar,
    body:not(.printing-receipt) .top-header,
    body:not(.printing-receipt) .mobile-bottom-nav,
    body:not(.printing-receipt) .sidebar-overlay,
    body:not(.printing-receipt) .sub-nav,
    body:not(.printing-receipt) .filter-bar,
    body:not(.printing-receipt) .btn-primary,
    body:not(.printing-receipt) .btn-secondary,
    body:not(.printing-receipt) [onclick*="print"],
    body:not(.printing-receipt) form,
    body:not(.printing-receipt) .no-print,
    body:not(.printing-receipt) #system-print-invoice {
        display: none !important;
    }

    /* Expand main wrapper to full width */
    body:not(.printing-receipt) .app-container {
        display: block !important;
    }
    body:not(.printing-receipt) .main-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Clean up glass panels for paper */
    body:not(.printing-receipt) .glass-panel {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        break-inside: avoid;
        margin-bottom: 16px !important;
        padding: 16px !important;
    }

    /* Clean up tables for paper */
    body:not(.printing-receipt) .custom-table {
        background: #ffffff !important;
        border-collapse: collapse !important;
        width: 100% !important;
    }
    body:not(.printing-receipt) .custom-table th {
        background: #f1f5f9 !important;
        color: #1e293b !important;
        border-bottom: 2px solid #cbd5e1 !important;
        padding: 8px 10px !important;
        font-size: 11px !important;
        text-align: left !important;
    }
    body:not(.printing-receipt) .custom-table td {
        color: #1e293b !important;
        border-bottom: 1px solid #e2e8f0 !important;
        padding: 7px 10px !important;
        font-size: 12px !important;
    }
    body:not(.printing-receipt) .custom-table tr:last-child td {
        border-bottom: none !important;
    }

    /* Fix stat/summary cards */
    body:not(.printing-receipt) .report-stat-card,
    body:not(.printing-receipt) .stat-card,
    body:not(.printing-receipt) .summary-card {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        box-shadow: none !important;
    }
    body:not(.printing-receipt) .stat-label,
    body:not(.printing-receipt) .summary-card .label {
        color: #64748b !important;
    }
    body:not(.printing-receipt) .stat-value,
    body:not(.printing-receipt) .summary-card .val {
        color: #0f172a !important;
    }

    /* Fix text colors */
    body:not(.printing-receipt) h1,
    body:not(.printing-receipt) h2,
    body:not(.printing-receipt) h3,
    body:not(.printing-receipt) h4,
    body:not(.printing-receipt) p,
    body:not(.printing-receipt) span,
    body:not(.printing-receipt) td,
    body:not(.printing-receipt) th,
    body:not(.printing-receipt) div {
        color: #1e293b !important;
    }

    /* Show trend charts canvas during PDF printing with dimensions and page-break optimizations (v7.8.5) */
    body:not(.printing-receipt) .chart-container {
        display: block !important;
        height: 240px !important;
        max-height: 240px !important;
        break-inside: avoid !important;
        margin-bottom: 16px !important;
    }

    /* Page break utilities */
    .page-break { page-break-before: always; }
    .no-break { break-inside: avoid; }

    /* Print header watermark */
    body:not(.printing-receipt) .main-wrapper::before {
        content: 'GoFish MIS — Dicetak: ' attr(data-print-date);
        display: block;
        font-size: 10px;
        color: #94a3b8 !important;
        margin-bottom: 12px;
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 8px;
    }
}

/* ==========================================================================
   Dedicated Fullscreen POS Mode & Floating Mobile Bottom Tab Bar (v5.0.0)
   ========================================================================== */

/* Fullscreen Dedicated POS Mode */
.sidebar.pos-fullscreen-hide {
    display: none !important;
}

.sidebar.pos-fullscreen-hide ~ .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 24px !important;
}

/* Floating Glassmorphic Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
    /* Hide top-header hamburger toggle to rely on the bottom navigation bar */
    .sidebar-toggle-btn {
        display: none !important;
    }

    /* Add padding to the body so content is not obscured by the floating bar */
    body {
        padding-bottom: 100px !important;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-glass);
        border-radius: 16px 16px 0 0;
        padding: 8px 16px 16px 16px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        z-index: 9999; /* Higher than sidebar overlay drawer */
        justify-content: space-between;
        align-items: center;
        transition: var(--transition-smooth);
    }

    /* Slide down and fade out bottom navigation bar when sidebar is open */
    body.sidebar-active .mobile-bottom-nav {
        opacity: 0;
        pointer-events: none;
        transform: translateY(100px);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        text-decoration: none;
        font-family: inherit;
        cursor: pointer;
        padding: 8px;
        border-radius: 12px;
        flex: 1;
        gap: 4px;
        transition: var(--transition-smooth);
    }

    .bottom-nav-item:hover {
        color: var(--text-primary);
    }

    .bottom-nav-item.active {
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.05);
        box-shadow: inset 0 -3px 0 var(--primary);
    }

    .bottom-nav-icon {
        font-size: 18px;
    }

    .bottom-nav-label {
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
}
