/* 🚀 UPDATED COLOR PALETTE (Kept your original values) */
:root {
    --primary-color: #4361ee;
    --secondary-color: #FFFFFF;
    --accent-color: #4cc9f0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #4cc9f0;
    --warning-color: #f8961e;
    --danger-color: #f72585;
    --gray: #6c757d;
    --light-gray: #e9ecef;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    margin: 0;
    padding: 0;
}

/* 🚀 NEW: Initial Full-Screen Loader Styles */
#initial-loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #FFFFFF;
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#initial-loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color) !important;
}

/* END Initial Loader Styles */


.sidebar {
    background-color: var(--secondary-color);
    color: var(--dark-color);
    height: 100vh;
    position: fixed;
    transition: all 0.3s;
    z-index: 1000;
    overflow-y: auto;
    width: 250px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.sidebar .nav-link {
    color: var(--dark-color);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

.main-content {
    margin-left: 250px;
    transition: all 0.3s;
    padding: 0;
    /* Remove top padding on desktop/main content wrapper */
}

.navbar {
    background-color: var(--secondary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card {
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
}

/* Improved Stats Card Look */
.stats-card {
    text-align: center;
    padding: 1rem;
}

.stats-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stats-card .label {
    font-size: 0.875rem;
    color: var(--gray);
}


.card-header {
    background-color: var(--secondary-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--dark-color);
    border-color: var(--dark-color);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
}

/* Status Colors */
.status-reserved {
    background-color: var(--warning-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    text-transform: capitalize;
}

.status-rented {
    background-color: var(--danger-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    text-transform: capitalize;
}

.status-available,
.status-completed {
    background-color: var(--success-color);
    color: var(--dark-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    text-transform: capitalize;
}

.status-pending {
    background-color: var(--warning-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    text-transform: capitalize;
}

.status-paid {
    background-color: var(--success-color);
    color: var(--dark-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    text-transform: capitalize;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
}

.auth-card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.company-logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

/* NEW: Rule to make sidebar logo dark */
.sidebar .company-logo {
    color: var(--dark-color);
    text-shadow: none;
}

/* 🚀 NEW: Password Toggle Container Styles */
.password-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--gray);
    z-index: 100;
}

/* END Password Toggle Styles */

/* 🚀 NEW: Password Requirement Styles (The requested addition) */
.password-requirements {
    font-size: 0.85rem;
    padding: 0.5rem 0;
    color: var(--dark-color);
}

.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: 10px;
}

.password-requirements li {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.password-requirements i {
    margin-right: 5px;
    width: 15px;
    text-align: center;
}

.pass-check {
    color: #ccc;
}

.pass-valid {
    color: green;
}

/* END Password Requirement Styles */


/* Responsive adjustments */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
}

/* 🚀 NEW: Floating Add Button for Mobile */
.floating-add-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    display: none;
    /* Hidden by default, shown in mobile media query */
}

/* 🚀 NEW: Mobile Header Bar (Always visible on mobile, used as the main app header) */
.mobile-header-bar {
    position: sticky;
    top: 0;
    z-index: 999;
    background-color: var(--secondary-color) !important;
    /* Force white background */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ensure actions are tight but don't wrap too quickly */
.action-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
    min-width: 100px;
}

.action-buttons .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* HORIZONTAL SCROLL FIX: Remove min-width on table and ensure table-layout is auto */
.table-responsive table {
    table-layout: auto;
}

.table-responsive table td {
    white-space: normal;
}

/* Set specific widths for dashboard table cells, allowing the 'Product & Code' column to flex/wrap */
.dashboard-table-fixed {
    table-layout: fixed;
    width: 100%;
}

.dashboard-table-fixed th,
.dashboard-table-fixed td {
    padding: 0.5rem;
    vertical-align: top;
    white-space: normal;
}

/* 🐛 FIX: Adjusted column widths based on the new 10-column structure */
.dashboard-table-fixed th:nth-child(1),
.dashboard-table-fixed td:nth-child(1) {
    width: 7%;
}

/* Bill No */
.dashboard-table-fixed th:nth-child(2),
.dashboard-table-fixed td:nth-child(2) {
    width: 10%;
}

/* Order Date */
.dashboard-table-fixed th:nth-child(3),
.dashboard-table-fixed td:nth-child(3) {
    width: 15%;
}

/* Name */
.dashboard-table-fixed th:nth-child(4),
.dashboard-table-fixed td:nth-child(4) {
    width: 10%;
}

/* Village */
.dashboard-table-fixed th:nth-child(5),
.dashboard-table-fixed td:nth-child(5) {
    width: 10%;
}

/* Use Date */
.dashboard-table-fixed th:nth-child(6),
.dashboard-table-fixed td:nth-child(6) {
    width: 10%;
}

/* Return Date */
.dashboard-table-fixed th:nth-child(7),
.dashboard-table-fixed td:nth-child(7) {
    width: 20%;
    word-break: break-word;
}

/* Product & Code */
.dashboard-table-fixed th:nth-child(8),
.dashboard-table-fixed td:nth-child(8) {
    width: 10%;
}

/* Notes */
.dashboard-table-fixed th:nth-child(9),
.dashboard-table-fixed td:nth-child(9) {
    width: 8%;
}

/* Status */
.dashboard-table-fixed th:nth-child(10),
.dashboard-table-fixed td:nth-child(10) {
    width: 10%;
}

/* Actions */


/* --- DESKTOP/TABLET VIEW (>= 769px) --- */
@media (min-width: 769px) {

    /* Hide the mobile header bar on desktop */
    .mobile-header-bar {
        display: none !important;
    }

    /* Restore full padding on main content area for desktop */
    .main-content .container-fluid {
        padding-top: 1.5rem !important;
    }
}


/* --- MOBILE VIEW (<= 768px) - CRITICAL STYLES FOR SCREENSHOT MATCH AND OVERLAP FIX --- */
@media (max-width: 768px) {

    /* Hide mobile menu button outside the header */
    .mobile-menu-btn {
        display: none;
    }

    /* Ensure the mobile header menu toggle is displayed */
    #mobile-menu-toggle-in-header {
        display: block !important;
    }

    .sidebar {
        width: 280px;
        /* Slightly wider sidebar for menu content */
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: 0;
    }

    /* Show floating add button on mobile */
    .floating-add-btn {
        display: block;
    }

    /* Dashboard Search/Filter Card Adjustments (Match Screenshot Header) */
    #dashboard-view .card-body {
        padding: 0.5rem !important;
    }

    #dashboard-view .search-input-group {
        order: 1;
        margin-bottom: 0.5rem !important;
    }

    #dashboard-view .button-group-sm {
        order: 2;
        justify-content: space-between !important;
    }

    #dashboard-view .button-group-sm .d-lg-block {
        display: none !important;
    }

    #dashboard-view .button-group-sm .btn {
        flex-grow: 1;
    }

    /* Filter Area Stacking */
    #dashboard-view .row.mb-4>div {
        margin-bottom: 0.5rem;
    }

    #dashboard-view .row.mb-4 {
        margin-left: 0;
        margin-right: 0;
    }

    /* 🚀 CRITICAL FIX: MOBILE DASHBOARD CARD VIEW IMPLEMENTATION */

    .table-responsive {
        border: none;
        overflow-x: hidden;
        width: 100%;
    }

    .dashboard-table-fixed {
        border-collapse: separate;
        border-spacing: 0 10px;
        table-layout: auto;
        width: 100%;
    }

    /* Hide the entire table head */
    .dashboard-table-fixed thead {
        display: none;
    }

    /* Make each row act as a card/block, forcing vertical flow */
    .dashboard-table-fixed tbody tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        background-color: var(--secondary-color);
        padding: 10px;
        position: relative;
        /* Essential for positioning the absolute badge */
    }

    /* Make each cell (td) a flex container for label/value alignment */
    .dashboard-table-fixed td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100% !important;
        text-align: right;
        padding: 0.25rem 0.5rem !important;
        border: none !important;
        white-space: normal;
        overflow: visible;
        font-size: 0.9rem;
        word-break: break-word;
    }

    /* Add the label using pseudo-elements */
    .dashboard-table-fixed td:before {
        content: attr(data-label) ":";
        flex-basis: 40%;
        text-align: left;
        font-weight: 500;
        color: var(--gray);
        font-size: 0.85rem;
        text-transform: capitalize;
    }

    /* ==================================================================== */
    /* 🚀 OVERLAP FIX: Explicitly order and style the conflicting elements */
    /* ==================================================================== */

    /* Bill No (Top Left, Prominent, Below the "Upcoming Reserved Orders" header) */
    .dashboard-table-fixed td:nth-child(1) {
        order: 1;
        /* First element in the flow */
        font-size: 1rem;
        font-weight: 700;
        color: var(--dark-color);
        text-align: left;
        /* Keep left alignment */
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        border-bottom: 1px solid var(--light-gray) !important;
        justify-content: flex-start;
        /* Ensure number stays left */
    }

    .dashboard-table-fixed td:nth-child(1):before {
        content: '';
        /* Remove the data-label here to display just the number/data */
    }

    /* Name (Second Prominent Row) */
    .dashboard-table-fixed td:nth-child(3) {
        order: 2;
        /* Second element in the flow, below Bill No */
        font-size: 1rem;
        font-weight: 600;
        color: var(--primary-color);
        text-align: left;
        padding-bottom: 0.5rem !important;
        border-bottom: 1px solid var(--light-gray) !important;
    }

    .dashboard-table-fixed td:nth-child(3):before {
        content: attr(data-label) ":";
        font-weight: 500;
        color: var(--gray);
        font-size: 0.85rem;
        flex-basis: 40%;
    }

    /* Status Badge (Top Right, Absolute Position) */
    .dashboard-table-fixed td:nth-child(9) {
        /* Status */
        order: -1;
        /* Place it outside the main vertical flow */
        position: absolute;
        /* Take it out of flow */
        top: 10px;
        right: 10px;
        display: inline-block;
        width: auto !important;
        text-align: right;
        padding: 0 !important;
        /* Remove inherited flex properties for absolute positioning */
        display: block !important;
    }

    .dashboard-table-fixed td:nth-child(9) span {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
        /* Make status display within the element's block */
        display: block;
    }

    .dashboard-table-fixed td:nth-child(9):before {
        content: '';
        /* Remove the default label for the status badge */
        display: none;
    }

    /* Order the remaining detail fields (Date, Village, Use, Return, Products, Notes) */
    .dashboard-table-fixed td:nth-child(2) {
        order: 3;
    }

    /* Date */
    .dashboard-table-fixed td:nth-child(4) {
        order: 4;
    }

    /* Village */
    .dashboard-table-fixed td:nth-child(5) {
        order: 5;
    }

    /* Use Date */
    .dashboard-table-fixed td:nth-child(6) {
        order: 6;
    }

    /* Return Date */
    .dashboard-table-fixed td:nth-child(7) {
        order: 7;
    }

    /* Products */
    .dashboard-table-fixed td:nth-child(8) {
        order: 8;
    }

    /* Notes */


    /* Actions (Bottom) */
    .dashboard-table-fixed td:nth-child(10) {
        /* Actions - Bottom */
        order: 10;
        border-top: 1px dashed var(--light-gray) !important;
        padding-top: 0.5rem !important;
        justify-content: flex-start;
    }

    .dashboard-table-fixed td:nth-child(10):before {
        content: 'Actions:';
        font-weight: 600;
        color: var(--gray);
        font-size: 0.85rem;
        flex-basis: auto;
    }

    .dashboard-table-fixed td:nth-child(10) .action-buttons {
        margin-left: 10px;
        display: flex;
        justify-content: flex-start;
        gap: 0.5rem;
        flex-grow: 1;
    }

    /* General Fixes */
    .dashboard-table-fixed td:nth-child(2),
    .dashboard-table-fixed td:nth-child(4),
    .dashboard-table-fixed td:nth-child(5),
    .dashboard-table-fixed td:nth-child(6),
    .dashboard-table-fixed td:nth-child(7),
    .dashboard-table-fixed td:nth-child(8) {
        width: 100%;
        text-align: right;
    }

    /* Override Bootstrap display utilities in the media query */
    .d-none.d-sm-table-row {
        display: none !important;
    }


    /* ---------------------------------------------------- */
    /* 🚀 REPORTS VIEW MOBILE SPECIFIC STYLES (ScreenShot Match) */
    /* ---------------------------------------------------- */

    /* Reverse the order of the chart/stats cards for mobile */
    .reports-mobile-order {
        flex-direction: column-reverse;
    }

    /* Ensure Quick Stats takes full width */
    .reports-mobile-order .col-md-4,
    .reports-mobile-order .col-md-8 {
        width: 100%;
        margin-bottom: 1.5rem;
        /* Overriding bootstrap's order-* classes with our direct flex reverse */
        order: unset !important;
    }

    /* Style the main report card header for the search/refresh controls */
    .report-table-header {
        flex-direction: column;
        align-items: flex-start !important;
        padding: 0.75rem 1rem;
    }

    .report-table-header h5 {
        margin-bottom: 0.5rem !important;
    }

    .report-controls {
        width: 100%;
        justify-content: space-between;
    }

    .report-controls .form-control {
        margin-right: 0.5rem !important;
    }

    .report-controls button {
        margin-top: 0 !important;
    }

    /* Implement Mobile Card View for All Bookings History Table */
    .reports-table-mobile-card {
        border-collapse: separate;
        border-spacing: 0 10px;
        table-layout: auto;
        width: 100%;
    }

    /* Hide Table Head */
    .reports-table-mobile-card thead {
        display: none;
    }

    /* Row as Card */
    .reports-table-mobile-card tbody tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        background-color: var(--secondary-color);
        padding: 10px;
        position: relative;
    }

    /* Cell Styles */
    .reports-table-mobile-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100% !important;
        text-align: right;
        padding: 0.25rem 0.5rem !important;
        border: none !important;
        white-space: normal;
        overflow: visible;
        font-size: 0.9rem;
        word-break: break-word;
    }

    /* Add Label */
    .reports-table-mobile-card td:before {
        content: attr(data-label) ":";
        flex-basis: 40%;
        text-align: left;
        font-weight: 500;
        color: var(--gray);
        font-size: 0.85rem;
        text-transform: capitalize;
    }

    /* Status Badge (Top Right, Absolute Position) */
    .reports-table-mobile-card td:nth-child(11) {
        /* Status */
        order: -1;
        position: absolute;
        top: 10px;
        right: 10px;
        display: inline-block;
        width: auto !important;
        text-align: right;
        padding: 0 !important;
        display: block !important;
    }

    .reports-table-mobile-card td:nth-child(11) span {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
        display: block;
    }

    .reports-table-mobile-card td:nth-child(11):before {
        content: '';
        display: none;
    }

    /* Bill No (Top Left, Prominent) */
    .reports-table-mobile-card td:nth-child(1) {
        /* Bill No */
        order: 1;
        font-size: 1rem;
        font-weight: 700;
        color: var(--dark-color);
        text-align: left;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        border-bottom: 1px solid var(--light-gray) !important;
        justify-content: flex-start;
    }

    .reports-table-mobile-card td:nth-child(1):before {
        content: '';
    }

    /* Name (Second Prominent Row) */
    .reports-table-mobile-card td:nth-child(3) {
        /* Name */
        order: 2;
        font-size: 1rem;
        font-weight: 600;
        color: var(--primary-color);
        text-align: left;
        padding-bottom: 0.5rem !important;
        border-bottom: 1px solid var(--light-gray) !important;
    }

    /* Actions (Bottom) */
    .reports-table-mobile-card td:nth-child(12) {
        /* Actions - Bottom */
        order: 12;
        border-top: 1px dashed var(--light-gray) !important;
        padding-top: 0.5rem !important;
        justify-content: flex-start;
    }

    .reports-table-mobile-card td:nth-child(12):before {
        content: 'Actions:';
        font-weight: 600;
        color: var(--gray);
        font-size: 0.85rem;
        flex-basis: auto;
    }

    .reports-table-mobile-card td:nth-child(12) .action-buttons {
        margin-left: 10px;
        display: flex;
        justify-content: flex-start;
        gap: 0.5rem;
        flex-grow: 1;
    }

    /* Order the remaining detail fields for good flow */
    .reports-table-mobile-card td:nth-child(2) {
        order: 3;
    }

    /* Order Date */
    .reports-table-mobile-card td:nth-child(4) {
        order: 4;
    }

    /* Village */
    .reports-table-mobile-card td:nth-child(5) {
        order: 5;
    }

    /* Use Date */
    .reports-table-mobile-card td:nth-child(6) {
        order: 6;
    }

    /* Return Date */
    .reports-table-mobile-card td:nth-child(7) {
        order: 7;
    }

    /* Product & Code */
    .reports-table-mobile-card td:nth-child(8) {
        order: 8;
    }

    /* Paid Amount */
    .reports-table-mobile-card td:nth-child(9) {
        order: 9;
    }

    /* Due Amount */
    .reports-table-mobile-card td:nth-child(10) {
        order: 10;
    }

    /* Grand Total */
    /* Note: Status is -1, Actions is 12 */

    /* ---------------------------------------------------- */
    /* 🚀 PRODUCT VIEW MOBILE SPECIFIC STYLES (ScreenShot Match) */
    /* ---------------------------------------------------- */

    /* Hide the desktop header controls */
    #products-view .d-lg-block {
        display: none !important;
    }

    #products-view .card-header.d-none.d-lg-flex {
        display: none !important;
    }

    /* Style the search card to match the screenshot look */
    .product-search-card {
        margin-top: 0;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .product-search-card .search-input-group {
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        overflow: hidden;
    }

    .product-search-card .input-group-text {
        padding-right: 0;
        border: none !important;
    }

    .product-search-card .form-control-lg {
        height: 50px;
        border: none !important;
        box-shadow: none !important;
        padding-left: 1rem;
        padding-right: 0.5rem;
    }

    /* Style the list to look like product cards */
    .product-table-mobile-card {
        border-collapse: separate;
        border-spacing: 0;
        table-layout: auto;
        width: 100%;
        margin-top: 0;
    }

    .product-table-mobile-card thead {
        display: none;
    }

    .product-table-mobile-card tbody tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
        border-bottom: 1px solid #dee2e6;
        padding: 8px 10px;
        background-color: var(--secondary-color);
        position: relative;
    }

    /* Product Name/Main Info Row (First row, bold, large font) */
    .product-table-mobile-card td:nth-child(1) {
        /* Product Name */
        order: 1;
        font-size: 1rem;
        font-weight: 600;
        color: var(--dark-color);
        text-align: left;
        padding: 0 0.5rem 0.25rem 0.5rem !important;
        border: none !important;
        justify-content: flex-start;
    }

    .product-table-mobile-card td:nth-child(1):before {
        content: '';
        /* Remove the default label */
        display: none;
    }

    /* Code + Size Row (Second Row, subtext style) */
    .product-table-mobile-card td:nth-child(2),
    .product-table-mobile-card td:nth-child(3) {
        order: 2;
        font-size: 0.85rem;
        font-weight: 400;
        color: var(--gray);
        text-align: left;
        padding: 0 0.5rem 0.25rem 0.5rem !important;
        border: none !important;
        width: 50% !important;
    }

    /* Combine Code and Size visually into a single line */
    .product-table-mobile-card td:nth-child(2):before {
        content: 'Code:';
        flex-basis: auto;
        font-weight: 500;
        color: var(--gray);
    }

    .product-table-mobile-card td:nth-child(3):before {
        content: 'Size:';
        flex-basis: auto;
        font-weight: 500;
        color: var(--gray);
        margin-left: 10px;
    }

    /* Status Badge (Top Right, Absolute Position) */
    .product-table-mobile-card td:nth-child(4) {
        /* Status */
        order: -1;
        position: absolute;
        top: 10px;
        right: 10px;
        width: auto !important;
        padding: 0 !important;
        display: block !important;
    }

    .product-table-mobile-card td:nth-child(4) span {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
        display: block;
    }

    .product-table-mobile-card td:nth-child(4):before {
        content: '';
        display: none;
    }

    /* Actions (Bottom Row, Separated) */
    .product-table-mobile-card td:nth-child(5) {
        /* Actions */
        order: 3;
        border-top: 1px dashed var(--light-gray) !important;
        padding-top: 0.5rem !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        justify-content: flex-start;
        width: 100% !important;
    }

    .product-table-mobile-card td:nth-child(5):before {
        content: 'Actions:';
        flex-basis: auto;
        font-weight: 500;
        color: var(--gray);
    }

    .product-table-mobile-card td:nth-child(5) .action-buttons {
        margin-left: 10px;
    }

    /* Fix row stacking (Code and Size need to be horizontal in a wrapper) */
    .product-table-mobile-card tbody tr {
        flex-wrap: wrap;
        /* Allow the contents to wrap */
    }

    .product-table-mobile-card tbody tr>td:nth-child(2) {
        /* Merge Code and Size on one line, side-by-side */
        display: flex;
        align-items: center;
        flex-basis: 50%;
        width: 50% !important;
        order: 2;
        padding-right: 0.1rem !important;
    }

    .product-table-mobile-card tbody tr>td:nth-child(3) {
        display: flex;
        align-items: center;
        flex-basis: 50%;
        width: 50% !important;
        order: 2;
        padding-left: 0.1rem !important;
    }
}

