:root {
    /* Layout & Transition Spacing */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Neumorphic Palette Light (60% Surface, 30% Dark Elements/Text, 10% Gradient Accent) */
    --bg: #e0e0e0;
    --surface: #e0e0e0;
    --shadow-flat: 6px 6px 12px #bebebe, -6px -6px 12px #ffffff;
    --shadow-inset: inset 4px 4px 8px #bebebe, inset -4px -4px 8px #ffffff;
    --shadow-hover: 10px 10px 20px #bebebe, -10px -10px 20px #ffffff;
    
    /* 30% Deep Contrast Elements */
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --dark-surface: #1e2530;
    --dark-surface-shadow: #12161d;
    --border: rgba(0, 0, 0, 0.05);
    
    /* 10% Accent */
    --accent-gradient: linear-gradient(135deg, #0072ff, #00c6ff);
    --accent-color: #0072ff;
    --accent-text: #ffffff;
    
    /* System States */
    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --info: #3498db;
}

[data-theme="dark"] {
    /* Neumorphic Palette Dark (60% Surface, 30% Dark Elements/Text, 10% Gradient Accent) */
    --bg: #1e293b;
    --surface: #1e293b;
    --shadow-flat: 6px 6px 12px #111827, -6px -6px 12px #2b3a4f;
    --shadow-inset: inset 4px 4px 8px #111827, inset -4px -4px 8px #2b3a4f;
    --shadow-hover: 10px 10px 20px #111827, -10px -10px 20px #2b3a4f;
    
    /* 30% Deep Contrast Elements (Flipped context but keeping ratio logic) */
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --dark-surface: #0f172a;
    --dark-surface-shadow: #020617;
    --border: rgba(255, 255, 255, 0.05);
    
    --accent-gradient: linear-gradient(135deg, #0072ff, #00c6ff);
    --accent-color: #00c6ff;
    --accent-text: #0f172a;
}

/* Global Styles */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    transition: var(--transition);
    overflow-x: hidden;
}

/* Layout Grid */
.main-wrapper {
    display: block;
    min-height: 100vh;
}

.content {
    width: 100%;
    max-width: 100%;
    padding: 2rem;
    box-sizing: border-box;
    padding-bottom: 7rem; /* Added padding to prevent bottom nav overlay */
}

/* Neumorphic Utility Classes */
.neu-flat {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-flat);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.neu-flat-hover:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.neu-inset {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-inset);
    border: none;
}

/* Deep contrast header/sidebar sections (30%) */
.dark-panel {
    background-color: var(--dark-surface);
    color: #ffffff;
    border-radius: var(--radius);
    box-shadow: 6px 6px 12px var(--dark-surface-shadow);
}

/* Inputs & Forms */
.form-group-neu {
    margin-bottom: 1.5rem;
}

.form-group-neu label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group-neu input:not([type="radio"]):not([type="checkbox"]), 
.form-group-neu select, 
.form-group-neu textarea {
    width: 100%;
    padding: 0.8rem 1.2rem;
    font-size: 0.95rem;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-inset);
    transition: var(--transition);
    outline: none;
    box-sizing: border-box;
}

.form-group-neu input:not([type="radio"]):not([type="checkbox"]):focus, 
.form-group-neu select:focus, 
.form-group-neu textarea:focus {
    border-color: var(--accent-color);
}

.form-group-neu input:disabled, 
.form-group-neu select:disabled, 
.form-group-neu textarea:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background-color: var(--bg);
}

/* Neumorphic Buttons */
.btn-neu {
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-flat);
    transition: var(--transition);
    cursor: pointer;
    outline: none;
}

.btn-neu:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.btn-neu:active {
    box-shadow: var(--shadow-inset);
    transform: translateY(0);
}

/* Accent Buttons (10%) */
.btn-accent {
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff !important;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: 4px 4px 8px rgba(0, 114, 255, 0.3), -4px -4px 8px rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    cursor: pointer;
    outline: none;
}

.btn-accent:hover {
    opacity: 0.9;
    box-shadow: 6px 6px 12px rgba(0, 114, 255, 0.4);
    transform: translateY(-1px);
}

