﻿@import url('/assets/fonts/fonts.css');

:root {
    --primary-color: #0d6efd;
    --sidebar-bg: #0f172a;
    --sidebar-bg-soft: #111c33;
    --sidebar-link-color: #dbeafe;
    --sidebar-link-hover-bg: rgba(14, 165, 233, 0.16);
    --sidebar-link-active-bg: rgba(14, 165, 233, 0.22);
    --sidebar-accent-color: #06b6d4;
    --main-bg: #f9fafb;
    --sidebar-border-color: rgba(148, 163, 184, 0.18);
    /* Primary admin font (Google Prompt with local face) */
    --font-primary: 'Noto Sans Thai', 'Noto Sans', 'Leelawadee UI', Tahoma, 'Segoe UI', Arial, sans-serif;
}

/* Shared styles for admin pages */
body {
    background-color: var(--main-bg);
    font-family: var(--font-primary) !important;
}

/* Ensure menus and common controls also use Prompt */
.sidebar,
.sidebar *,
.nav-link,
.dropdown-menu,
.dropdown-item,
button,
input,
select,
textarea,
.form-control,
.btn,
.table,
.card,
.modal,
.breadcrumb {
    font-family: var(--font-primary) !important;
}

.sidebar .nav-link i,
.sidebar .nav-section-header i,
.btn i,
.card i,
.modal i,
.navbar i,
.dropdown-item i,
.breadcrumb i {
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900;
}

.page-title {
    font-size: 2rem;
    color: #343a40;
    font-weight: 600;
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.table th {
    font-weight: 600;
}

.btn-primary {
    background-color: #1a237e;
    border-color: #1a237e;
}

.btn-primary:hover {
    background-color: #283593;
    border-color: #283593;
}

.nav-link.active {
    font-weight: bold;
    color: #ffc107 !important;
}

/* Header Settings Page Styles */
.header-settings-card .card-header {
    color: #ffffff; /* White text for headers */
    padding: 0.75rem 1.25rem;
}

.general-settings-header {
    background-color: #0d6efd; /* Bootstrap primary blue */
}

.secondary-nav-header {
    background-color: #198754; /* Bootstrap success green */
}

/* Enhanced Color Picker Styles */
.form-control-color {
    min-width: 80px; /* Ensure a decent width */
    height: calc(1.5em + 0.75rem + 2px); /* Match default Bootstrap input height */
    padding: 0.375rem; /* Minimal padding */
    border-radius: 0.25rem;
    cursor: pointer;
    border: 1px solid #ced4da; /* Standard Bootstrap border */
    -webkit-appearance: none; /* Remove default appearance on WebKit */
    -moz-appearance: none; /* Remove default appearance on Firefox */
    appearance: none; /* Remove default appearance */
    background-color: transparent; /* Make background transparent so actual color shows if picker does not fill */
}

/* For Webkit browsers, style the inner color swatch if possible */
.form-control-color::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 0.20rem; /* Slightly smaller radius for the swatch */
}

.form-control-color::-webkit-color-swatch {
    border: none;
    border-radius: 0.20rem;
}

/* For Firefox, it might show the color by default when -moz-appearance is none.
   If not, further specific Firefox styling might be very limited.
   The height and width adjustments will be the primary visual cue.
*/

/* Ensure the label and input are aligned nicely if needed */
.row .col-md-4 label, .row .col-md-3 label {
    display: block;
    margin-bottom: 0.5rem;
}

