/* ============================================================
   SwadPay Design System — Premium Food Ordering UI
   Inspired by wpecomus.com/food + Material 3 + Zomato/Swiggy
   ============================================================ */

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

/* ── CSS Custom Properties (Design Tokens) ───────────────────── */
:root {
    /* Brand Colors */
    --primary: #FF6B00;
    --primary-light: #FF8C38;
    --primary-dark: #E05E00;
    --primary-50: rgba(255, 107, 0, 0.08);
    --primary-100: rgba(255, 107, 0, 0.15);

    /* Food Type Colors */
    --veg: #4CAF50;
    --veg-bg: rgba(76, 175, 80, 0.1);
    --non-veg: #F44336;
    --non-veg-bg: rgba(244, 67, 54, 0.1);

    /* Semantic Colors */
    --success: #2ECC71;
    --warning: #F1C40F;
    --error: #E74C3C;
    --info: #3498DB;

    /* Rating */
    --star: #FFB800;
    --star-empty: #DADCE0;

    /* Surface & Background — Light Mode */
    --bg: #FAFAFA;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-shimmer: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);

    /* Text — Light Mode */
    --text-primary: #1A1A2E;
    --text-secondary: #6C7280;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;
    --text-link: #FF6B00;

    /* Borders */
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --border-focus: #FF6B00;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 8px 24px rgba(255, 107, 0, 0.12);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-xs: 0.6875rem;
    --font-sm: 0.8125rem;
    --font-base: 0.9375rem;
    --font-md: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 1.875rem;
    --font-4xl: 2.25rem;

    /* Transitions */
    --transition-fast: 0.15s ease-out;
    --transition-base: 0.25s ease-out;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index layers */
    --z-base: 1;
    --z-sticky: 10;
    --z-header: 100;
    --z-drawer: 200;
    --z-modal: 300;
    --z-toast: 400;

    /* Layout */
    --header-height: 56px;
    --tab-bar-height: 60px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --content-max-width: 480px;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg: #121212;
    --bg-card: #1E1E2E;
    --bg-elevated: #252540;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-shimmer: linear-gradient(90deg, #1e1e2e 25%, #2a2a40 50%, #1e1e2e 75%);

    --text-primary: #F1F1F1;
    --text-secondary: #A0A0B8;
    --text-tertiary: #6B6B80;
    --text-inverse: #1A1A2E;

    --border: #2E2E42;
    --border-light: #252540;

    --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 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 8px 24px rgba(255, 107, 0, 0.2);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-base);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

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

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
    outline: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: var(--font-4xl); }
h2 { font-size: var(--font-3xl); }
h3 { font-size: var(--font-2xl); }
h4 { font-size: var(--font-xl); }
h5 { font-size: var(--font-lg); }
h6 { font-size: var(--font-md); }

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-primary-brand { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-veg { color: var(--veg); }
.text-nonveg { color: var(--non-veg); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ── Layout Utilities ────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.relative { position: relative; }

/* ── App Shell ───────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: var(--content-max-width);
    margin: 0 auto;
    position: relative;
}

.app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--content-max-width);
    height: var(--header-height);
    padding-top: var(--safe-area-top);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    z-index: var(--z-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.app-header-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.app-header-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.app-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary-50);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: var(--font-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.app-header-avatar:hover {
    background: var(--primary-100);
    border-color: var(--primary);
    transform: scale(1.05);
}

.app-content {
    flex: 1;
    padding-top: calc(var(--header-height) + var(--safe-area-top));
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-area-bottom));
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Bottom Tab Bar ──────────────────────────────────────────── */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--content-max-width);
    height: var(--tab-bar-height);
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: var(--z-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-xs) var(--space-sm);
    color: var(--text-tertiary);
    font-size: var(--font-xs);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
    min-width: 56px;
    border-radius: var(--radius-md);
}

.tab-item:hover {
    color: var(--text-secondary);
}

.tab-item.active {
    color: var(--primary);
}

.tab-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

.tab-icon {
    font-size: 22px;
    line-height: 1;
    transition: transform var(--transition-fast);
}