.btn-accent:active {
    transform: translateY(0);
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Badge Alert States */
.badge-neu {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50px;
    box-shadow: var(--shadow-flat);
}

.badge-success {
    background-color: rgba(46, 204, 113, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-warning {
    background-color: rgba(241, 196, 15, 0.15);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-danger {
    background-color: rgba(230, 126, 34, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Header UI Elements */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--surface);
    box-shadow: var(--shadow-flat);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.brand-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: var(--transition);
}

.brand-logo-link:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.brand-logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Theme Toggle Button Switch */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-switch {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface);
    box-shadow: var(--shadow-inset);
    transition: .4s;
    border-radius: 34px;
}

.slider-switch:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--accent-color);
    transition: .4s;
    border-radius: 50%;
    box-shadow: var(--shadow-flat);
}

input:checked + .slider-switch {
    background-color: var(--surface);
}

input:checked + .slider-switch:before {
    transform: translateX(26px);
    background-color: var(--accent-color);
}

/* Floating Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface);
    box-shadow: var(--shadow-flat);
    border-radius: 50px;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.bottom-nav-container {
    display: flex;
    align-items: center;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    border-radius: 50px;
    transition: var(--transition);
    border: 1px solid transparent;
    font-size: 0.95rem;
}

.nav-item-link:hover {
    color: var(--accent-color);
    box-shadow: var(--shadow-inset);
}

.nav-item-link.active {
    background: var(--accent-gradient);
    color: #ffffff !important;
    box-shadow: 4px 4px 10px rgba(0, 114, 255, 0.3);
}

/* Table Neumorphism */
.table-responsive-neu {
    overflow-x: auto;
    padding: 5px;
}

.table-neu {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    color: var(--text);
}

.table-neu th {
    font-weight: 700;
    padding: 1rem;
    border: none;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

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

.table-neu td {
    background: var(--surface);
    padding: 1.2rem 1rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table-neu td:first-child {
    border-left: 1px solid var(--border);
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}

.table-neu td:last-child {
    border-right: 1px solid var(--border);
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

.table-neu tr:hover td {
    transform: translateY(-2px);
    box-shadow: 4px 4px 8px var(--shadow-dark);
}

/* Cards Grids */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* SweetAlert2 Theme Customizer overrides */
.swal2-popup {
    background: var(--surface) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-flat) !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
}
.swal2-title, .swal2-html-container {
    color: var(--text) !important;
}
.swal2-confirm {
    background: var(--accent-gradient) !important;
    box-shadow: 4px 4px 8px rgba(0, 114, 255, 0.3) !important;
}
.swal2-cancel {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-flat) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--shadow-dark);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Header User Profile Styles */
.header-user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
}
.header-user-profile .user-info {
    text-align: right;
}
.header-user-profile .user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}
.header-user-profile .user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.header-user-profile .btn-logout {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    color: var(--danger);
    border-color: var(--danger);
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Dashboard Layout Styles */
.dashboard-column {
    height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
}
.dashboard-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.dashboard-filter-bar .search-container {
    margin-bottom: 0;
    flex-grow: 1;
}
.dashboard-filter-bar .search-container input {
    padding: 0.6rem 1rem;
    width: 100%;
}

/* Responsive Media Queries */
@media (max-width: 991.98px) {
    .content {
        padding: 1rem;
        padding-bottom: 6.5rem;
    }
    
    .header-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.8rem 1rem;
        gap: 0.5rem;
        margin-bottom: 1.2rem;
    }
    
    .brand-logo-img {
        height: 32px;
    }
    
    .header-controls {
        flex-direction: row;
        gap: 0.8rem;
        align-items: center;
        width: auto;
    }
    
    .header-controls > div {
        justify-content: flex-end;
    }
    
    .header-user-profile {
        border-left: none !important;
        padding-left: 0 !important;
        border-top: 1px solid var(--border);
        padding-top: 0.8rem;
        justify-content: center;
        width: 100%;
    }
    
    .header-user-profile .user-info {
        text-align: left !important;
    }

    .dashboard-column {
        height: 55vh !important;
        min-height: 480px;
        padding: 1.2rem !important;
    }
}

