/* ================================================================
   ZETTA POS - Mobile-First CSS
   ================================================================
   Breakpoints:
   - Mobile: default (< 600px)
   - Tablet: 600px - 1023px
   - Desktop: 1024px+
   ================================================================ */

/* ================================================================
   1. DESIGN TOKENS (CSS Variables)
   ================================================================ */
:root {
    /* Brand Colors */
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;

    /* Status Colors */
    --success: #22C55E;
    --success-light: #DCFCE7;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;

    /* Neutral Colors */
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    /* Text Colors */
    --text: #1E293B;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;

    /* Sidebar (Desktop) */
    --sidebar-bg: #0F172A;
    --sidebar-text: #94A3B8;
    --sidebar-active: var(--primary);

    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Touch Targets */
    --touch-min: 44px;
    --touch-recommended: 48px;

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

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', var(--font-sans);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-toast: 600;

    /* Safe Areas (iOS) */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

/* ================================================================
   2. CSS RESET & BASE
   ================================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height */
    overflow-x: hidden;
}

/* Prevent iOS zoom on inputs */
input,
select,
textarea {
    font-size: 16px;
}

button {
    font-family: inherit;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Offline Indicator */
.offline-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    z-index: var(--z-toast);
    gap: var(--space-xs);
    align-items: center;
    justify-content: center;
}

.offline-indicator i {
    font-size: 1rem;
}

body.offline .offline-indicator {
    display: flex;
}

body.offline .app-container {
    padding-top: 40px;
}

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

/* ================================================================
   3. TYPOGRAPHY
   ================================================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--text);
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

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

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

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-primary {
    color: var(--primary);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* ================================================================
   4. LAYOUT - MOBILE FIRST
   ================================================================ */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Hide sidebar on mobile */
.sidebar {
    display: none;
}

/* Main content takes full width on mobile */
.main-content {
    flex: 1;
    padding: var(--space-md);
    padding-bottom: calc(80px + var(--safe-area-bottom));
    /* Space for bottom nav */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Section visibility */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* ================================================================
   5. BOTTOM NAVIGATION (Mobile)
   ================================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: var(--space-sm) 0;
    padding-bottom: calc(var(--space-sm) + var(--safe-area-bottom));
    z-index: var(--z-fixed);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    min-height: var(--touch-min);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

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

.bottom-nav-item:active {
    transform: scale(0.95);
}

/* ================================================================
   6. BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: var(--touch-min);
    padding: var(--space-sm) var(--space-lg);
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border-light);
    color: var(--text);
}

.btn-success {
    background: var(--success);
    color: var(--text-inverse);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
}

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

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

.btn-sm {
    min-height: 36px;
    padding: var(--space-xs) var(--space-md);
    font-size: 0.875rem;
}

.btn-lg {
    min-height: 56px;
    padding: var(--space-md) var(--space-xl);
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: var(--touch-min);
    height: var(--touch-min);
    padding: 0;
    border-radius: var(--radius-md);
}

/* ================================================================
   7. FORM INPUTS
   ================================================================ */
.form-group {
    margin-bottom: var(--space-md);
}

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

.form-input {
    width: 100%;
    min-height: var(--touch-min);
    padding: var(--space-sm) var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    transition: var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

/* Input with icon */
.input-group {
    position: relative;
}

.input-group .form-input {
    padding-left: 44px;
}

.input-group-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

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

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: var(--transition-normal);
    border-radius: var(--radius-full);
}

.switch .slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-normal);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

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

.switch input:checked+.slider::before {
    transform: translateX(24px);
}

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

/* ================================================================
   8. CARDS
   ================================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.card-elevated {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

/* ================================================================
   8b. ACCORDION COMPONENT
   ================================================================ */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.accordion {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    min-height: 56px;
}

.accordion-header:active {
    background: var(--border-light);
}

.accordion-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    color: var(--text);
}

.accordion-title i {
    font-size: 1.25rem;
    color: var(--primary);
}

.accordion-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}

.accordion.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
    padding: 0 var(--space-md);
}

.accordion.open .accordion-content {
    max-height: 800px;
    padding: var(--space-md);
    padding-top: var(--space-sm);
    overflow: visible;
}