/* START: Styles moved from public/admin/products.html */

        /* Reset and base styles specific to products page - uncommenting for now */
        /* Commenting out the aggressive reset to test if it fixes table layout */
        /*
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        */
        body {
            /* background-color: #f5f5f5; /* Global body already has a background color */
            font-family: var(--font-primary) !important; /* Ensure Prompt is applied globally */
        }


        /* Navigation - These were specific to products.html's own top navbar, which seems to have been removed. */
        /* Keeping them commented as sidebar.html likely handles admin navigation. */
        /*
        .navbar {...}
        .navbar-brand {...}
        ...
        .logout-btn:hover {...}
        */

        /* Main content on products.html */
        .products-html-container { /* Keeping this prefixed for now, assuming the outer container in products.html has this class or can be added */
            max-width: 1200px;
            margin: 2rem auto;
            padding: 0 1rem;
        }

        /* Specific page-title for products.html if different from global */
        .products-html-container .page-title {
            font-size: 2rem; /* Ensure this is not smaller than global if unintended */
            margin-bottom: 2rem;
            color: #1a237e; /* Original color for products.html page title */
        }

        /* Stats cards for products.html - REVERTING to original class names */
        .stats-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            margin-bottom: 2rem;
        }

        .stat-card {
            background: white;
            padding: 1.5rem;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .stat-title {
            color: #666;
            font-size: 0.9rem;
            margin-bottom: 0.5rem;
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: bold;
            color: #1a237e;
        }

        /* Search and filters for products.html - REVERTING to original class names */
        .search-bar {
            display: flex;
            gap: 1rem;
            margin-bottom: 1rem; /* This was from products-html-search-bar, ensure it makes sense here */
        }

        .search-input {
            flex: 1;
            padding: 0.5rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
        }

        /* Table styles for products.html */
        .product-table-card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        /* Enforce correct table display properties */
        .card .table { /* CORRECTED: Was .product-table-card .table */
            display: table !important;
            width: 100% !important;
            border-collapse: collapse; /* Common for tables */
        }
        .card .table thead { /* CORRECTED: Was .product-table-card .table thead */
            display: table-header-group !important;
        }
        .card .table tbody { /* CORRECTED: Was .product-table-card .table tbody */
            display: table-row-group !important;
        }
        .card .table tfoot { /* CORRECTED: Was .product-table-card .table tfoot */
            display: table-footer-group !important;
        }
        .card .table tr { /* CORRECTED: Was .product-table-card .table tr */
            display: table-row !important;
        }
        .card .table th, /* CORRECTED: Was .product-table-card .table th */
        .card .table td { /* CORRECTED: Was .product-table-card .table td */
            display: table-cell !important;
            vertical-align: middle; /* Or 'top' or 'bottom' as preferred */
            padding: 0.75rem; /* Bootstrap's default or adjust as needed */
            /* width: auto; /* Let table algorithm decide - usually default for table-cell */
            /* border: 1px solid #dee2e6; /* Add if borders from Bootstrap .table are missing */
        }
        /* The specific style for #productsTable td:first-child for width is handled later in the file */
        /* and should still apply or can be made !important if overridden */

        .card .card-header { /* CORRECTED: Was .product-table-card .card-header - This selector might be too general if other cards exist. Assuming this is for products page context */
            padding: 1rem;
            background: #f8f9fa;
            border-bottom: 1px solid #ddd;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        /* .btn-danger on products.html - If this is a general .btn-danger for products page, otherwise use Bootstrap's */
        .products-html-btn-danger { /* Keeping this prefixed for now, if it's a very specific button */
            background: #dc3545;
            color: white;
        }

        .products-html-btn-danger:hover {
            background: #c82333;
        }

        /* Action button overrides for product table in products.html */
        #productsTable .btn {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            margin: 0 4px;
            font-size: 14px;
            line-height: 1;
            border: none;
        }
        #productsTable .btn.btn-primary {
            background-color: #00D4FE;
            border-color: #00D4FE;
        }
        #productsTable .btn.btn-primary:hover {
            background-color: #00b8e6;
            border-color: #00b8e6;
        }

        #productsTable .btn.btn-danger {
            background-color: #F84B62;
        }
        #productsTable .btn.btn-danger:hover {
            background-color: #e83a52;
        }

        /* Category Filters for products.html - USING ID SELECTOR */
        #categoryFilters {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            padding: 1rem;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            margin-bottom: 1rem;
        }

        #categoryFilters .btn {
            background-color: #e9ecef;
            color: #495057;
            border: 1px solid #ced4da;
            border-radius: 20px;
            padding: 0.3rem 1rem;
            font-size: 0.9rem;
            transition: all 0.3s ease;
        }

        #categoryFilters .btn.active,
        #categoryFilters .btn:hover {
            background: linear-gradient(45deg, #1a237e, #283593);
            color: white;
            border-color: #1a237e;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        /* Stock Level Indicators for products.html table */
        #productsTable td.stock-level {
            font-weight: bold;
        }
        #productsTable td.stock-level.stock-high {
            background-color: #e2f5e8 !important;
            color: #28a745;
        }
        #productsTable td.stock-level.stock-low {
            background-color: #fff9e6 !important;
            color: #e0a800;
        }
        #productsTable td.stock-level.stock-empty {
            background-color: #fdeaea !important;
            color: #dc3545;
        }

        /* Table Footer Summary for products.html */
        #productsTable tfoot {
            position: sticky;
            bottom: 0;
            z-index: 10;
        }
        #productsTable tfoot td {
            padding: 0 !important;
            border: none !important;
        }
        .table-summary-bar { /* Was products-html-table-summary-bar */
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.75rem 1rem;
            background: linear-gradient(90deg, #1e3a8a, #3b82f6);
            color: white;
            border-top: 1px solid rgba(255,255,255,0.2);
        }
        .table-summary-bar .btn-primary { /* Was products-html-table-summary-bar .btn-primary */
            background-color: rgba(255, 255, 255, 0.9);
            color: #1e3a8a;
            border: none;
            font-weight: bold;
        }
        .table-summary-bar .btn-primary:hover { /* Was products-html-table-summary-bar .btn-primary:hover */
            background-color: #fff;
        }
        .table-summary-bar .summary-text { /* Was products-html-table-summary-bar .summary-text */
            font-weight: bold;
            color: #a7c5ff;
            flex-grow: 1;
            text-align: right;
            margin-right: 1.5rem;
        }
        .table-summary-bar .summary-values span { /* Was products-html-table-summary-bar .summary-values span */
            background-color: white;
            color: #1e3a8a;
            padding: 0.35rem 1rem;
            border-radius: 4px;
            font-weight: bold;
            margin-left: 0.5rem;
            min-width: 120px;
            text-align: right;
            display: inline-block;
        }

        /* Print styles for products.html */
        @media print {
            /* These are specific to products.html printing context */
            body > .wrapper > .sidebar,
            body > .wrapper > main > .container-fluid > .d-flex.justify-content-between, /* Hides page title and breadcrumbs */
            body > .wrapper > main > .container-fluid > #categoryFilters,
            body > .wrapper > main > .container-fluid > .card > .card-header, /* Hides search and action buttons */
            #productsTable tfoot,
            #productsTable .btn, /* Hides action buttons in table cells */
            .modal, /* Hides any open modals */
            .no-print { /* Utility class to hide elements from printing */
                display: none !important;
                visibility: hidden !important;
            }

            body > .wrapper > main,
            body > .wrapper > main > .container-fluid,
            body > .wrapper > main > .container-fluid > .card {
                margin: 0 !important;
                padding: 0 !important;
                width: 100% !important;
                max-width: 100% !important;
                box-shadow: none !important;
                border: none !important;
            }

            #productsTable {
                width: 100% !important;
                font-size: 10pt; /* Adjust font size for print if needed */
            }

            #productsTable th, #productsTable td {
                padding: 4px 8px; /* Reduce padding for print */
            }

            /* Ensure the table itself and its content are visible */
            .card, .card *, #productsTable, #productsTable * { /* Was .products-html-print-card, .products-html-print-card * */
                visibility: visible;
            }
            .card { /* Was .products-html-print-card */
                position: static; /* Changed from absolute to flow better */
                left: 0;
                top: 0;
                width: 100%;
                box-shadow: none;
                border: none;
                margin: 0;
                padding: 0;
            }
            /* .product-table-card .card-header, #productsTable .btn, #productsTable tfoot, .products-html-category-filters are now covered by more general selectors above */
        }

        /* Modal styles for products.html - Adjusted for elements within main */
        main .modal { /* Was .products-html-modal - targeting modals within the main content area */
            display: none;
            position: fixed;
            z-index: 1050; /* Ensure modals are above other content, Bootstrap's default is 1050 */
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow-x: hidden; /* Allow horizontal scroll if content is too wide, but typically not desired */
            overflow-y: auto;   /* Allow vertical scroll for the modal itself if it's taller than viewport */
            outline: 0;
            background: rgba(0, 0, 0, 0.5);
        }

        main .modal.show { /* For Bootstrap-like modal display */
            display: block;
        }

        main .modal .modal-dialog { /* Added for Bootstrap compatibility if modals use this structure */
            position: relative;
            width: auto;
            margin: 0.5rem;
            pointer-events: none;
        }

        @media (min-width: 576px) {
            main .modal .modal-dialog {
                max-width: 500px;
                margin: 1.75rem auto;
            }
        }

        @media (min-width: 992px) { /* For larger modals like product modal */
            main .modal .modal-dialog.modal-lg,
            main .modal .modal-dialog.modal-xl { /* Assuming product modal could be modal-xl */
                 max-width: 800px;
            }
        }

        @media (min-width: 1200px) {
             main .modal .modal-dialog.modal-xl {
                  max-width: 1140px; /* Product modal original max-width was 1100px */
             }
        }


        main .modal .modal-content { /* Was .products-html-modal .modal-content */
            position: relative;
            display: flex;
            flex-direction: column;
            width: 100%;
            pointer-events: auto;
            background-color: #fff;
            background-clip: padding-box;
            border: 1px solid rgba(0,0,0,.2);
            border-radius: 0.3rem; /* Bootstrap standard */
            outline: 0;
            /* Original styles:
            background: white;
            width: 90%;
            max-width: 1100px;
            margin: 2rem auto;
            padding: 1.5rem;
            border-radius: 8px;
            position: relative;
            */
            /* max-height and overflow-y for internal scrolling are good */
            max-height: calc(100vh - 3.5rem); /* Considering 1.75rem top/bottom margin for modal content */
            overflow-y: auto;
        }
        main .modal .modal-header { /* Was .products-html-modal .modal-header */
            display: flex;
            align-items: flex-start; /* Align items for title and close button */
            justify-content: space-between;
            padding: 1rem 1rem; /* Bootstrap standard */
            border-bottom: 1px solid #dee2e6; /* Bootstrap standard */
            border-top-left-radius: calc(0.3rem - 1px);
            border-top-right-radius: calc(0.3rem - 1px);
            /* margin-bottom: 1rem; */ /* Handled by padding */
        }

        main .modal .modal-title { /* Was .products-html-modal .modal-title */
            margin-bottom: 0;
            line-height: 1.5;
            font-size: 1.25rem;
            color: #1a237e; /* Kept original color */
        }

        main .modal .close, main .modal .btn-close { /* Was .products-html-modal .close */
            /* Bootstrap 5 uses btn-close */
            box-sizing: content-box;
            width: 1em;
            height: 1em;
            padding: 0.25em 0.25em;
            color: #000;
            background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
            border: 0;
            border-radius: 0.25rem;
            opacity: .5;
            cursor: pointer; /* Ensure cursor is pointer */
            /* Original styles:
            position: absolute;
            right: 1.5rem;
            top: 1.5rem;
            font-size: 1.5rem;
            cursor: pointer;
            color: #666; */
        }

        main .modal .close:hover, main .modal .btn-close:hover { /* Was .products-html-modal .close:hover */
            color: #000;
            text-decoration: none;
            opacity: .75;
        }

        main .modal .modal-body { /* Generic modal body */
            position: relative;
            flex: 1 1 auto;
            padding: 1rem; /* Bootstrap standard */
        }

        main .modal .modal-body form { /* Was .products-html-modal .modal-body form */
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
        }

        main .modal .modal-body .form-group.full-width { /* Was .products-html-modal .modal-body .form-group.full-width */
            grid-column: 1 / -1;
        }

        main .modal .modal-body .form-group textarea { /* Was .products-html-modal .modal-body .form-group textarea */
            min-height: 100px; /* Reduced from 150px for more general use */
        }

        main .modal #fullDescriptionEditor,
        main .modal textarea[name="description"] { /* Specific textareas if they need more height */
            min-height: 150px;
        }

        main .modal .modal-footer { /* Was .products-html-modal .modal-footer */
            display: flex;
            flex-wrap: wrap;
            align-items: center; /* Align items vertically */
            justify-content: flex-end; /* Align buttons to the right */
            padding: 0.75rem; /* Bootstrap standard */
            border-top: 1px solid #dee2e6; /* Bootstrap standard */
            border-bottom-right-radius: calc(0.3rem - 1px);
            border-bottom-left-radius: calc(0.3rem - 1px);
            /* Original styles:
            grid-column: 1 / -1;
            text-align: right;
            margin-top: 1rem;
            */
        }
        main .modal .modal-footer > * { /* Spacing for buttons in footer */
            margin: 0.25rem;
        }
        main .modal .form-group { /* Was .products-html-modal .form-group */
            margin-bottom: 1rem; /* Standard Bootstrap form group margin */
        }

        main .modal .form-label { /* Was .products-html-modal .form-label */
            display: block;
            margin-bottom: 0.5rem;
            color: #666; /* Kept original color */
        }

        main .modal .form-control { /* Was .products-html-modal .form-control */
            width: 100%;
            padding: 0.5rem; /* Original padding */
            border: 1px solid #ddd; /* Original border */
            border-radius: 4px; /* Original border-radius */
            font-size: 1rem; /* Original font-size */
            /* Bootstrap form-control properties are similar:
            display: block;
            width: 100%;
            padding: 0.375rem 0.75rem;
            font-size: 1rem;
            font-weight: 400;
            line-height: 1.5;
            color: #212529;
            background-color: #fff;
            background-clip: padding-box;
            border: 1px solid #ced4da;
            appearance: none;
            border-radius: 0.25rem;
            transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
            */
        }

        main .modal .form-control:focus { /* Was .products-html-modal .form-control:focus */
            border-color: #1a237e; /* Kept original focus color */
            outline: 0; /* Remove default outline */
            box-shadow: 0 0 0 0.2rem rgba(26, 35, 126, 0.25); /* Added focus shadow */
        }

        main .modal .form-info { /* Was .products-html-modal .form-info */
            background-color: #f8f9fa;
            padding: 15px;
            border-radius: 4px;
            margin: 15px 0;
            font-size: 0.9em;
        }

        main .modal .form-info p { /* Was .products-html-modal .form-info p */
            margin: 5px 0;
        }
        /* Button color overrides within modals - if these are meant to be different from global .btn-success etc. */
        main .modal .btn-success { /* Was .products-html-modal .btn-success */
            background-color: #28a745;
            color: white;
            border-color: #28a745; /* Added border color */
        }

        main .modal .btn-success:hover { /* Was .products-html-modal .btn-success:hover */
            background-color: #218838;
            border-color: #1e7e34; /* Added border color */
        }
        main .modal .btn-info { /* Was .products-html-modal .btn-info */
            background-color: #17a2b8;
            color: white;
            border-color: #17a2b8; /* Added border color */
        }

        main .modal .btn-info:hover { /* Was .products-html-modal .btn-info:hover */
            background-color: #138496;
            border-color: #117a8b; /* Added border color */
        }
        main .modal .btn-secondary { /* Was .products-html-modal .btn-secondary */
            background-color: #6c757d;
            color: white;
            text-decoration: none;
            display: inline-block;
            /* margin-left: 10px; */ /* Handled by modal-footer > * */
            border-color: #6c757d; /* Added border color */
        }

        main .modal .btn-secondary:hover { /* Was .products-html-modal .btn-secondary:hover */
            background-color: #5a6268;
            border-color: #545b62; /* Added border color */
        }

        /* Product table image and column width adjustments */
        #productsTable th:first-child,
        #productsTable td:first-child {
            width: 220px !important; /* Sized to suit the 150px thumbnail plus padding */
            min-width: 220px !important;
            text-align: center;
        }

        #productsTable .product-image {
            width: 150px;
            height: 150px;
            object-fit: cover;
            border-radius: 6px;
            border: 1px solid #d0d7de;
        }

        #productsTable .product-image.placeholder {
            object-fit: contain;
            padding: 8px;
            background: #f8f9fa;
        }

        /* Avatar styles for admin pages */
        .customer-avatar {
            width: 40px !important;
            height: 40px !important;
            object-fit: cover;
            border-radius: 50%;
            border: 1px solid #ddd;
        }

        .employee-photo {
            width: 40px !important;
            height: 40px !important;
            object-fit: cover;
            border-radius: 50%;
            border: 1px solid #ddd;
        }

        /* Make Product Name column wider */
        #productsTable th:nth-child(3),
        #productsTable td:nth-child(3) {
            min-width: 250px;
            word-break: break-word; /* Helps with long names */
        }

        /* Make Barcode column narrower */
        #productsTable th:nth-child(2),
        #productsTable td:nth-child(2) {
            width: 120px;
            max-width: 120px; /* Ensure it doesn't expand too much */
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap; /* Prevent wrapping for barcodes */
        }

        /* Adjust "Manage" column (last column) */
        #productsTable th:last-child,
        #productsTable td:last-child {
            width: 120px;
            text-align: center; /* Center the action buttons */
        }

        main .modal .preview-container { /* Was .products-html-modal .preview-container */
            margin-top: 10px;
        }

        main .modal .preview-container img { /* Was .products-html-modal .preview-container img */
            width: 100px;
            height: 100px;
            object-fit: cover;
            border-radius: 4px;
            border: 1px solid #ddd;
        }
        .products-html-text-end { /* Keeping this prefixed for now */
            text-align: right;
        }

        /* Layout styles for admin pages - REVERTING TO ORIGINAL NAMES */
        .wrapper {
            display: flex;
            min-height: 100vh;
        }

        .sidebar {
            width: 260px;
            background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-soft) 100%);
            color: var(--sidebar-link-color);
            transition: all 0.3s;
            display: flex;
            flex-direction: column;
            position: relative; /* Added for context if any child absolutely positioned relative to sidebar */
            box-shadow: 12px 0 30px rgba(15, 23, 42, 0.14);
            overflow: visible;
        }
        .sidebar::after {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(180deg, #22d3ee 0%, var(--sidebar-accent-color) 48%, #2563eb 100%);
            box-shadow: 0 0 18px rgba(6, 182, 212, 0.45);
            pointer-events: none;
            z-index: 2;
        }
        .sidebar .sidebar-header {
            padding: 1.25rem 1.25rem 1rem;
            text-align: left;
            border-bottom: 1px solid var(--sidebar-border-color);
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }
        .sidebar .sidebar-header-icon {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            background: rgba(6, 182, 212, 0.16);
            border: 1px solid rgba(125, 211, 252, 0.22);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .sidebar .sidebar-header-icon i {
            font-size: 1rem;
            color: #fff;
        }
        .sidebar .sidebar-header-text {}
        .sidebar .sidebar-header h3 {
            margin: 0;
            font-weight: 700;
            font-size: 0.95rem;
            color: #ffffff;
            letter-spacing: 0.01em;
        }
        .sidebar .sidebar-header p {
            margin: 0;
            font-size: 0.7rem;
            color: rgba(255,255,255,0.55);
            letter-spacing: 0.02em;
        }
        .sidebar .sidebar-nav {
            padding: 1rem 0;
            flex-grow: 1;
            overflow-y: auto;
        }
        .sidebar .nav-section-header {
            padding: 0.35rem 1.25rem;
            margin: 1rem 0.75rem 0.25rem;
            font-size: 0.65rem;
            color: rgba(219, 234, 254, 0.48);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            background: none;
            border-radius: 0;
        }
        .sidebar .sidebar-nav .nav-link {
            display: flex;
            align-items: center;
            color: rgba(219, 234, 254, 0.78);
            padding: 0.5rem 1.25rem;
            font-size: 0.8rem;
            text-decoration: none;
            border-radius: 6px;
            margin: 1px 0.5rem;
            transition: background-color 0.15s, color 0.15s, transform 0.15s;
            gap: 0.65rem;
        }
        .sidebar .sidebar-nav .nav-link .nav-text {
            flex: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .sidebar .sidebar-nav .nav-link:hover {
            background-color: var(--sidebar-link-hover-bg);
            color: #ffffff;
            transform: translateX(1px);
        }
        .sidebar .sidebar-nav .nav-link.active {
            background-color: var(--sidebar-link-active-bg);
            color: #ffffff;
            font-weight: 600;
            box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.12);
        }
        .sidebar .sidebar-nav .nav-link.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 60%;
            background: var(--sidebar-accent-color);
            box-shadow: 0 0 12px rgba(6, 182, 212, 0.55);
            border-radius: 0 3px 3px 0;
        }
        .sidebar .sidebar-nav .nav-link {
            position: relative;
        }
        .sidebar .sidebar-nav .nav-link i {
            width: 16px;
            text-align: center;
            font-size: 0.82rem;
            opacity: 0.8;
            flex-shrink: 0;
        }
        .sidebar .sidebar-nav .nav-link:hover i,
        .sidebar .sidebar-nav .nav-link.active i {
            opacity: 1;
        }
        .sidebar .sidebar-footer {
            /* position: absolute; */ /* This was the problematic line, ensure it remains commented or removed */
            width: 100%;
            padding: 1rem 0;
            border-top: 1px solid var(--sidebar-border-color);
            /* mt-auto class from Bootstrap will be applied on the element in sidebar.html */
            background-color: var(--sidebar-bg); /* Ensure footer has same bg as sidebar */
        }
        main, #content { /* This is an element selector, not a class */
            flex-grow: 1;
            padding: 0; /* Remove default padding */
            overflow-x: hidden;
        }

        body.sidebar-collapsed .sidebar {
            width: 72px;
            box-shadow: 8px 0 22px rgba(15, 23, 42, 0.14);
        }
        body.sidebar-collapsed .sidebar::after {
            width: 2px;
            box-shadow: none;
        }
        body.sidebar-collapsed .sidebar .sidebar-header {
            padding: 1rem 0.5rem;
        }
        body.sidebar-collapsed .sidebar .sidebar-header p,
        body.sidebar-collapsed .sidebar .sidebar-header .sidebar-title-text {
            display: none;
        }
        body.sidebar-collapsed .sidebar .nav-section-header {
            display: none;
        }
        body.sidebar-collapsed .sidebar .sidebar-nav .nav-link {
            justify-content: center;
            padding: 0.75rem 0.25rem;
        }
        body.sidebar-collapsed .sidebar .sidebar-nav .nav-link .nav-text {
            opacity: 0;
            width: 0;
            margin: 0;
            overflow: hidden;
        }
        body.sidebar-collapsed .sidebar .sidebar-nav .nav-link i {
            margin-right: 0;
            font-size: 1.1rem;
        }
        body.sidebar-collapsed .sidebar .sidebar-footer {
            display: none;
        }
        body.sidebar-collapsed .wrapper main {
            padding-left: 0;
        }

        /* Admin Header Bar */
        .admin-header-bar {
            position: sticky;
            top: 0;
            z-index: 100;
            background-color: #ffffff !important;
        }

        .content-wrapper {
            background-color: var(--main-bg);
            min-height: calc(100vh - 80px);
        }