/* --- END MOBILE VIEW STYLES --- */

/* STYLES FOR UPDATE BOOKING MODAL (Product/Size Section) */
.product-edit-row {
    display: flex;
    align-items: flex-end;
    /* Align inputs and button at the bottom */
    gap: 10px;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--light-gray);
    border-radius: 0.25rem;
}

.product-edit-row .form-group {
    flex-grow: 1;
}

.product-edit-row .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.product-edit-row .form-control {
    background-color: white;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
}

/* Ensure the Product Name display is clearly visible/readable */
.product-edit-row .product-name-display {
    font-weight: 500;
    color: var(--dark-color);
}

.product-edit-row .btn-danger {
    height: calc(1.5em + 0.75rem + 2px);
    /* Match the height of the input fields */
}


/* Custom Notification Styles */
.custom-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    min-width: 250px;
    border-radius: 0.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    transform: translateY(-20px);
}

.custom-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-notification.success {
    background-color: var(--primary-color);
}

.custom-notification.error {
    background-color: var(--danger-color);
}

.custom-notification.warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
}


/* Bill Print Styles - Adjusted for the requested professional look */
.bill-preview {
    /* Kept tight padding */
    padding: 10px 20px;
    max-width: 800px;
    margin: 0 auto;
}

.print-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--dark-color);
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* FIX: Reduce font size for main header */
.company-info h2 {
    font-size: 1.1rem !important;
    margin-bottom: 3px !important;
}