/* Settings Toggle Row */
.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.settings-toggle:last-child {
    border-bottom: none;
}

/* Stat Card */
/* Dashboard Stats Grid */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.dashboard-stat {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    border-left: 4px solid transparent;
}

.dashboard-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.dashboard-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Color Variants */
.dashboard-stat.primary {
    border-left-color: var(--primary);
}

.dashboard-stat.primary .dashboard-stat-value {
    color: var(--primary);
}

.dashboard-stat.success {
    border-left-color: var(--success);
}

.dashboard-stat.success .dashboard-stat-value {
    color: var(--success);
}

.dashboard-stat.info {
    border-left-color: #3b82f6;
}

.dashboard-stat.info .dashboard-stat-value {
    color: #3b82f6;
}

.dashboard-stat.purple {
    border-left-color: #a855f7;
}

.dashboard-stat.purple .dashboard-stat-value {
    color: #a855f7;
}

.dashboard-stat.warning {
    border-left-color: var(--warning);
    background: var(--warning-light);
}

.dashboard-stat.warning .dashboard-stat-value {
    color: var(--warning);
}

.dashboard-stat.warning i {
    color: var(--warning);
    font-size: 1.25rem;
}

.dashboard-stat.neutral {
    border-left-color: var(--border);
}

.dashboard-stat.neutral .dashboard-stat-value {
    color: var(--text);
}

/* Alert stat pulse animation */
.dashboard-stat.alert-stat.has-alerts {
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {

    0%,
    100% {
        background: var(--warning-light);
    }

    50% {
        background: rgba(245, 158, 11, 0.2);
    }
}

/* Dashboard Cards */
.dashboard-card {
    margin-bottom: var(--space-md);
}

.dashboard-list {
    max-height: 200px;
    overflow-y: auto;
}

.alert-card {
    border-left: 3px solid var(--warning);
}

/* Legacy stat-card (keep for compatibility) */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

/* ================================================================
   9. CHIPS / PILLS
   ================================================================ */
.chip-group {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: var(--space-xs) 0;
}

.chip-group::-webkit-scrollbar {
    display: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: var(--space-sm) var(--space-md);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

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

.chip:active {
    transform: scale(0.95);
}

/* ================================================================
   10. PRODUCT GRID (2 columns mobile)
   ================================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.product-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid var(--border-light);
    min-height: 120px;
    position: relative;
}

.product-card:active:not(.out-of-stock) {
    transform: scale(0.98);
    border-color: var(--primary);
}

.product-card:hover:not(.out-of-stock) {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

/* Out of Stock State */
.product-card.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--border-light);
}

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.product-card-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
    line-height: 1.3;
}

.product-stock-badge {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.product-stock-badge.low {
    background: var(--warning-light);
    color: var(--warning);
}

.product-stock-badge.out {
    background: var(--danger-light);
    color: var(--danger);
}

.product-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: auto;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-light);
}

.product-card-stock {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.product-add-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.product-add-btn:active {
    transform: scale(0.9);
}

.out-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--danger);
    text-transform: uppercase;
}

/* ================================================================
   11. BOTTOM SHEET (Cart)
   ================================================================ */
/* ================================================================
   11. STICKY CART BAR (Mobile)
   ================================================================ */
.sticky-cart-bar {
    display: flex;
    /* Visible on mobile */
    position: fixed;
    bottom: calc(60px + var(--safe-area-bottom));
    left: var(--space-md);
    right: var(--space-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(79, 70, 229, 0.3);
    z-index: var(--z-sticky);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.sticky-cart-bar:active {
    transform: scale(0.98);
}

.sticky-cart-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
}

.sticky-cart-left i {
    font-size: 1.25rem;
}

.sticky-cart-count {
    background: white;
    color: var(--primary);
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
}

.sticky-cart-total {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.sticky-cart-action {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.875rem;
    opacity: 0.9;
}

.sticky-cart-action i {
    font-size: 1.25rem;
}

/* ================================================================
   11b. CART DRAWER (Slide-up)
   ================================================================ */
.cart-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.cart-drawer-overlay.active {
    display: block;
    opacity: 1;
}

.cart-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
    z-index: var(--z-modal);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--transition-slow);
}

.cart-drawer.active {
    transform: translateY(0);
}