/* END: Styles moved from public/admin/products.html */

        /* Additional styles for .modal-content when it's a direct child of .modal */
        /* This provides default responsive width, centering, and max-width */
        main > .modal > .modal-content {
            width: 90%; /* Responsive width */
            margin-top: 1.75rem;    /* Centering and vertical margins */
            margin-bottom: 1.75rem;
            margin-left: auto;
            margin-right: auto;
            max-width: 500px; /* Default max-width, like Bootstrap .modal-sm */
        }

        /* Specific max-width for the Product Modal content */
        #productModal > .modal-content {
            max-width: 1100px; /* Larger max-width for product form */
        }
        /* Note: #brandModal > .modal-content has inline max-width: 600px which will take precedence */

/* Ensure Choices.js dropdown in modal is scrollable */
#add-section-modal .choices__list--dropdown {
    max-height: 200px; /* Adjust as needed */
    overflow-y: auto;
}

/* === Signature Styles for Documents (e.g., Quotations) === */
.signature-container {
    display: flex;
    justify-content: space-between; /* Distributes 3 boxes evenly */
    gap: 1.5rem; /* Space between boxes */
    /* margin-top, padding-top, border-top are expected to be handled by Bootstrap utility classes like mt-5, pt-4, border-top on the element itself */
}

.signature-box {
    flex: 1; /* Each box takes equal width based on parent width and gap */
    border: 1px solid #ccc;
    padding: 15px 10px;
    text-align: center;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    min-height: 180px; /* Provides a consistent minimum height */
}