/* FIX: Reduce font size and tighten line height for all header details */
.company-info p,
.invoice-info p {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.1;
}

.bill-invoice-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark-color);
}

/* FIX: Alignment and smaller text for detail section */
.bill-info-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

.bill-info-section>div {
    width: 48%;
}

.bill-info-section h5 {
    color: var(--dark-color);
    font-size: 0.9rem;
    margin-bottom: 3px;
    border-bottom: 1px solid var(--dark-color);
}

.bill-info-section p {
    font-size: 0.75rem;
    line-height: 1.1;
}


/* UPDATED BILL TABLE STYLES FOR PROFESSIONAL LOOK/SPACE */
.bill-item-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 5px;
    table-layout: fixed;
}

.bill-item-table th,
.bill-item-table td {
    padding: 3px 6px;
    font-size: 0.75rem;
    border: 1px solid #ddd;
}

.bill-item-table th {
    background-color: #f8f9fa;
}

/* UPDATE: Bill Calculations Container to hold Measurements + Summary */
/* UPDATE: Bill Calculations Container to hold Measurements + Summary */
.bill-calculations {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 5px;
    width: 100%;
    /* Ensure full width */
}

/* NEW: Measurements Box Styles */
.measurements-box {
    width: 35%;
    /* Compact width to stay on left */
    border: 2px solid var(--dark-color);
    /* Stronger border for box look */
    border-radius: 0;
    padding: 0;
    margin-top: 10px;
    background-color: #fff;
    align-self: flex-start;
    /* Ensure it stays top-aligned */
    margin-right: auto;
    /* FORCE LEFT ALIGNMENT */
}

