:root {
    --primary-color: #D32F2F;
    /* Wedding Red */
    --secondary-color: #FFA000;
    /* Gold */
    --dark-blue: #1A237E;
    /* Deep Indigo */
    --light-bg: #F8F9FA;
    --text-dark: #212529;
    --border-color: #dee2e6;
}

body {
    background-color: var(--light-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Sidebar Styling */
.sidebar {
    height: 100vh;
    background: var(--dark-blue);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    padding-top: 20px;
    z-index: 1000;
    transition: all 0.3s;
}

.sidebar-header {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--secondary-color);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 15px 20px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left: 4px solid var(--secondary-color);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 20px;
    transition: all 0.3s;
}

/* Cards */
.card-dashboard {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.card-dashboard:hover {
    transform: translateY(-5px);
}

.icon-box {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.bg-orange {
    background: #FF9800;
}

.bg-green {
    background: #4CAF50;
}

.bg-blue {
    background: #2196F3;
}

.bg-red {
    background: #F44336;
}

/* Tables */
.table-custom thead th {
    background-color: var(--dark-blue);
    color: white;
    border: none;
}

.table-custom tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* POS Specific */
.product-search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    width: 100%;
    /* Ensure full width */
}

.search-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.search-item:hover {
    background-color: #f8f9fa;
}

.search-item .stock-badge {
    float: right;
    font-size: 0.8rem;
}

.bill-table-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flex scrolling */
}

/* Login Page */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark-blue) 0%, #0d47a1 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Mobile Responsive */
.mobile-header {
    display: none;
    background: var(--dark-blue);
    color: white;
    padding: 10px 15px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.menu-toggle {
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
}

@media (max-width: 768px) {

    /* Layout Fixes */
    body {
        overflow-x: hidden;
        /* Prevent global horizontal scroll */
    }

    .main-content {
        margin: 0 !important;
        padding: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
    }

    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        width: 80%;
        /* Wider sidebar on mobile for better touch */
        max-width: 300px;
        z-index: 2000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .overlay.active {
        display: block;
    }

    /* POS Sticky Header Fix */
    .sticky-top {
        z-index: 100 !important;
    }

    /* Table Optimization */
    .table-responsive {
        overflow-x: auto;
    }

    .table {
        font-size: 11px;
        /* Smaller text for mobile */
    }

    .table th,
    .table td {
        padding: 8px 5px !important;
        /* Increased padding for better spacing */
        vertical-align: middle;
        text-align: center;
        /* Center align all content */
        /* white-space: normal !important; */
        /* Force text to wrap */
        word-break: break-word;
        /* Break long words if needed */
    }

    /* Left align first column for better readability if needed, or keep center as requested */
    .table td:first-child,
    .table th:first-child {
        text-align: left;
        padding-left: 10px !important;
    }

    .mobile-hidden {
        display: none !important;
    }

    /* Dashboard Cards */
    .card-dashboard {
        margin-bottom: 0.5rem;
    }

    .icon-box {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    /* POS Mobile Adjustments */
    .bill-table-container {
        height: auto;
        min-height: 200px;
        max-height: 50vh;
        /* Use vh for dynamic height */
        overflow-y: auto;
    }

    /* POS Layout on Mobile: Allow full page scroll, disable fixed height containers */
    .row.m-0 {
        height: auto !important;
        overflow: visible !important;
        flex-direction: column;
        /* Normal order, tabs handle visibility */
    }

    .col-md-8.h-100,
    .col-md-4.h-100 {
        height: auto !important;
        overflow: visible !important;
    }

    /* Fix Table Width Issues */
    .bill-table-container .table th:nth-child(1),
    .bill-table-container .table td:nth-child(1) {
        display: none;
        /* Hide SL # */
    }

    .bill-table-container .table th:nth-child(3),
    .bill-table-container .table td:nth-child(3) {
        display: none;
        /* Hide Unit Price */
    }

    .bill-table-container .input-group {
        width: 80px !important;
        /* Reduce Qty width */
    }

    .bill-table-container .btn-sm {
        padding: 0.2rem 0.4rem;
    }

    /* Input groups */
    .input-group-text {
        font-size: 0.8rem;
        padding: 5px;
    }

    .form-control {
        font-size: 0.9rem;
    }

    /* Fix Dropdown Overflow */
    .form-select,
    .form-control {
        max-width: 100%;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    /* Buttons */
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .navbar,
    .no-print,
    .btn,
    .card-header,
    form,
    .mobile-header,
    .overlay {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
        width: 100%;
        margin-left: 0 !important;
    }

    .card {
        border: none;
        box-shadow: none;
    }

    .card-body {
        padding: 0;
    }

    body {
        background: white;
        font-size: 12pt;
    }

    .invoice-container {
        width: 100%;
        max-width: 100%;
    }

    /* Ensure table borders show in print */
    .table td,
    .table th {
        border: 1px solid #ddd !important;
    }
}