/* ==========================================================================
   LIGHT WARM CHOCOLATE & MOCHA DASHBOARD DESIGN SYSTEM
   Clean, Elegant, Soft Light Palette with SPA View Navigation
   ========================================================================== */

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

:root {
    /* Color Palette - Light Soft Chocolate / Warm Mocha Theme */
    --bg-dark: #f8f5f0;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.88);
    --bg-glass-card: #ffffff;
    --bg-glass-input: #f4efea;

    --border-color: #e6dfd5;
    --border-glow: rgba(140, 90, 71, 0.18);

    /* Text Colors */
    --text-primary: #2a1e17;
    --text-secondary: #635246;
    --text-muted: #948275;

    /* Soft Warm Chocolate Accent Colors & Gradients */
    --primary: #8c5a47;
    --primary-hover: #734735;
    --primary-glow: rgba(140, 90, 71, 0.2);
    --accent-cyan: #7c5b9e;
    --accent-emerald: #3b7a57;
    --accent-amber: #c4762b;
    --accent-rose: #be4b49;
    --accent-purple: #8c5a47;

    --gradient-primary: linear-gradient(135deg, #8c5a47 0%, #aa735e 100%);
    --gradient-cyan: linear-gradient(135deg, #7c5b9e 0%, #9974bd 100%);
    --gradient-emerald: linear-gradient(135deg, #3b7a57 0%, #529670 100%);
    --gradient-amber: linear-gradient(135deg, #c4762b 0%, #db8f44 100%);
    --gradient-card: linear-gradient(135deg, #ffffff 0%, #faf6f0 100%);

    /* UI Measurements */
    --sidebar-width: 270px;
    --header-height: 75px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-subtle: 0 4px 20px -2px rgba(100, 70, 50, 0.05);
    --shadow-glow: 0 4px 15px rgba(140, 90, 71, 0.15);
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 10%, rgba(140, 90, 71, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(124, 91, 158, 0.04) 0%, transparent 45%);
    background-attachment: fixed;
}

/* SPA View Containers */
.spa-view {
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}

.spa-view.active {
    display: block;
    opacity: 1;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #dcd3c7;
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

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

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition-smooth);
}

.main-content {
    padding: 2rem 2rem 5.5rem;
    flex: 1;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 15px rgba(100, 70, 50, 0.03);
    transition: var(--transition-smooth);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(140, 90, 71, 0.3);
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.brand-title span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    padding: 1.5rem 1rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.menu-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: relative;
    cursor: pointer;
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: var(--transition-fast);
    color: var(--text-muted);
}

.nav-link:hover {
    color: var(--primary);
    background: #f5efe8;
    transform: translateX(3px);
}

.nav-link:hover i {
    color: var(--primary);
}

.nav-link.active {
    color: #fff;
    background: var(--gradient-primary);
    font-weight: 600;
    box-shadow: var(--shadow-glow);
}

.nav-link.active i {
    color: #fff;
}

.badge-count {
    margin-left: auto;
    background: #ede6dc;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
}

.nav-link.active .badge-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.sidebar-user {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: #faf6f1;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 0.9rem;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Header Styles */
.header {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

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

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.6rem;
    background: var(--bg-glass-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 12px rgba(140, 90, 71, 0.15);
}

.view-search {
    width: 240px;
}

.kbd-shortcut {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: #e6dfd5;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.header-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: #f9f5f0;
}

.status-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-emerald);
    border-radius: var(--radius-full);
    box-shadow: 0 0 6px var(--accent-emerald);
}

.live-time-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.live-pulse {
    width: 7px;
    height: 7px;
    background: var(--accent-emerald);
    border-radius: var(--radius-full);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 122, 87, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(59, 122, 87, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 122, 87, 0);
    }
}

/* Glassmorphic Card Components */
.glass-card {
    background: var(--bg-surface);
    background-image: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-subtle);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: #d8cebf;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(100, 70, 50, 0.08);
}

/* Metric Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

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

.stat-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.trend-up {
    color: var(--accent-emerald);
}

.trend-down {
    color: var(--accent-rose);
}

.stat-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
}

.icon-purple {
    background: var(--gradient-primary);
    box-shadow: 0 4px 12px rgba(140, 90, 71, 0.25);
}

.icon-cyan {
    background: var(--gradient-cyan);
    box-shadow: 0 4px 12px rgba(124, 91, 158, 0.25);
}

.icon-emerald {
    background: var(--gradient-emerald);
    box-shadow: 0 4px 12px rgba(59, 122, 87, 0.25);
}

.icon-amber {
    background: var(--gradient-amber);
    box-shadow: 0 4px 12px rgba(196, 118, 43, 0.25);
}

/* Dashboard Content Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--primary);
}

/* Custom Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(140, 90, 71, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(140, 90, 71, 0.45);
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    background: #f9f5f0;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
}

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

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.4rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.custom-table th {
    padding: 0.8rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.custom-table tbody tr {
    background: #ffffff;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.custom-table tbody tr:hover {
    background: #fcf8f3;
    transform: scale(1.001);
}

.custom-table td {
    padding: 0.9rem 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

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

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-full);
}

.badge-success {
    background: #eef7f2;
    color: var(--accent-emerald);
    border: 1px solid rgba(59, 122, 87, 0.3);
}

.badge-warning {
    background: #fdf5eb;
    color: var(--accent-amber);
    border: 1px solid rgba(196, 118, 43, 0.3);
}

.badge-purple {
    background: #f7f1ea;
    color: var(--primary);
    border: 1px solid rgba(140, 90, 71, 0.3);
}

.badge-cyan {
    background: #f4eff8;
    color: var(--accent-cyan);
    border: 1px solid rgba(124, 91, 158, 0.3);
}

/* Form & Input Controls */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--bg-glass-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(140, 90, 71, 0.18);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23635246'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 2.5rem;
}

select.form-control option {
    background-color: #ffffff;
    color: var(--text-primary);
}

/* Modal Overlay & Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(42, 30, 23, 0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 40px rgba(70, 45, 30, 0.18);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #faf6f1;
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--accent-rose);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #faf6f1;
}

/* Record Detail View Rows */
.view-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(140, 90, 71, 0.12);
    font-size: 0.9rem;
}

