/* ============================================================
   Online Shop — Product Ordering & Delivery System
   Premium Mobile-First Responsive Theme
   ============================================================ */

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

/* ---- CSS Custom Properties ---- */
:root,
[data-theme="dark"] {
    --bg-primary: #0b1120;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-card-hover: #1e2a3a;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --bg-input: #0f1923;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;

    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);

    --accent: #06d6a0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="light"],
[data-theme="light"],
body.light-theme {
    --bg-primary: #f4f6fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-glass: rgba(15, 23, 42, 0.04);
    --bg-glass-hover: rgba(15, 23, 42, 0.08);
    --bg-input: #ffffff;

    --border-color: #e2e8f0;
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #0f172a;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.09), 0 4px 10px rgba(15, 23, 42, 0.04);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.12);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}

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

/* ============================================================
   LAYOUT — App Shell
   ============================================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh; /* Modern dynamic viewport height for mobile browsers */
    max-height: 100%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo .logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1 1 auto;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 12px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

.nav-link .nav-icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link .badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 16px;
    padding-bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 20px));
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    margin-top: auto;
}

.sidebar-footer .nav-link {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.22);
    font-weight: 600;
    justify-content: center;
}

.sidebar-footer .nav-link:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: var(--shadow-sm);
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

/* ---- Top Bar ---- */
.top-bar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: rgba(11, 17, 32, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 900;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.hamburger:hover {
    background: var(--bg-glass-hover);
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-white);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-top-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.28);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-top-logout:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: var(--shadow-sm);
}

/* ---- Page Content ---- */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ---- Overlay for mobile sidebar ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(4px);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: var(--shadow-glow);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Glass Card ---- */
.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

