/*
 * admin.css — QR Menu Admin Design System
 * One source of truth for ALL admin CSS.
 * All colors are CSS custom properties defined in :root.
 */

/* ═══════════════════════════════════════════
   1. CSS VARIABLES
═══════════════════════════════════════════ */
:root {
    /* Brand */
    --primary: #6c47ff;
    --primary-dark: #5535e0;
    --primary-subtle: rgba(108, 71, 255, .15);
    --primary-glow: rgba(108, 71, 255, .1);

    /* Semantic status */
    --success: #22c55e;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --warning: #f59e0b;
    --warning-bg: #fef9c3;
    --warning-text: #854d0e;
    --info: #3b82f6;
    --info-bg: #dbeafe;
    --info-text: #1e40af;

    /* Extended palette (used as card accents) */
    --color-purple: #8b5cf6;
    --color-cyan: #06b6d4;
    --color-orange: #f97316;
    --color-pink: #ec4899;
    --color-teal: #10b981;
    --color-blue: #3b82f6;

    /* Layout */
    --sidebar-w: 240px;

    /* Sidebar */
    --sidebar-bg: #1a1d23;
    --sidebar-border: rgba(255, 255, 255, .07);
    --sidebar-text: #a0a4b0;
    --sidebar-hover-bg: rgba(108, 71, 255, .15);

    /* Page chrome */
    --bg: #f5f6fa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;

    /* Typography */
    --text: #1a1d23;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    /* Row hover */
    --row-hover: #f9fafb;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .07);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, .1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .2);

    /* Transitions */
    --transition: .2s ease;

    /* Badge gray */
    --gray-bg: #f3f4f6;
    --gray-text: #6b7280;
}


:root {
  --navy: #003271;
  --cyan: #00b4d8;
  --dark: #1a1a2e;
  --light: #f7f8fc;
  --muted: #9aa0b8;
  --border: #e8e8f0;
  --navy2: #1a1a45;
  --cyan2: #0096b8;
  --cyan3: #c2eaf7;
  --white: #ffffff;
  --red: #c0392b;
  --green: #00c896;
  --dz-dark: #0a0e14;
  --dz-blue: #1a8fff;
  --dz-line: rgba(0, 200, 160, 0.15);
  --dz-line2: rgba(0, 200, 160, 0.08);
  --dz-text: #c8d6e5;
  --dz-muted: #5a7a94;
  --dz-white: #eaf2fb;
  --cyan-dim: rgba(0, 200, 160, 0.10);
}
/* ═══════════════════════════════════════════
   2. RESET & BASE
═══════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}
#app{
    width: 100%;
}

#main{
    max-width: 100%;
}

/* ═══════════════════════════════════════════
   3. SIDEBAR
═══════════════════════════════════════════ */
#sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .3s ease;
    overflow-y: auto;
}

@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #main {
        margin-left: 0 !important;
    }
}

#sidebar .brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
}

#sidebar .brand a {
    text-decoration: none;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

#sidebar .brand a span {
    color: var(--cyan);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: #fff;
    background: var(--sidebar-hover-bg);
    border-left-color: var(--primary);
    text-decoration: none;
}

.nav-item-has-sub {
    transition: all var(--transition);
}

.nav-item-has-sub .sub-menu {
    display: none;
    background: rgba(0, 0, 0, 0.15);
    padding-left: 20px;
}

.nav-item-has-sub.open .sub-menu {
    display: block;
}

.nav-item-has-sub .nav-link {
    cursor: pointer;
}

.nav-item-has-sub .sub-indicator {
    transition: transform var(--transition);
    font-size: 12px;
}

.nav-item-has-sub.open .sub-indicator {
    transform: rotate(180deg);
}

.sidebar-nav a i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: #4b5563;
    padding: 16px 20px 4px;
    letter-spacing: .06em;
}

.nav-logout {
    color: var(--danger) !important;
    border-left-color: transparent !important;
}
.login-card{
    box-shadow: 0 0 20px #0002;
    background: white;  
    padding: 30px;
    border-radius: 20px;
}
.nav-logout:hover {
    background: var(--danger-bg) !important;
    border-left-color: var(--danger) !important;
    color: var(--danger-text) !important;
}


/* ═══════════════════════════════════════════
   4. MAIN LAYOUT
═══════════════════════════════════════════ */
#main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

#topbar .page-title {
    font-size: 16px;
    font-weight: 600;
}

#topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

#topbar .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

#topbar .avatar::after {
    display: none !important; /* Hide Bootstrap dropdown arrow */
}

.topbar-right .dropdown-menu {
    margin-top: 8px !important;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    padding: 8px 0;
}

.topbar-right .dropdown-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--transition);
    cursor: pointer;
}

.topbar-right .dropdown-item:hover {
    background: var(--bg);
}

.topbar-right .dropdown-item.danger {
    color: var(--danger);
}

#content {
    padding: 24px;
    flex: 1;
}


/* ═══════════════════════════════════════════
   5. PAGE HEADER (used on every module page)
═══════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.page-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* Section label (used in dashboard + module pages) */
.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    margin-bottom: 12px;
}


/* ═══════════════════════════════════════════
   6. CARD
═══════════════════════════════════════════ */
.admin-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.admin-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-card-header h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.admin-card-body {
    padding: 20px;
}


/* ═══════════════════════════════════════════
   7. SEARCH BAR (consistent across all modules)
═══════════════════════════════════════════ */
.search-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.search-bar .form-control {
    max-width: 260px;
}


/* ═══════════════════════════════════════════
   8. DATA LIST (Bootstrap rows instead of tables)
═══════════════════════════════════════════ */
.data-list {
    overflow: hidden;
}

.data-list-header {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}

.data-list-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: background var(--transition);
    gap: 8px;
}