.measurements-header {
    background-color: #f0f0f0;
    font-weight: 700;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--dark-color);
    padding: 4px 8px;
    color: var(--dark-color);
    text-transform: uppercase;
    text-align: center;
}

.measurements-table {
    width: 100%;
    border-collapse: collapse;
}

.measurements-table td {
    padding: 3px 8px;
    font-size: 0.8rem;
    border-bottom: 1px solid #eee;
    color: var(--dark-color);
}

.measurements-table tr:last-child td {
    border-bottom: none;
}

.measurements-table td:first-child {
    font-weight: 500;
    color: var(--gray);
    width: 40%;
}

.measurements-table td:last-child {
    font-weight: 600;
    text-align: left;
}

.bill-summary-table {
    width: 250px;
    /* Removed float: right; as we are now using flexbox parent */
    margin-top: 10px;
    border-collapse: separate;
    border-spacing: 0;
    text-align: right;
}

.bill-summary-table tr td:first-child {
    text-align: left;
}

.bill-summary-table td {
    padding: 3px 8px;
    border: none;
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* PROFESSIONAL LOOK FIX: Styling summary values (Grand Total/Paid/Due) */
.bill-summary-table tr:nth-last-child(3) td {
    font-size: 1rem !important;
    font-weight: bold;
    border-top: 1px solid #ddd !important;
    border-bottom: 2px solid var(--dark-color) !important;
}

.bill-summary-table tr:nth-last-child(2) td {
    font-size: 0.9rem !important;
    font-weight: bold;
    border-top: none !important;
    border-bottom: none !important;
}

.bill-summary-table tr:nth-last-child(1) td {
    font-size: 1rem !important;
    font-weight: bold;
    border-top: 1px solid #ddd !important;
    border-bottom: none !important;
}

/* END PROFESSIONAL LOOK FIX */

/* --- REFINED PRINT LAYOUT STYLES (Compact to fit A4) --- */
.terms-qr-section {
    clear: both;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    height: 85px;
}

.terms-qr-section h5 {
    color: var(--dark-color);
    margin-bottom: 2px;
    font-size: 0.85rem;
}

.terms-block {
    width: 65%;
    font-size: 0.7rem;
    /* Smaller text for terms */
    line-height: 1.1;
}

.qr-block {
    width: 30%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.qr-codes {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 5px;
    margin-bottom: 2px;
}

.qr-container {
    width: 55px;
    height: 65px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1px;
}

.qr-container>div {
    width: 50px;
    height: 50px;
    margin-bottom: 2px;
    overflow: hidden;
}

.qr-label {
    font-size: 0.4rem;
    color: #555;
    font-weight: 600;
    line-height: 1;
}

/* --- END REFINED PRINT LAYOUT STYLES --- */

/* Print-specific CSS for iframes */
@media print {
    .bill-preview {
        box-shadow: none;
        padding: 0;
        margin: 0;
        max-width: 210mm;
        height: 100%;
        /* Force fit */
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        /* Distribute vertical space */
    }

    @page {
        size: A4;
        margin: 5mm;
        /* Tight margins */
    }

    /* Compact Headings/Sections for Print - UPDATED FOR REFERENCE IMAGE LOOK */
    .print-header-top {
        margin-bottom: 10px !important;
        padding-bottom: 5px !important;
        border-bottom: 2px solid #000 !important;
    }

    .company-info h2 {
        font-size: 1.8rem !important;
        margin-bottom: 5px !important;
        color: #2c3e50 !important;
        /* Dark Blue-ish */
        text-transform: uppercase;
    }

    .bill-invoice-title {
        font-size: 2rem !important;
        letter-spacing: 1px;
    }

    .bill-info-section {
        margin-bottom: 15px !important;
        padding-bottom: 0 !important;
    }

    .bill-info-section h5 {
        font-size: 0.8rem !important;
        margin-bottom: 2px !important;
        background-color: #e9ecef !important;
        /* Gray Header Background */
        padding: 4px !important;
        border: 1px solid #000 !important;
        border-bottom: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .bill-info-section .info-box-content {
        border: 1px solid #000 !important;
        padding: 5px !important;
    }

    .bill-info-section p {
        font-size: 0.75rem !important;
        margin-bottom: 2px !important;
    }

    /* Compact Table for Print */
    .bill-item-table th,
    .bill-item-table td {
        padding: 5px 8px !important;
        font-size: 0.8rem !important;
        border-color: #000 !important;
    }

    .bill-item-table th {
        background-color: #e9ecef !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .bill-summary-table {
        margin-top: 10px !important;
    }

    /* Measurements Section - BOXED LOOK */
    .measurements-box {
        border: 2px solid #000 !important;
        /* Visible border */
        width: 35% !important;
        padding: 0 !important;
        margin-right: auto !important;
        background-color: #fff !important;
    }

    .measurements-header {
        border-bottom: 1px solid #000 !important;
        background-color: #f0f0f0 !important;
        text-align: left !important;
        /* Left Align Header */
        padding: 4px 8px !important;
        /* Add padding for left alignment */
        margin-bottom: 0 !important;
        font-size: 0.8rem !important;
        text-transform: uppercase !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .measurements-table td {
        border-bottom: 1px solid #ccc !important;
        /* Visible separators */
        padding: 3px 5px !important;
    }

    /* CUSTOM STYLES FOR THE PRINTED LIST TABLE */
    .list-print-table {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
    }

    .list-print-table th,
    .list-print-table td {
        border: 1px solid #ddd;
        padding: 4px 6px;
        font-size: 9px;
        line-height: 1.1;
        white-space: normal;
    }

    .list-print-table th {
        background-color: #f0f0f0;
        font-weight: bold;
        color: #333;
    }

    /* Column widths for the printed list table (9 columns) */
    .list-print-table th:nth-child(1),
    .list-print-table td:nth-child(1) {
        width: 7%;
    }

    .list-print-table th:nth-child(2),
    .list-print-table td:nth-child(2) {
        width: 9%;
    }

    .list-print-table th:nth-child(3),
    .list-print-table td:nth-child(3) {
        width: 12%;
    }

    .list-print-table th:nth-child(4),
    .list-print-table td:nth-child(4) {
        width: 10%;
    }

    .list-print-table th:nth-child(5),
    .list-print-table td:nth-child(5) {
        width: 9%;
    }

    .list-print-table th:nth-child(6),
    .list-print-table td:nth-child(6) {
        width: 9%;
    }

    .list-print-table th:nth-child(7),
    .list-print-table td:nth-child(7) {
        width: 25%;
    }

    .list-print-table th:nth-child(8),
    .list-print-table td:nth-child(8) {
        width: 17%;
    }

    .list-print-table th:nth-child(9),
    .list-print-table td:nth-child(9) {
        width: 6%;
    }
}

/* ========================================
   📱 MOBILE BOTTOM NAVIGATION BAR
   (Only visible on mobile devices ≤768px)
   ======================================== */

/* Hide by default on desktop */
.mobile-bottom-nav {
    display: none;
}

/* ===== MOBILE DEVICES (≤768px) ===== */
@media (max-width: 768px) {

    /* Bottom Navigation Bar */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background: #ffffff;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        justify-content: space-around;
        align-items: center;
        z-index: 1050;
        /* Above content, below modals */
        border-top: 1px solid #e9ecef;
    }

    /* Navigation Links */
    .mobile-bottom-nav .nav-link-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #6c757d;
        font-size: 11px;
        font-weight: 500;
        padding: 8px 12px;
        transition: all 0.3s ease;
        flex: 1;
        text-align: center;
        position: relative;
        -webkit-tap-highlight-color: rgba(67, 97, 238, 0.1);
    }

    /* Icon Styling */
    .mobile-bottom-nav .nav-link-bottom i {
        font-size: 22px;
        margin-bottom: 4px;
        transition: all 0.3s ease;
    }

    /* Label Styling */
    .mobile-bottom-nav .nav-link-bottom span {
        display: block;
        font-size: 10px;
        line-height: 1.2;
    }

    /* Hover Effect */
    .mobile-bottom-nav .nav-link-bottom:hover {
        color: var(--primary-color);
        background-color: rgba(67, 97, 238, 0.05);
    }

    /* Active State */
    .mobile-bottom-nav .nav-link-bottom.active {
        color: var(--primary-color);
        font-weight: 600;
    }

    .mobile-bottom-nav .nav-link-bottom.active i {
        transform: scale(1.1);
    }

    /* Tap Animation */
    .mobile-bottom-nav .nav-link-bottom:active {
        transform: scale(0.95);
    }

    /* Prevent content overlap */
    body {
        padding-bottom: calc(65px + env(safe-area-inset-bottom));
        overflow-x: hidden;
        max-width: 100vw;
    }

    .main-content {
        padding-bottom: 80px;
        margin-left: 0;
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Hide desktop sidebar on mobile */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Safe area support (iPhone X+, notch) */
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(65px + env(safe-area-inset-bottom));
    }

    /* GPU acceleration for smooth performance */
    .mobile-bottom-nav {
        will-change: transform;
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* ===== SMALL PHONES (≤576px) ===== */
@media (max-width: 576px) {
    .mobile-bottom-nav {
        height: calc(60px + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav .nav-link-bottom {
        padding: 6px 8px;
    }

    .mobile-bottom-nav .nav-link-bottom i {
        font-size: 20px;
    }

    .mobile-bottom-nav .nav-link-bottom span {
        font-size: 9px;
    }

    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
}

/* ===== VERY SMALL SCREENS (≤400px) ===== */
@media (max-width: 400px) {
    .mobile-bottom-nav .nav-link-bottom {
        padding: 6px 6px;
    }

    .mobile-bottom-nav .nav-link-bottom i {
        font-size: 19px;
    }

    .mobile-bottom-nav .nav-link-bottom span {
        font-size: 8.5px;
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-bottom-nav {
        height: calc(55px + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav .nav-link-bottom i {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .mobile-bottom-nav .nav-link-bottom span {
        font-size: 8px;
    }

    body {
        padding-bottom: calc(55px + env(safe-area-inset-bottom));
    }
}

/* ===== TABLET (577px-768px) ===== */
@media (min-width: 577px) and (max-width: 768px) {
    .mobile-bottom-nav .nav-link-bottom span {
        font-size: 11px;
    }
}

/* ===== MODAL Z-INDEX (Above bottom nav) ===== */
.modal {
    z-index: 1060 !important;
}

.modal-backdrop {
    z-index: 1055 !important;
}

/* ===== ACCESSIBILITY ===== */
@media (max-width: 768px) {

    /* Minimum touch targets (44x44px - Apple HIG) */
    .mobile-bottom-nav .nav-link-bottom {
        min-height: 44px;
        min-width: 44px;
    }

    /* Reduced motion support */
    @media (prefers-reduced-motion: reduce) {

        .mobile-bottom-nav .nav-link-bottom,
        .mobile-bottom-nav .nav-link-bottom i {
            transition-duration: 0.01ms !important;
        }
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 768px) {

    /* Smooth scrolling */
    .main-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Prevent horizontal scroll */
    .container-fluid {
        overflow-x: hidden;
        max-width: 100%;
    }
}