.signature-box .signature-title {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 10px;
    min-height: 2.5em; /* Allows space for potentially two lines of title text */
    line-height: 1.25;
}

/* Styles for the actual line where a person signs manually */
.signature-box .signature-line {
    border-bottom: 1px solid #333;
    width: 90%;
    margin: 25px auto 5px auto; /* top, horizontal-auto, bottom, horizontal-auto */
    height: 1px; /* The border acts as the line; content like &nbsp; ensures rendering */
}

/* Adjust spacing if a signature line follows an image (e.g., in an approver box) */
.signature-box img + .signature-line {
    margin-top: 10px;
}

/* Styling for the paragraph that contains the typed name, e.g., (<span id="salesperson-name-in-signature">...</span>) */
/* This targets the <p> elements that usually hold the typed name placeholders. */
.signature-box p:nth-last-child(2):not(.signature-line):not(.signature-title):not(img) {
    font-size: 0.8rem;
    margin-top: 2px;
    color: #333;
    word-wrap: break-word;
}

.signature-box .date-line {
    font-size: 0.8rem;
    color: #333;
    margin-top: auto; /* Pushes the date line to the bottom of the flex column */
    padding-top: 8px;
    text-align: left;
}

/* Moves inline styles from HTML img tag to CSS for consistency */
.signature-box img {
    max-width: 90%;
    max-height: 50px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto 5px auto;
    object-fit: contain;
}