.data-list-row:last-child {
    border-bottom: none;
}

.data-list-row:hover {
    background: var(--row-hover);
}

.data-list-row .row-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.sortable-col {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sort-icon {
    font-size: 0.8em;
    margin-left: 4px;
}

.sort-icon.text-muted {
    opacity: 0.4;
}

/* ═══════════════════════════════════════════
   9. BUTTONS
═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
    border: 1px solid;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    opacity: .9;
    color: #fff;
    text-decoration: none;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: .9;
    color: #fff;
    text-decoration: none;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    opacity: .9;
    color: #fff;
    text-decoration: none;
}

.btn-light {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-light:hover {
    background: var(--border-light);
    color: var(--text);
    text-decoration: none;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon {
    padding: 6px;
    border-radius: 6px;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Spinner inside button (via _setCvrBtn) */
.btn>span.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}


/* ═══════════════════════════════════════════
   10. BADGES
═══════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge-gray {
    background: var(--gray-bg);
    color: var(--gray-text);
}

.badge-primary {
    background: var(--primary-subtle);
    color: var(--primary);
}


/* ═══════════════════════════════════════════
   11. FORMS
═══════════════════════════════════════════ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-control {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--surface);
    color: var(--text);
}
select.form-control {
    appearance: button;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
    color: var(--text-light);
}

/* Field-level error (from _setError) */
.error-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}


/* ═══════════════════════════════════════════
   12. MODAL
═══════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp .25s ease;
    margin: 20px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}


/* ═══════════════════════════════════════════
   13. TOAST
═══════════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    padding: 8px;
    pointer-events: none;
    /* Allow clicks to pass through to buttons under the container */
}

.toast {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    max-width: 260px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastIn .3s ease;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    /* Restore clicks for the toasts themselves */
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--info);
}


/* ═══════════════════════════════════════════
   14. PAGINATION
═══════════════════════════════════════════ */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: all var(--transition);
}

.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: .4;
    cursor: not-allowed;
}


/* ═══════════════════════════════════════════
   15. DASHBOARD STAT CARDS
═══════════════════════════════════════════ */
.dash-hello {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.dash-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 16px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow var(--transition), transform .15s;
    border-left: 4px solid var(--card-accent, var(--primary));
    height: 100%;
}

.dash-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text);
    text-decoration: none;
}

.dash-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--primary-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--card-accent, var(--primary));
    flex-shrink: 0;
    /* Per-card accent background set via inline style on icon wrapper */
}

.dash-stat-body {
    flex: 1;
    min-width: 0;
}

.dash-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.dash-stat-total {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.dash-stat-sub {
    display: flex;
    gap: 10px;
    font-size: 11px;
    margin-top: 2px;
}

.ds-active {
    color: var(--success);
}

.ds-inactive {
    color: var(--danger);
}

/* Loading spinner */
.dash-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto;
}


/* ═══════════════════════════════════════════
   16. MOBILE SIDEBAR
═══════════════════════════════════════════ */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 99;
}

#sidebar-overlay.show {
    display: block;
}

.sidebar-toggle,
.sidebar-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.sidebar-close {
    color: var(--sidebar-text);
    margin-left: auto;
}

.sidebar-toggle:hover {
    background: var(--bg);
}


/* ═══════════════════════════════════════════
   17. UTILITY
═══════════════════════════════════════════ */
.text-muted {
    color: var(--text-muted) !important;
}

.text-sm {
    font-size: 12px;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 16px;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 16px;
}

.gap-2 {
    gap: 8px;
}

.thumb-sm {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.thumb-md {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
}

/* Avatar initials */
.avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-subtle);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Generic spinner (for btn or page) */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}


/* ═══════════════════════════════════════════
   18. GRID (legacy — use Bootstrap row/col where possible)
═══════════════════════════════════════════ */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.max-w-100 {
    width: 100px;
}

.home-container{
    width: 1000px;
    margin: auto;
}

/* ═══════════════════════════════════════════
   19. ANIMATIONS
═══════════════════════════════════════════ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastIn {
    0% {
        transform: translateX(20px);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════
   18. RESPONSIVE UTILITIES
═══════════════════════════════════════════ */
@media (max-width: 991px) {
    .hideWeb {
        display: block !important;
    }

    .title {
        font-weight: 700;
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
        margin-bottom: 2px;
    }

    /* Grid labeling for mobile (Label left, value right) */
    .myrow .row>[class*="col-"] {
        display: flex;
        align-items: center;
        margin-bottom: 8px;
    }

    .myrow .hideWeb.title {
        width: 33.333333%;
        /* Match col-4 */
        margin-bottom: 0;
        padding-right: 10px;
    }

    .myrow .col-6.col-lg-12,
    .myrow .col-lg-12 {
        flex: 1;
    }

    .hideMob {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .hideWeb {
        display: none !important;
    }
}

.myrow {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.myrow:hover {
    background: var(--row-hover);
}

.myrow:last-child {
    border-bottom: none;
}


/* ═══════════════════════════════════════════
   21. DASHBOARD BUTTONS
   Used in home.php for authenticated users
═══════════════════════════════════════════ */
.dash-btn {
    background: #fff;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    cursor: pointer;
}

.dash-btn:hover {
    transform: translateY(-10px);
    box-shadow: 0 1rem 3rem rgba(0,0,0,.175)!important;
    border-color: var(--primary);
}

.dash-btn i {
    transition: transform 0.3s ease;
}

.dash-btn:hover i {
    transform: scale(1.1);
}

.transition-all {
    transition: all 0.3s ease;
}

@media (max-width: 767px) {
    #sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        /* Increased to ensure it covers content */
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #main {
        margin-left: 0 !important;
    }

    #content {
        padding: 16px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {

    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr 1fr;
    }
}