.cart-drawer-handle {
    display: flex;
    justify-content: center;
    padding: var(--space-sm) 0;
    cursor: pointer;
}

.cart-drawer-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
}

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md) var(--space-md);
}

.cart-drawer-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.cart-drawer-customer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    padding: 0 var(--space-md) var(--space-md);
}

.cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 var(--space-md);
    max-height: 30vh;
    min-height: 100px;
}

.cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    text-align: center;
}

.cart-empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.cart-drawer-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-light);
    padding-bottom: calc(var(--space-md) + var(--safe-area-bottom));
}

/* Cart Totals */
.cart-totals {
    margin-bottom: var(--space-md);
}

.cart-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
    color: var(--text-secondary);
}

.cart-totals-row.cart-grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    padding-top: var(--space-sm);
    margin-top: var(--space-sm);
    border-top: 2px solid var(--border);
}

.discount-input-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--border-light);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.discount-input {
    width: 60px;
    border: none;
    background: transparent;
    text-align: right;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.discount-input:focus {
    outline: none;
}

/* Payment Modes */
.payment-modes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.payment-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    min-height: 56px;
    background: var(--border-light);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.payment-mode-btn i {
    font-size: 1.25rem;
}

.payment-mode-btn.active {
    background: rgba(79, 70, 229, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* Checkout Button */
.checkout-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    min-height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.checkout-btn:active {
    transform: scale(0.98);
}

.checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================================
   12. CART ITEMS
   ================================================================ */
.cart-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.cart-item-price {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.qty-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-light);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.qty-btn:active {
    background: var(--primary);
    color: white;
    transform: scale(0.95);
}

.cart-item-qty {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.cart-item-total {
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

/* ================================================================
   13. TOTALS SECTION
   ================================================================ */
.totals {
    padding: var(--space-md) 0;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    font-size: 0.875rem;
}

.totals-row.total {
    font-size: 1.125rem;
    font-weight: 700;
    border-top: 1px solid var(--border);
    padding-top: var(--space-md);
    margin-top: var(--space-sm);
}

/* ================================================================
   14. PAYMENT MODES
   ================================================================ */
.payment-modes {
    display: flex;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

.payment-mode-btn {
    flex: 1;
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.payment-mode-btn.active {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary);
}

.payment-mode-btn i {
    font-size: 1.125rem;
}

/* ================================================================
   15. MODALS
   ================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

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

.modal {
    width: 100%;
    max-height: 90vh;
    background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
}

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

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.modal-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-light);
    padding-bottom: calc(var(--space-md) + var(--safe-area-bottom));
}

/* ================================================================
   16. TOAST NOTIFICATIONS
   ================================================================ */
.toast-container {
    position: fixed;
    top: var(--space-md);
    left: var(--space-md);
    right: var(--space-md);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    background: var(--text);
    color: var(--text-inverse);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    background: var(--success);
}

.toast.warning {
    background: var(--warning);
}

.toast.error {
    background: var(--danger);
}

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

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

/* ================================================================
   17. 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-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

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

/* ================================================================
   18. SEARCH BAR
   ================================================================ */
.search-bar {
    position: relative;
    margin-bottom: var(--space-md);
}

.search-bar input {
    width: 100%;
    min-height: var(--touch-recommended);
    padding: var(--space-sm) var(--space-md);
    padding-left: 44px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.search-bar i {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* ================================================================
   19. SECTION HEADER
   ================================================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ================================================================
   20. LIST ITEMS
   ================================================================ */
.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.list-item-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
}

.list-item-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-item-action {
    color: var(--text-muted);
}

/* ================================================================
   21. BADGES
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

/* ================================================================
   22. FLOATING ACTION BUTTON
   ================================================================ */
.fab {
    position: fixed;
    bottom: calc(90px + var(--safe-area-bottom));
    right: var(--space-md);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-sticky);
    cursor: pointer;
    transition: var(--transition-fast);
}

.fab:active {
    transform: scale(0.95);
    background: var(--primary-dark);
}

/* ================================================================
   23. HIDDEN UTILITY
   ================================================================ */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ================================================================
   24. TABLET STYLES (600px+)
   ================================================================ */
@media (min-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-md);
    }

    .modal {
        max-width: 500px;
        margin: auto;
        border-radius: var(--radius-xl);
    }

    .modal-overlay {
        align-items: center;
        justify-content: center;
        padding: var(--space-lg);
    }

    .bottom-sheet {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
    }

    .bottom-sheet.collapsed {
        transform: translateX(-50%) translateY(calc(100% - 80px));
    }

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

/* ================================================================
   25. DESKTOP STYLES (1024px+)
   ================================================================ */
@media (min-width: 1024px) {

    /* Show sidebar, hide bottom nav */
    .sidebar {
        display: flex;
        flex-direction: column;
        width: 260px;
        height: 100vh;
        background: var(--sidebar-bg);
        color: var(--sidebar-text);
        padding: var(--space-lg);
        position: fixed;
        left: 0;
        top: 0;
    }

    .bottom-nav {
        display: none;
    }

    /* Hide mobile cart on desktop */
    .sticky-cart-bar,
    .cart-drawer,
    .cart-drawer-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 260px;
        padding: var(--space-xl);
        padding-bottom: var(--space-xl);
    }

    /* Sidebar branding */
    .brand {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        margin-bottom: var(--space-xl);
    }

    .brand-logo {
        width: 40px;
        height: 40px;
        background: var(--primary);
        border-radius: var(--radius-md);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.25rem;
    }

    .brand-name {
        font-family: var(--font-display);
        font-size: 1.25rem;
        font-weight: 700;
        color: white;
    }

    .brand-name span {
        color: var(--primary-light);
    }

    /* Nav items */
    .nav-menu {
        flex: 1;
    }

    .nav-item {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        padding: var(--space-md);
        margin-bottom: var(--space-xs);
        border-radius: var(--radius-md);
        color: var(--sidebar-text);
        background: none;
        border: none;
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        transition: var(--transition-fast);
        width: 100%;
        text-align: left;
    }

    .nav-item:hover {
        background: rgba(255, 255, 255, 0.05);
        color: white;
    }

    .nav-item.active {
        background: var(--primary);
        color: white;
    }

    .nav-item i {
        font-size: 1.25rem;
        width: 24px;
    }

    /* Product grid - more columns */
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Billing split view */
    .billing-container {
        display: grid;
        grid-template-columns: 1fr 400px;
        gap: var(--space-xl);
        height: calc(100vh - 80px);
    }

    .billing-catalog {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .billing-cart {
        background: var(--surface);
        border-radius: var(--radius-lg);
        display: flex;
        flex-direction: column;
        box-shadow: var(--shadow-md);
    }

    /* Hide bottom sheet on desktop, show fixed cart */
    .bottom-sheet {
        display: none;
    }

    /* Modal centered */
    .modal {
        max-width: 600px;
        max-height: 80vh;
        border-radius: var(--radius-xl);
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* FAB hidden on desktop */
    .fab {
        display: none;
    }
}

/* ================================================================
   26. LARGE DESKTOP (1440px+)
   ================================================================ */
@media (min-width: 1440px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .billing-container {
        grid-template-columns: 1fr 450px;
    }

    .main-content {
        max-width: 1400px;
        margin-left: 260px;
        margin-right: auto;
    }
}

/* ================================================================
   27. PRINT STYLES
   ================================================================ */
@media print {

    /* Hide everything except receipt */
    .sidebar,
    .bottom-nav,
    .fab,
    .app-container,
    .offline-indicator,
    .toast-container,
    .sticky-cart-bar,
    .cart-drawer,
    .cart-drawer-overlay {
        display: none !important;
    }

    /* Show receipt modal */
    .modal-overlay#receiptModal {
        display: block !important;
        position: static !important;
        background: white !important;
    }

    .modal-overlay#receiptModal .modal {
        position: static !important;
        box-shadow: none !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .modal-overlay#receiptModal .modal-header,
    .modal-overlay#receiptModal .modal-footer {
        display: none !important;
    }

    .modal-overlay#receiptModal .modal-body {
        padding: 20px !important;
    }

    body {
        background: white !important;
        margin: 0;
        padding: 0;
    }

    /* Receipt typography for print */
    #receiptContent {
        font-size: 12pt !important;
        color: black !important;
        line-height: 1.4 !important;
    }

    #receiptContent * {
        color: black !important;
    }
}