.tab-item.active .tab-icon {
    transform: scale(1.1);
}

.tab-label {
    font-size: var(--font-xs);
    letter-spacing: 0.01em;
}

/* Cart badge on tab */
.tab-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: badgePop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Profile Drawer ──────────────────────────────────────────── */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: var(--z-drawer);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.drawer-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background: var(--bg-elevated);
    z-index: calc(var(--z-drawer) + 1);
    transition: right var(--transition-slow);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    overflow-y: auto;
}

.drawer-panel.open {
    right: 0;
}

.drawer-header {
    padding: var(--space-xl) var(--space-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
}

.drawer-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    font-size: var(--font-base);
    font-weight: 500;
    transition: background var(--transition-fast);
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    background: none;
}

.drawer-menu-item:hover {
    background: var(--primary-50);
}

.drawer-menu-item .mdi {
    font-size: 20px;
    color: var(--text-secondary);
    width: 24px;
    text-align: center;
}

.drawer-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-sm) 0;
}

/* Theme toggle inside drawer */
.theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
}

.theme-switch {
    position: relative;
    width: 50px;
    height: 28px;
    background: var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-base);
}

.theme-switch.dark {
    background: var(--primary);
}

.theme-switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.theme-switch.dark .theme-switch-knob {
    transform: translateX(22px);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all var(--transition-base);
}

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

.card-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.card-body {
    padding: var(--space-md);
}

/* ── Food Card ───────────────────────────────────────────────── */
.food-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

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

.food-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.food-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.food-card:hover .food-card-img {
    transform: scale(1.05);
}

.food-card-badge {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
}

.food-card-body {
    padding: var(--space-md);
}

.food-card-title {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.food-card-desc {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.food-card-price {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
}

.food-card-price .currency {
    font-size: var(--font-sm);
    font-weight: 600;
}

.food-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-sm);
}

/* ── Veg / Non-Veg Badge ────────────────────────────────────── */
.veg-badge,
.nonveg-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.veg-badge {
    background: var(--veg-bg);
    color: var(--veg);
    border: 1px solid var(--veg);
}

.nonveg-badge {
    background: var(--non-veg-bg);
    color: var(--non-veg);
    border: 1px solid var(--non-veg);
}

.veg-dot, .nonveg-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
}

.veg-dot { border-color: var(--veg); }
.nonveg-dot { border-color: var(--non-veg); }

.veg-dot::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--veg); }
.nonveg-dot::after { content: ''; width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 5px solid var(--non-veg); }

/* ── Category Pills ──────────────────────────────────────────── */
.category-pills {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding: var(--space-md) var(--space-md);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-pills::-webkit-scrollbar { display: none; }

.category-pill {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.category-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-pill.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    font-weight: 600;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-50);
}

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

.btn-ghost:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-sm);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-lg);
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

.btn-add {
    background: var(--primary);
    color: var(--text-inverse);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 6px rgba(255, 107, 0, 0.25);
}

.btn-add:hover {
    background: var(--primary-dark);
    transform: scale(1.03);
}

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

.qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-50);
    cursor: pointer;
    transition: background var(--transition-fast);
    border: none;
}

.qty-btn:hover {
    background: var(--primary-100);
}

.qty-value {
    min-width: 32px;
    text-align: center;
    font-size: var(--font-base);
    font-weight: 700;
    color: var(--primary);
    padding: 0 4px;
}