.view-row:last-child {
    border-bottom: none;
}

.view-row span {
    color: var(--text-muted);
    flex-shrink: 0;
}

.view-row strong {
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

/* Toast Notifications Container */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 8px 25px rgba(70, 45, 30, 0.12);
    animation: slideIn 0.3s ease forwards;
}

.toast-alert.success {
    border-left-color: var(--accent-emerald);
}

.toast-alert.error {
    border-left-color: var(--accent-rose);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Product Image Preview (small, stays inside form) */
.product-image-preview {
    display: none;
    margin-top: 0.75rem;
    max-width: 130px;
    max-height: 130px;
    width: auto;
    height: auto;
    border-radius: var(--radius-md);
    object-fit: contain;
    border: 1px solid var(--border-color);
    padding: 0.25rem;
    background: #faf6f1;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 50;
    padding: 0.9rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-surface);
}

/* Detail Product Cards Grid */
.product-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 0.9rem;
    padding: 0.75rem 0;
}

.detail-product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.detail-product-card.selected {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 2px rgba(59, 122, 87, 0.15);
}

.detail-card-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 17px;
    height: 17px;
    accent-color: var(--accent-emerald);
    cursor: pointer;
}

.detail-card-img {
    width: 100%;
    height: 95px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: rgba(140, 90, 71, 0.08);
}

.detail-card-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.83rem;
    color: var(--text-primary);
}

.detail-card-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.detail-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.detail-card-price {
    font-weight: 800;
    color: var(--accent-emerald);
    font-size: 0.85rem;
}

.detail-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-btn {
    padding: 0;
    justify-content: center;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    width: 250px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(70, 45, 30, 0.18);
    padding: 0.5rem;
    display: none;
    z-index: 400;
}

.profile-menu.open {
    display: block;
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.profile-avatar-lg {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-menu-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.profile-menu-email {
    color: var(--text-muted);
    font-size: 0.75rem;
    word-break: break-all;
}

.profile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.profile-menu-item:hover {
    background: #faf6f1;
}

/* Pagination Styling */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-btns {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(140, 90, 71, 0.3);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    /* Hide everything on the page by default */
    body * {
        visibility: hidden !important;
    }

    /* Show ONLY the GST Certificate container or Printable Quotation proposal container */
    #gstCertificateContainer,
    #gstCertificateContainer *,
    #printableInvoiceContent,
    #printableInvoiceContent * {
        visibility: visible !important;
    }

    /* Position the GST Certificate centered at the top of the printed page */
    #gstCertificateContainer {
        position: absolute !important;
        left: 50% !important;
        top: 0 !important;
        transform: translateX(-50%) !important;
        width: 100% !important;
        max-width: 780px !important;
        margin: 0 auto !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    #printableInvoiceContent {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        padding: 0 !important;
    }

    @page {
        size: A4 portrait;
        margin: 5mm;
    }
}

/* ==========================================================================
   ADMIN LAYOUT GRID & RESPONSIVE DESIGN SYSTEM
   Mobile, Tablet & Desktop Layout Breakdown
   ========================================================================== */

/* Base Grid Layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-toggle-btn {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.sidebar-toggle-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    margin-bottom: 1rem;
}

/* ==================== MEDIA QUERIES ==================== */

/* Desktop & Laptop Small Adjustments (<= 1200px) */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet & Mobile Slide-Over Sidebar (<= 1024px) */
@media (max-width: 1024px) {
    .sidebar-toggle-btn {
        display: inline-flex !important;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }

    .header {
        padding: 0 1.25rem;
    }

    .main-content {
        padding: 1.25rem 1.25rem 4rem;
    }

    .search-box {
        max-width: 280px;
    }
}

/* Mobile Devices (<= 768px) */
@media (max-width: 768px) {
    .header {
        height: auto;
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-left {
        width: 100%;
        justify-content: space-between;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
        order: 3;
    }

    .header-right {
        margin-left: auto;
    }

    .page-title {
        font-size: 1.15rem !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 1rem auto !important;
        padding: 1.25rem !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-body {
        padding: 1rem 0;
    }

    .form-grid,
    .form-row {
        grid-template-columns: 1fr !important;
        flex-direction: column;
    }

    .table-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .table-header-actions .search-box,
    .table-header-actions .btn {
        width: 100%;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0.75rem 3.5rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .kbd-shortcut {
        display: none;
    }
}

/* Footer & Header Logo Component Styles */
.footer {
    width: 100%;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: auto;
    box-shadow: 0 -2px 10px rgba(100, 70, 50, 0.02);
}

.header-brand-logo-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-brand-logo-mobile img {
    height: 34px;
    width: 34px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .main-content {
        padding: 1.25rem 1.25rem 2rem !important;
    }
    .footer {
        padding: 1rem 1.25rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
    }
}