@media (max-width: 576px) {
    .content {
        padding: 0.75rem;
        padding-bottom: 6rem;
    }
    
    .dashboard-column {
        height: 50vh !important;
        min-height: 380px;
    }
    
    .dashboard-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        margin-bottom: 1rem;
    }
    
    .dashboard-filter-bar .search-container input {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .category-pill-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    .cat-pill {
        padding: 0.4rem 0.9rem;
        font-size: 0.78rem;
    }
    
    /* Product card adjustments on mobile */
    .product-card {
        padding: 0.8rem !important;
    }
    
    .product-card h6 {
        font-size: 0.85rem !important;
        line-height: 1.2;
        margin-top: 0.2rem;
    }
    
    .product-card .badge-neu {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    .product-card small {
        font-size: 0.65rem !important;
    }
    
    .product-card div[style*="font-size: 0.8rem"] {
        font-size: 0.7rem !important;
    }
    
    .product-card span[style*="font-size: 0.75rem"] {
        font-size: 0.65rem !important;
    }
    
    .product-card span[style*="font-weight: 800"] {
        font-size: 0.85rem !important;
    }
}

/* Glowing Status Dot for Bluetooth Scale */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px currentColor;
    transition: var(--transition);
}
.status-success {
    background-color: var(--success);
    color: var(--success);
    animation: pulse-green 2s infinite;
}
.status-danger {
    background-color: var(--danger);
    color: var(--danger);
    animation: pulse-red 2s infinite;
}
@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Profile Dropdown Module */
.profile-dropdown-container {
    position: relative;
    display: inline-block;
}
.profile-trigger-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
}
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: var(--shadow-flat);
    border: 2px solid var(--surface);
    transition: var(--transition);
}
.avatar-circle:hover {
    box-shadow: var(--shadow-hover);
    transform: scale(1.05);
}
.profile-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.8rem;
    width: 230px;
    border-radius: var(--radius);
    padding: 0.8rem 0;
    z-index: 1200;
    display: none;
    animation: slideDownFade 0.25s ease-out;
}
.profile-dropdown-menu.show {
    display: block;
}
.dropdown-user-info {
    padding: 0.5rem 1.2rem;
}
.dropdown-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}
.dropdown-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}
.dropdown-divider {
    height: 1px;
    background-color: var(--border);
    margin: 0.5rem 0;
}
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.2rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}
.dropdown-item:hover {
    background-color: rgba(0, 198, 255, 0.08);
    color: var(--accent-color);
}
.dropdown-item svg {
    color: var(--text-muted);
    transition: var(--transition);
}
.dropdown-item:hover svg {
    color: var(--accent-color);
}
@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Cart Layout Styles */
.mobile-cart-trigger {
    display: none;
    position: relative;
    padding: 0.6rem;
    border-radius: 50%;
    background-color: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
}
.mobile-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-gradient);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    box-shadow: 0 2px 5px rgba(0, 114, 255, 0.3);
}
.mobile-cart-close {
    display: none;
}

@media (max-width: 991.98px) {
    .mobile-cart-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-cart-close {
        display: inline-block;
    }

    /* Transform Cart Column to an offscreen drawer on Mobile/Tablet */
    #cartColumn {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        max-width: 420px;
        height: 100dvh;
        z-index: 2000;
        margin-bottom: 0 !important;
        padding: 0 !important;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    #cartColumn.open {
        right: 0;
    }
    #cartColumn .dashboard-column {
        height: 100dvh !important;
        border-radius: 0;
        border: none;
        border-left: 1px solid var(--border);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    }
}

/* ── SweetAlert2 always on top (above cart drawer z-index: 2000) ── */
.swal2-container {
    z-index: 9999 !important;
}

/* Settings Page Redesigned Sidebar Menu */
.settings-vertical-menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.settings-menu-btn {
    width: 100%;
    text-align: left;
    padding: 1.1rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-flat);
    color: var(--danger);
    font-weight: 700;
    font-size: 1.05rem;
    transition: var(--transition);
    cursor: pointer;
    display: block;
}
.settings-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.settings-menu-btn.active {
    box-shadow: var(--shadow-inset);
    font-weight: 800;
    border-color: rgba(231, 76, 60, 0.2);
}

/* ── Notification Dropdown ── */
.notification-dropdown-container {
    position: relative;
}
.notification-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.8rem;
    width: 320px;
    border-radius: var(--radius);
    padding: 0;
    z-index: 1200;
    display: none;
    animation: slideDownFade 0.25s ease-out;
    box-shadow: var(--shadow-hover);
}
.notification-dropdown-menu.show {
    display: block;
}
.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
}
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--danger);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface);
}
.notification-item {
    display: flex;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}
.notification-item:hover {
    background-color: var(--border);
}
.notification-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notification-body {
    flex-grow: 1;
    min-width: 0;
}
.notification-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.15rem;
}
.notification-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.3;
}
.notification-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-family: monospace;
}