/* ── Inputs ──────────────────────────────────────────────────── */
.form-input {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    color: var(--text-primary);
    background: var(--bg-card);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

/* ── Rating Stars ────────────────────────────────────────────── */
.rating-stars {
    display: inline-flex;
    gap: 2px;
}

.rating-star {
    color: var(--star-empty);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.rating-star.filled {
    color: var(--star);
}

.rating-star:hover {
    transform: scale(1.15);
}

.rating-value {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--success);
    color: white;
    font-size: var(--font-xs);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* ── OTP / Pin Entry ─────────────────────────────────────────── */
.otp-container {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.otp-input {
    width: 52px;
    height: 56px;
    text-align: center;
    font-size: var(--font-2xl);
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    outline: none;
}

.otp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

.otp-input.filled {
    border-color: var(--primary);
    background: var(--primary-50);
}

/* ── Shimmer Loading ─────────────────────────────────────────── */
.shimmer {
    background: var(--bg-shimmer);
    background-size: 200% 100%;
    animation: shimmerAnim 1.5s infinite linear;
    border-radius: var(--radius-md);
}

.shimmer-circle {
    border-radius: var(--radius-full);
}

.shimmer-text {
    height: 14px;
    border-radius: var(--radius-sm);
}

.shimmer-text-lg {
    height: 20px;
    border-radius: var(--radius-sm);
}

/* ── Slide to Confirm ────────────────────────────────────────── */
.slide-confirm {
    position: relative;
    width: 100%;
    height: 56px;
    background: var(--primary-50);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.slide-confirm-track {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: var(--font-base);
    letter-spacing: 0.02em;
}

.slide-confirm-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: left var(--transition-fast);
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.4);
}

/* ── Toast / Snackbar ────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: calc(var(--tab-bar-height) + var(--space-lg));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-toast);
    opacity: 0;
    transition: all var(--transition-base);
    border-left: 4px solid var(--primary);
    max-width: calc(100vw - var(--space-xl) * 2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ── Modal / Popup ───────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-slow);
}

.modal-backdrop.show .modal-content {
    transform: scale(1) translateY(0);
}

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

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* ── Confirmation Dialog ─────────────────────────────────────── */
.confirmation-dialog {
    text-align: center;
    padding: var(--space-xl);
}

.confirmation-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
}

.confirmation-icon.success { color: var(--success); }
.confirmation-icon.warning { color: var(--warning); }
.confirmation-icon.error { color: var(--error); }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes shimmerAnim {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideInUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes badgePop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

@keyframes flyToCart {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(0.5); }
    100% { opacity: 0; transform: scale(0.1) translate(var(--fly-x, 100px), var(--fly-y, -200px)); }
}

/* Animation utilities */
.anim-fade-in { animation: fadeIn 0.3s ease-out; }
.anim-fade-in-up { animation: fadeInUp 0.4s ease-out; }
.anim-fade-in-down { animation: fadeInDown 0.4s ease-out; }
.anim-scale-in { animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.anim-slide-up { animation: slideInUp 0.4s ease-out; }
.anim-pulse { animation: pulse 2s ease-in-out infinite; }

/* Staggered animation for list items */
.stagger-item { animation: fadeInUp 0.4s ease-out both; }
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(n+7) { animation-delay: 0.35s; }

/* ── Loading Spinner ─────────────────────────────────────────── */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* ── Safe Area & Status Bar ──────────────────────────────────── */
.status-bar-safe-area {
    height: var(--safe-area-top);
    background: var(--bg-elevated);
}

/* ── Blazor Error Boundary ───────────────────────────────────── */
.blazor-error-boundary {
    background: var(--error);
    padding: var(--space-md) var(--space-lg);
    color: white;
    border-radius: var(--radius-md);
    margin: var(--space-md);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ── Validation ──────────────────────────────────────────────── */
.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--success);
}

.invalid {
    outline: none;
    border-color: var(--error) !important;
}

.validation-message {
    color: var(--error);
    font-size: var(--font-sm);
    margin-top: var(--space-xs);
}

/* ── Empty States ────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-desc {
    font-size: var(--font-base);
    color: var(--text-secondary);
    max-width: 280px;
}

/* ── Responsive Breakpoints ──────────────────────────────────── */
@media (min-width: 768px) {
    :root {
        --content-max-width: 480px;
    }
}

/* Desktop: Show centered mobile viewport */
@media (min-width: 1024px) {
    body {
        background: var(--bg);
    }

    .app-shell {
        box-shadow: var(--shadow-lg);
        border-left: 1px solid var(--border-light);
        border-right: 1px solid var(--border-light);
        min-height: 100vh;
    }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    .tab-bar, .app-header, .drawer-backdrop, .drawer-panel {
        display: none !important;
    }

    .app-content {
        padding: 0;
    }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

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