/* ---- Stat Card ---- */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.primary::before { background: var(--gradient-primary); }
.stat-card.success::before { background: var(--gradient-success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.accent::before  { background: var(--gradient-accent); }
.stat-card.danger::before  { background: var(--danger); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 14px;
}

.stat-card.primary .stat-icon { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.stat-card.success .stat-icon { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-card.accent .stat-icon  { background: rgba(6, 214, 160, 0.15); color: var(--accent); }
.stat-card.danger .stat-icon  { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    color: #fff;
}

.btn-success {
    background: var(--gradient-success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

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

.btn-outline:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 12px 12px !important;
    padding-right: 38px;
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table thead th {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger  { background: rgba(239, 68, 68, 0.15);  color: var(--danger); }
.badge-info    { background: rgba(59, 130, 246, 0.15);  color: var(--info); }
.badge-primary { background: rgba(99, 102, 241, 0.15);  color: var(--primary-light); }
.badge-accent  { background: rgba(6, 214, 160, 0.15);   color: var(--accent); }
.badge-muted   { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================================
   ORDER STATUS STEPPER
   ============================================================ */
.status-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 16px 0;
    overflow-x: auto;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 80px;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    z-index: 1;
    transition: all var(--transition);
}

.step.active .step-circle {
    background: var(--gradient-primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.step.done .step-circle {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.step-label {
    margin-top: 8px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

.step.active .step-label,
.step.done .step-label {
    color: var(--text-primary);
}

.step-line {
    position: absolute;
    top: 16px;
    left: calc(50% + 20px);
    right: calc(-50% + 20px);
    height: 2px;
    background: var(--border-color);
}

.step.done .step-line {
    background: var(--success);
}

.step:last-child .step-line {
    display: none;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-white);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   PRODUCT CARDS
   ============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.3);
}

.product-card .product-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary-light);
}

.product-card .product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card .product-info {
    padding: 14px;
}

.product-card .product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 4px;
}

.product-card .product-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent);
}

.product-card .product-actions {
    padding: 0 14px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Quantity Selector ---- */
.qty-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.qty-selector button {
    width: 34px;
    height: 34px;
    background: var(--bg-glass);
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-selector button:hover {
    background: var(--bg-glass-hover);
}

.qty-selector .qty-value {
    width: 40px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    padding: 6px 0;
}

/* ============================================================
   ORDER CARDS (Provider Dashboard)
   ============================================================ */
.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 12px;
    transition: all var(--transition);
    cursor: pointer;
}

.order-card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: var(--shadow-md);
}

.order-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.order-number {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-light);
}

.order-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.order-customer {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.order-items-summary {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

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

.order-total {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

/* ============================================================
   LOGIN / AUTH PAGES
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
}

.auth-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6, 214, 160, 0.08) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    position: relative;
    z-index: 1;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 14px;
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.auth-logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-card .divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.auth-card .divider::before,
.auth-card .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* ============================================================
   ALERTS / TOASTS
   ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.alert-success { background: rgba(16, 185, 129, 0.12); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-danger  { background: rgba(239, 68, 68, 0.12);  color: var(--danger);  border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.alert-info    { background: rgba(59, 130, 246, 0.12);  color: var(--info);    border: 1px solid rgba(59, 130, 246, 0.2); }

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 280px;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-danger  { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

/* ============================================================
   LOADING
   ============================================================ */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 17, 32, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 9999;
}

.loading-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* New order pulse */
.pulse-new {
    animation: pulse 2s infinite;
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-white  { color: var(--text-white); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.flex-wrap { flex-wrap: wrap; }

.w-100 { width: 100%; }

.hidden { display: none !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
}

/* Screenshot preview */
.screenshot-preview {
    max-width: 300px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform var(--transition);
}

.screenshot-preview:hover {
    transform: scale(1.02);
}

/* File upload area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-area .upload-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.upload-area .upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    max-width: 220px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70%  { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* ============================================================
   RESPONSIVE — Mobile First
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom, 24px);
    }

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

    .sidebar-footer {
        padding-bottom: max(34px, calc(env(safe-area-inset-bottom, 0px) + 30px));
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: flex;
    }

    .top-logout-text {
        display: none;
    }

    .btn-top-logout {
        padding: 5px 8px;
        font-size: 0.85rem;
    }

    .page-content {
        padding: 16px;
    }

    .top-bar {
        padding: 0 14px;
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .filter-bar .form-control {
        max-width: 100%;
        flex: 1;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .modal {
        margin: 10px;
        max-height: 95vh;
    }

    .user-name,
    .user-role {
        display: none;
    }

    .table {
        font-size: 0.78rem;
    }

    .table thead th,
    .table tbody td {
        padding: 8px 10px;
    }

    .status-stepper {
        gap: 0;
    }

    .step-label {
        font-size: 0.58rem;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .order-card-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (min-width: 1200px) {
    html {
        font-size: 15px;
    }
}

/* ---- Pagination Styles ---- */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination-item:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
    border-color: rgba(255, 255, 255, 0.2);
}

.pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.pagination-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---- Store Status & Opacity Utilities ---- */
.opacity-75 { opacity: 0.75; }
.opacity-50 { opacity: 0.5; }

/* ============================================================
   LIGHT THEME OVERRIDES & COMPONENT STYLING
   ============================================================ */
[data-theme="light"] .top-bar {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sidebar {
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .page-title {
    color: #0f172a;
}

[data-theme="light"] .table thead th {
    background: #f8fafc;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .table tbody tr:hover {
    background: #f8fafc;
}

[data-theme="light"] .table tbody td {
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .form-control {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

[data-theme="light"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 12px 12px !important;
}

[data-theme="light"] .card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .card-header {
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .card-header h3 {
    color: #0f172a;
}

[data-theme="light"] .card-footer {
    border-top: 1px solid #f1f5f9;
}

[data-theme="light"] .stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .stat-card:hover {
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .stat-card .stat-value {
    color: #0f172a;
}

[data-theme="light"] .auth-page {
    background: #f1f5f9;
}

[data-theme="light"] .auth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .modal {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.14);
}

[data-theme="light"] .modal-header {
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .modal-header h3 {
    color: #0f172a;
}

[data-theme="light"] .modal-footer {
    border-top: 1px solid #f1f5f9;
}

[data-theme="light"] .toast {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .pagination-item {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

[data-theme="light"] .pagination-item:hover:not(.disabled):not(.active) {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

[data-theme="light"] .pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

[data-theme="light"] .qty-selector {
    border-color: #cbd5e1;
    background: #ffffff;
}

[data-theme="light"] .qty-selector button {
    background: #f8fafc;
    color: #0f172a;
}

[data-theme="light"] .qty-selector button:hover {
    background: #e2e8f0;
}

[data-theme="light"] .qty-selector .qty-value {
    color: #0f172a;
    border-left: 1px solid #cbd5e1;
    border-right: 1px solid #cbd5e1;
}

[data-theme="light"] .upload-area {
    border-color: #cbd5e1;
    background: #f8fafc;
}

[data-theme="light"] .upload-area:hover,
[data-theme="light"] .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}

[data-theme="light"] .loading-overlay {
    background: rgba(248, 250, 252, 0.9);
}

[data-theme="light"] .loading-text {
    color: #334155;
}

[data-theme="light"] .step-circle {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
}

[data-theme="light"] .step.active .step-circle {
    background: var(--gradient-primary);
    border-color: var(--primary);
    color: #ffffff;
}

[data-theme="light"] .step.done .step-circle {
    background: var(--success);
    border-color: var(--success);
    color: #ffffff;
}

[data-theme="light"] .step-line {
    background: #cbd5e1;
}

[data-theme="light"] .product-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .product-card .product-name {
    color: #0f172a;
}

[data-theme="light"] .order-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .order-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .order-customer {
    color: #0f172a;
}

[data-theme="light"] .btn-outline {
    border-color: #cbd5e1;
    color: #334155;
}

[data-theme="light"] .btn-outline:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: var(--primary);
}

[data-theme="light"] .user-info {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .user-name {
    color: #0f172a;
}

[data-theme="light"] .nav-link {
    color: #475569;
}

[data-theme="light"] .nav-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

[data-theme="light"] .nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* ============================================================
   THEME TOGGLE BUTTON & PREFERENCE CARDS
   ============================================================ */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    line-height: 1;
}

.theme-toggle-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
}

.theme-toggle-text {
    font-size: 0.8rem;
    font-weight: 600;
}

/* Theme Mode Card Selector (Admin, Provider, Customer) */
.theme-mode-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    user-select: none;
}

.theme-mode-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.theme-mode-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.theme-mode-card strong {
    color: var(--text-primary);
}

[data-theme="light"] .theme-mode-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .theme-mode-card:hover {
    border-color: var(--primary-light);
    background: #f8fafc;
}

[data-theme="light"] .theme-mode-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.15);
}

@media (max-width: 600px) {
    .theme-toggle-text {
        display: none;
    }
    .theme-toggle-btn {
        padding: 6px 10px;
    }
}

/* ============================================================
   ORDER CHAT SYSTEM STYLES
   ============================================================ */
#orderChatModal {
    z-index: 2500;
    align-items: center;
    justify-content: center;
}

.chat-modal-dialog {
    max-width: 580px;
    width: 95%;
    display: flex;
    flex-direction: column;
    height: min(85vh, 680px);
    max-height: calc(100dvh - 32px);
    max-height: calc(100svh - 32px);
    padding: 0;
    overflow: hidden;
    margin: auto;
    border-radius: var(--radius-xl);
}

.chat-header {
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.chat-header-info h4 {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.chat-timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.chat-timer-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}

.chat-timer-badge.expired {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.chat-messages-container {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-secondary);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.chat-notice-banner {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    text-align: center;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--text-secondary);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.chat-notice-banner.expired {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.chat-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.chat-bubble-wrap.me {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-bubble-wrap.other {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-sender-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 3px;
    padding: 0 4px;
}

.chat-bubble {
    padding: 10px 15px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-bubble-wrap.me .chat-bubble {
    background: var(--gradient-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-bubble-wrap.other .chat-bubble {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

[data-theme="light"] .chat-bubble-wrap.other .chat-bubble {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}

.chat-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 3px;
    padding: 0 4px;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
    margin: auto;
}

.chat-empty-state .icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.chat-composer {
    padding: 14px 18px;
    padding-bottom: max(14px, calc(10px + env(safe-area-inset-bottom, 0px)));
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.chat-input {
    flex: 1;
    border-radius: 22px;
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition);
    resize: none;
    height: 42px;
    min-height: 42px;
    max-height: 90px;
    line-height: 1.35;
    font-family: inherit;
    box-sizing: border-box;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.chat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-card);
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   ORDER CHAT NOTIFICATION BADGES & MOBILE OPTIMIZATIONS
   ============================================================ */
.chat-unread-asterisk {
    color: #ef4444 !important;
    font-weight: 900 !important;
    font-size: 1.35em !important;
    line-height: 0 !important;
    vertical-align: super !important;
    margin-left: 2px !important;
    display: inline-block;
    text-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
    animation: chatPulse 1.8s infinite ease-in-out;
}

.chat-nav-asterisk {
    color: #ef4444 !important;
    font-weight: 900 !important;
    font-size: 1.25em !important;
    line-height: 0 !important;
    vertical-align: super !important;
    margin-left: 1px !important;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.9);
    animation: chatPulse 1.8s infinite ease-in-out;
}

.nav-asterisk-blink,
.invoice-nav-asterisk {
    color: #ef4444 !important;
    font-weight: 900 !important;
    font-size: 1.35em !important;
    line-height: 0 !important;
    vertical-align: super !important;
    margin-left: 2px !important;
    display: inline-block;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.95);
    animation: navAsteriskBlink 1.2s infinite ease-in-out;
}

.chat-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    margin-left: 4px;
    vertical-align: middle;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    animation: chatPulse 2s infinite ease-in-out;
}

@keyframes chatPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.35);
        opacity: 0.85;
    }
}

@keyframes navAsteriskBlink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        text-shadow: 0 0 10px rgba(239, 68, 68, 1);
    }
    50% {
        opacity: 0.15;
        transform: scale(1.4);
        text-shadow: 0 0 2px rgba(239, 68, 68, 0.3);
    }
}

/* Password input wrapper with toggle button */
.input-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-password-wrap .form-control {
    padding-right: 42px;
}

.btn-toggle-pw {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.05rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.btn-toggle-pw:hover {
    color: var(--text-primary);
}

/* Enhanced Mobile / Phone Viewport Adaptations */
@media (max-width: 640px) {
    #orderChatModal {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .chat-modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        height: 94dvh !important;
        height: 94svh !important;
        max-height: 94dvh !important;
        max-height: 94svh !important;
        margin: auto 0 0 0 !important;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .chat-header {
        padding: 12px 16px;
        flex-shrink: 0;
    }

    .chat-header-info h4 {
        font-size: 0.95rem;
    }

    .chat-header-sub {
        font-size: 0.72rem;
    }

    .chat-messages-container {
        padding: 12px;
        gap: 10px;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }

    .chat-bubble-wrap {
        max-width: 88%;
    }

    .chat-bubble {
        padding: 9px 13px;
        font-size: 0.84rem;
    }

    .chat-composer {
        padding: 10px 14px;
        padding-bottom: max(14px, calc(12px + env(safe-area-inset-bottom, 0px))) !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        bottom: 0 !important;
        background: var(--bg-card) !important;
        z-index: 20 !important;
        box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.18);
    }

    .chat-input {
        padding: 10px 14px;
        font-size: 0.88rem;
    }

    .chat-send-btn {
        width: 40px;
        height: 40px;
        font-size: 1.05rem;
    }

    /* Mobile Orders Table / List Optimization */
    .table-responsive {
        border-radius: var(--radius-md);
        margin-bottom: 12px;
    }

    .table th, .table td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }
}

/* ============================================================
   CHAT ORDER PRODUCTS BAR (Upper Part of Chatbox)
   ============================================================ */
.chat-order-products-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

[data-theme="light"] .chat-order-products-bar {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.chat-products-scroll {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.chat-products-scroll::-webkit-scrollbar {
    height: 4px;
}

.chat-products-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-prod-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 6px 12px 6px 8px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

[data-theme="light"] .chat-prod-pill {
    background: #ffffff;
    border-color: #e2e8f0;
}

.chat-prod-thumb {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.chat-prod-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.chat-prod-qty-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1.5px solid var(--bg-card);
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.chat-prod-details {
    display: flex;
    flex-direction: column;
    max-width: 170px;
}

.chat-prod-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-prod-meta {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
}

@media (max-width: 640px) {
    .chat-order-products-bar {
        padding: 8px 12px;
    }
    .chat-prod-pill {
        padding: 4px 10px 4px 6px;
        gap: 6px;
    }
    .chat-prod-thumb {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    .chat-prod-name {
        font-size: 0.74rem;
        max-width: 120px;
    }
    .chat-prod-meta {
        font-size: 0.68rem;
    }
}