/* Print styles for signatures */
@media print {
    .signature-container {
        margin-top: 10mm !important;
        padding-top: 5mm !important;
        gap: 10px !important;
        page-break-inside: avoid !important;
    }
    .signature-box {
        font-size: 0.75rem !important;
        padding: 8px 5px !important;
        min-height: 130px !important;
        border: 1px solid #777 !important;
    }
    .signature-box .signature-title {
        font-size: 0.8rem !important;
        margin-bottom: 5px !important;
        min-height: 2em !important;
    }
    .signature-box .signature-line {
        margin: 15px auto 3px auto !important;
        border-bottom-width: 0.5pt !important;
        border-bottom-color: #000 !important;
    }

    .signature-box p:nth-last-child(2):not(.signature-line):not(.signature-title):not(img) {
        font-size: 0.7rem !important;
        margin-top: 1px !important;
    }

    .signature-box .date-line {
        font-size: 0.7rem !important;
        padding-top: 5px !important;
    }
    .signature-box img {
        max-height: 40px !important;
        margin-bottom: 3px !important;
    }
}

/* Payment Proof Modal Styles */
.payment-proof-modal .swal2-popup {
    max-width: 90vw !important;
}

.payment-proof-report .card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.payment-proof-report .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
}

.payment-proof-report .card-body {
    padding: 1rem;
}

.payment-proof-report img {
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.payment-proof-report img:hover {
    transform: scale(1.05);
}

.swal-image-zoom {
    max-width: 90vw !important;
    max-height: 90vh !important;
    object-fit: contain;
}

/* Summary row styles for products table */
.table-summary-row {
    background-color: #e9ecef !important;
    font-weight: bold;
}

.table-summary-row td {
    border-top: 2px solid #495057 !important;
    padding: 0.75rem !important;
    vertical-align: middle !important;
}

.table-summary-row strong {
    color: #495057;
    font-size: 0.95rem;
}

/* Header Bar Styles */
.admin-header-bar {
    position: sticky;
    top: 0;
    z-index: 1020;
    border-bottom: 1px solid #dee2e6;
}

.admin-header-bar .container-fluid {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* Remove default padding from content areas */
.content-wrapper {
    padding: 0 !important;
}

#content {
    padding: 0 !important;
}

/* Dashboard Layout */
.dashboard .content-wrapper {
    background-color: #f8f9fc;
}

/* Dashboard Cards */
.dashboard .card {
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.dashboard .card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 0.75rem 1rem;
}

.dashboard .card-header h6 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #5a5c69;
}

/* Three Column Layout */
.dashboard .col-lg-4 {
    margin-bottom: 1rem;
}

/* Equal Height Cards */
.dashboard .card.h-100 {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard .card.h-100 .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Stat Cards with Background Colors */
.dashboard .bg-primary {
    background-color: #4e73df !important;
}

.dashboard .bg-info {
    background-color: #36b9cc !important;
}

.dashboard .bg-success {
    background-color: #1cc88a !important;
}

.dashboard .bg-warning {
    background-color: #f6c23e !important;
}

.dashboard .text-white-50 {
    color: rgba(255, 255, 255, 0.7) !important;
}

.dashboard .opacity-75 {
    opacity: 0.75 !important;
}

/* Chart Containers */
.dashboard canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* Alert Styling */
.dashboard .alert {
    border: 1px solid transparent;
    border-radius: 0.35rem;
    padding: 0.75rem 1.25rem;
}

.dashboard .alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.dashboard .alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.dashboard .alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Border utilities */
.dashboard .border-end {
    border-right: 1px solid #dee2e6 !important;
}

/* Spacing */
.dashboard .mb-4 {
    margin-bottom: 1.5rem !important;
}

.dashboard .mb-3 {
    margin-bottom: 1rem !important;
}

/* Timeline Styles */
.dashboard .timeline {
    position: relative;
    padding-left: 30px;
}

.dashboard .timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.dashboard .timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.dashboard .timeline-marker {
    position: absolute;
    left: -37px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e9ecef;
}

.dashboard .timeline-content {
    background: #f8f9fc;
    padding: 1rem;
    border-radius: 0.375rem;
    border-left: 3px solid #e9ecef;
}

.dashboard .timeline-title {
    margin-bottom: 0.5rem;
    color: #5a5c69;
    font-size: 1rem;
}

.dashboard .timeline-text {
    margin-bottom: 0.5rem;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Progress Bars */
.dashboard .progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.dashboard .progress-bar {
    border-radius: 4px;
}

/* Quick Action Cards */
.dashboard .card.h-100 {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    min-height: 120px;
}

.dashboard .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.dashboard .card .fa-2x {
    transition: transform 0.2s ease-in-out;
}

.dashboard .card:hover .fa-2x {
    transform: scale(1.1);
}

/* Compact Card Body */
.dashboard .card-body {
    padding: 1rem;
}

.dashboard .card-body h6 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.dashboard .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Button Enhancements */
.dashboard .btn {
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    transition: all 0.15s ease-in-out;
}

.dashboard .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Alert Enhancements */
.dashboard .alert {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.dashboard .alert strong {
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard .col-lg-3 {
        margin-bottom: 1rem !important;
    }

    .dashboard .timeline {
        padding-left: 20px;
    }

    .dashboard .timeline-marker {
        left: -27px;
    }

    .dashboard .card h5 {
        font-size: 1.1rem;
    }

    .dashboard .fa-3x {
        font-size: 2rem !important;
    }
}
