/* ===========================
   CSS Variables & Reset
   =========================== */
:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #C8E6C9;
    --secondary: #FF9800;
    --secondary-dark: #F57C00;
    --danger: #f44336;
    --danger-light: #FFEBEE;
    --success: #4CAF50;
    --success-light: #E8F5E9;
    --warning: #FFC107;
    --warning-light: #FFF8E1;
    --info: #2196F3;
    --info-light: #E3F2FD;
    --bg: #f0f4f0;
    --surface: #ffffff;
    --surface-alt: #f8faf8;
    --text: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.2s ease;
    --header-h: 64px;
    --sidebar-w: 250px;
    --admin-sidebar-w: 220px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }

/* ===========================
   Utility Classes
   =========================== */
.view { display: none; }
.view.active { display: block; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76,175,80,0.35);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #d32f2f;
    box-shadow: 0 4px 12px rgba(244,67,54,0.35);
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}
.btn-full {
    width: 100%;
}

.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--surface);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.12);
}
.form-group textarea {
    resize: vertical;
    min-height: 60px;
}
.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-error {
    color: var(--danger);
    font-size: 0.82rem;
    margin-top: 8px;
    text-align: center;
    min-height: 20px;
}
.admin-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===========================
   Logo
   =========================== */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-icon {
    font-size: 2rem;
}
.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-dark);
}
.logo-sm {
    gap: 6px;
}
.logo-sm span {
    font-size: 1.3rem;
}
.logo-sm h2 {
    font-size: 1.1rem;
    color: var(--primary-dark);
}

/* ===========================
   AUTH VIEW
   =========================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 30%, #a5d6a7 60%, #81c784 100%);
}
.auth-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
}
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.auth-header .logo {
    justify-content: center;
    margin-bottom: 6px;
}
.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-alt);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.auth-tab.active {
    background: var(--primary);
    color: #fff;
}

.auth-form {
    display: none;
}
.auth-form.active {
    display: block;
}

.role-select {
    margin-bottom: 20px;
}
.role-options {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.role-option {
    flex: 1;
}
.role-option input {
    display: none;
}
.role-label {
    display: block;
    text-align: center;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}
.role-option input:checked + .role-label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

/* ===========================
   HEADER
   =========================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.mobile-menu-btn {
    display: none;
    background: none;
    font-size: 1.4rem;
    color: var(--text);
}
.header-center {
    flex: 1;
    max-width: 500px;
}
.search-bar {
    display: flex;
    background: var(--surface-alt);
    border-radius: 24px;
    overflow: hidden;
    border: 1.5px solid var(--border-light);
    transition: border-color var(--transition);
}
.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}
.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-size: 0.9rem;
}
.search-bar button {
    background: var(--primary);
    color: #fff;
    padding: 10px 18px;
    font-size: 1rem;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.cart-btn {
    position: relative;
    background: var(--surface-alt);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition);
}
.cart-btn:hover { background: var(--primary-light); }
.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

/* ===========================
   USER LAYOUT
   =========================== */
.user-layout {
    display: flex;
    min-height: calc(100vh - var(--header-h));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    flex-shrink: 0;
    overflow-y: auto;
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 14px;
}
.sidebar-header h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-close {
    display: none;
    background: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
}
.category-list {
    padding: 0 10px;
}
.category-item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.category-item:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.category-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.sidebar-overlay {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.section-header h2 {
    font-size: 1.3rem;
}
.sort-options select {
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--surface);
    cursor: pointer;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.product-card .product-emoji {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 12px;
}
.product-card .product-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}
.product-card .product-unit {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.product-card .product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-card .product-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-dark);
}
.product-card .add-btn {
    background: var(--primary);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.product-card .add-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}
.product-card .stock-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--danger-light);
    color: var(--danger);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.product-card.out-of-stock {
    opacity: 0.6;
    pointer-events: none;
}
.no-results {
    display: none;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===========================
   CART SIDEBAR
   =========================== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.cart-sidebar.open {
    right: 0;
}
.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.cart-sidebar-header h3 {
    font-size: 1.1rem;
}
.cart-close {
    background: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-close:hover {
    background: var(--border-light);
}
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}
.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}
.cart-item-emoji {
    font-size: 2rem;
    flex-shrink: 0;
}
.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.cart-item-price {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-item-controls button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.cart-item-controls button:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.cart-item-qty {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 20px;
    text-align: center;
}
.cart-item-remove {
    color: var(--danger) !important;
    border-color: var(--danger-light) !important;
}

.cart-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}
.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
}
.cart-overlay.open {
    display: block;
}

/* ===========================
   MODALS
   =========================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 90%;
    max-width: 460px;
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
}
.modal-lg {
    max-width: 700px;
    text-align: left;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 {
    font-size: 1.2rem;
}
.modal-close {
    background: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: var(--border-light); }
.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}
.modal h2 {
    margin-bottom: 8px;
}
.modal p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* Enhanced Order History */
.order-date-group {
    margin-bottom: 20px;
}
.order-date-header {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 10px;
}
.order-card-enhanced {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.order-card-enhanced:hover {
    box-shadow: var(--shadow);
}
.order-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}
.order-card-id {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-dark);
}
.order-card-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 10px;
}
.order-items-list {
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
    margin-bottom: 8px;
}
.order-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.82rem;
}
.order-item-emoji {
    font-size: 1.2rem;
    flex-shrink: 0;
}
.order-item-detail {
    flex: 1;
    color: var(--text);
}
.order-item-price {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.order-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.order-payment-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.payment-badge {
    background: var(--surface-alt);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid var(--border);
}
.order-card-total {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-dark);
}
.buy-again-btn {
    flex-shrink: 0;
}
.buy-again-btn:hover {
    transform: scale(1.05);
}

/* Order Items in Modal (legacy) */
.order-card {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
}
.order-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.order-card-id {
    font-weight: 600;
}
.order-card-date {
    color: var(--text-muted);
}
.order-card-items {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.order-card-total {
    font-weight: 700;
    color: var(--primary-dark);
}
.order-card-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 6px;
}
.status-pending {
    background: var(--warning-light);
    color: #b45309;
}
.status-confirmed {
    background: var(--info-light);
    color: #1e40af;
}
.status-delivered {
    background: var(--success-light);
    color: #166534;
}
.status-cancelled {
    background: var(--danger-light);
    color: #991b1b;
}

/* ===========================
   FAB
   =========================== */
.fab-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 100;
}
.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.4rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.fab:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(76,175,80,0.4);
}

/* ===========================
   ADMIN STYLES
   =========================== */
.admin-header {
    background: #1a1a2e;
    color: #fff;
    border-bottom: 1px solid #2d2d44;
}
.admin-header .logo-sm h2 {
    color: #fff;
}
.admin-header .btn-outline {
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}
.admin-header .btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fff;
}
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-admin {
    background: var(--secondary);
    color: #fff;
}
.badge-gateway-type {
    font-size: 0.7rem;
    padding: 3px 10px;
    font-weight: 600;
}
.badge-gateway-type.type-upi {
    background: #e8e0ff;
    color: #6b21a8;
}
.badge-gateway-type.type-card {
    background: #e0f2fe;
    color: #075985;
}
.badge-gateway-type.type-netbanking {
    background: #fef3c7;
    color: #92400e;
}
code {
    background: var(--surface-alt);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--primary-dark);
}
.badge-status {
    font-size: 0.7rem;
    padding: 3px 10px;
}

.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--header-h));
}

/* Admin Sidebar */
.admin-sidebar {
    width: var(--admin-sidebar-w);
    background: #16213e;
    padding: 20px 0;
    flex-shrink: 0;
}
.admin-nav-item {
    padding: 13px 24px;
    font-size: 0.9rem;
    color: #94a3b8;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    margin: 2px 0;
}
.admin-nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
}
.admin-nav-item.active {
    background: rgba(76,175,80,0.15);
    color: var(--primary);
    border-left-color: var(--primary);
}

/* Admin Main */
.admin-main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f0f4f8;
}
.admin-panel {
    display: none;
}
.admin-panel.active {
    display: block;
}
.admin-panel h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
}
.admin-panel h3 {
    font-size: 1rem;
    margin: 24px 0 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    font-size: 2rem;
}
.stat-info h3 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--primary-dark);
}
.stat-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.panel-header h2 {
    margin-bottom: 0;
}

/* Tables */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.admin-table th {
    text-align: left;
    padding: 14px 16px;
    background: var(--surface-alt);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.admin-table tbody tr:hover {
    background: var(--surface-alt);
}
.admin-table .table-emoji {
    font-size: 1.5rem;
}
.table-actions {
    display: flex;
    gap: 6px;
}
.table-actions button {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all var(--transition);
}
.table-actions .btn-edit:hover {
    background: var(--info-light);
    border-color: var(--info);
    color: var(--info);
}
.table-actions .btn-delete:hover {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.status-select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    cursor: pointer;
    background: var(--surface);
}

/* ===========================
   PAYMENT MODAL
   =========================== */
.payment-modal {
    max-width: 500px !important;
    text-align: left !important;
}
.payment-modal .modal-header {
    margin-bottom: 16px;
}
.payment-modal .modal-header h2 {
    font-size: 1.1rem;
}

/* Payment Options */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.payment-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
}
.payment-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.payment-option:active {
    transform: scale(0.99);
}
.payment-option-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
}
.payment-option-info {
    flex: 1;
}
.payment-option-info h3 {
    font-size: 1rem;
    margin-bottom: 2px;
    color: var(--text);
}
.payment-option-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}
.payment-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: transform var(--transition);
}
.payment-option:hover .payment-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* Payment Form Container */
.payment-form-container {
    animation: fadeInUp 0.3s ease;
}
.payment-back {
    background: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 0;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.payment-back:hover {
    color: var(--primary-dark);
}
.payment-method-label {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Payment Tabs */
.form-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-alt);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.form-tab {
    flex: 1;
    padding: 8px 6px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 500;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
}
.form-tab.active {
    background: var(--primary);
    color: #fff;
}
.form-tab:hover:not(.active) {
    background: var(--border-light);
}

.payment-subform {
    display: none;
}
.payment-subform.active {
    display: block;
}

.upi-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin: 8px 0;
}

.payment-total-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    margin: 16px 0 12px;
    font-weight: 600;
    font-size: 1rem;
}
.payment-total-display span:last-child {
    color: var(--primary-dark);
    font-size: 1.2rem;
}

/* Payment Icons Row */
.payment-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    justify-content: center;
}
.payment-icons span {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--surface-alt);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Spinner */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   TOAST
   =========================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: var(--surface);
    color: var(--text);
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    pointer-events: all;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ===========================
   UPI QR CODE MODAL
   =========================== */
.upi-qr-modal {
    max-width: 420px !important;
    text-align: center !important;
}
.upi-qr-modal .modal-header {
    margin-bottom: 10px;
}
.upi-qr-modal .modal-header h2 {
    font-size: 1.1rem;
}

/* QR Timer Ring */
.qr-timer {
    margin-bottom: 16px;
}
.qr-timer-ring {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 6px;
}
.qr-timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.timer-bg {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 5;
}
.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 276.46;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.5s;
}
.timer-progress.warning {
    stroke: var(--warning);
}
.timer-progress.danger {
    stroke: var(--danger);
    animation: pulse 0.5s ease-in-out infinite alternate;
}
@keyframes pulse {
    from { stroke-opacity: 1; }
    to { stroke-opacity: 0.5; }
}
.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}
.timer-text.warning { color: #b45309; }
.timer-text.danger { color: var(--danger); }
.timer-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* QR Code Container */
.qr-code-container {
    margin-bottom: 14px;
}
.qr-code-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 12px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.qr-code-placeholder canvas {
    display: block;
    image-rendering: pixelated;
}
.qr-amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}
.qr-instruction {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0;
}

/* QR Gateway Info */
.qr-gateway-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface-alt);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.qr-gateway-info span:first-child {
    font-size: 1.3rem;
}
.qr-gateway-info span:nth-child(2) {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.qr-upi-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 2px 8px;
    border-radius: 12px;
    font-family: monospace;
}

/* QR Actions */
.qr-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.qr-actions button {
    flex: 1;
}
.qr-done-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.qr-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0;
}
.qr-note.expired {
    color: var(--danger);
    font-weight: 600;
}

/* ===========================
   LANDING PAGE
   =========================== */
.landing-hero {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #0f3460 60%, #1a1a2e 100%);
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}
.landing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234CAF50' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}
.landing-hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    padding: 40px 20px;
}
.landing-hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.landing-hero-content p {
    font-size: 1.2rem;
    color: #a0c4a8;
    margin-bottom: 28px;
    line-height: 1.6;
}
.hero-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: 30px;
}
.hero-badges {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.hero-badges span {
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

/* Landing Container */
.landing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}
.landing-section-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 32px;
    color: var(--text);
}

/* Features */
.landing-features {
    padding: 60px 0;
    background: var(--surface);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}
.feature-card {
    text-align: center;
    padding: 28px 20px;
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
    transition: all var(--transition);
    border: 1px solid var(--border-light);
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.feature-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}
.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}
.feature-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Landing Categories */
.landing-categories {
    padding: 60px 0;
    background: var(--bg);
}
.landing-cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
}
.landing-cat-card {
    text-align: center;
    padding: 20px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
}
.landing-cat-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}
.landing-cat-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
}
.landing-cat-card h3 {
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.landing-cat-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Landing Featured Products */
.landing-featured {
    padding: 60px 0;
    background: var(--surface);
}
.landing-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Landing Footer */
.landing-footer {
    background: #1a1a2e;
    color: #e2e8f0;
    padding: 40px 0 20px;
}
.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 24px;
}
.footer-brand h3 {
    font-size: 1.2rem;
    margin-bottom: 6px;
}
.footer-brand p {
    color: #94a3b8;
    font-size: 0.85rem;
}
.footer-links {
    display: flex;
    gap: 40px;
}
.footer-links h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
}
.footer-links a, .footer-links span {
    display: block;
    font-size: 0.82rem;
    color: #94a3b8;
    margin-bottom: 4px;
    cursor: pointer;
}
.footer-links a:hover {
    color: var(--primary);
}
.footer-bottom {
    border-top: 1px solid #2d2d44;
    padding-top: 16px;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

/* Landing responsive */
@media (max-width: 768px) {
    .landing-hero-content h1 { font-size: 2.2rem; }
    .landing-hero-content p { font-size: 1rem; }
    .landing-cats-grid { grid-template-columns: repeat(4, 1fr); }
    .footer-content { flex-direction: column; gap: 20px; }
    .btn-lg { padding: 12px 24px; font-size: 0.9rem; }
}

@media (max-width: 480px) {
    .landing-hero { min-height: 70vh; }
    .landing-hero-content h1 { font-size: 1.8rem; }
    .landing-cats-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .landing-cat-card { padding: 14px 10px; }
    .landing-cat-icon { font-size: 2rem; }
}

/* ===========================
   RESPONSIVE
   =========================== */

/* --- Large Screens (Wide Layouts) --- */
@media (min-width: 1440px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 24px;
    }
    .main-content { padding: 32px 40px; }
    .section-header h2 { font-size: 1.5rem; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .admin-main { padding: 32px 40px; }
}

/* --- Small Desktops / Tablets Landscape --- */
@media (max-width: 1280px) {
    .sidebar { width: 210px; }
    .admin-sidebar { width: 190px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
    .main-content { padding: 20px; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* --- Tablets (Portrait) / Small Laptops --- */
@media (max-width: 1024px) {
    .sidebar { width: 200px; }
    .admin-sidebar { width: 180px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .header { padding: 0 16px; }
    .search-bar { max-width: 320px; }
    .product-card { padding: 16px; }
    .product-card .product-emoji { font-size: 2.5rem; }
}

/* --- Phablets / Large Phones --- */
@media (max-width: 768px) {
    :root {
        --header-h: 60px;
    }

    .header {
        padding: 0 12px;
        gap: 8px;
        position: sticky;
        top: 0;
    }
    .header-center {
        display: none;
    }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: none;
        font-size: 1.5rem;
        color: var(--text);
        border-radius: 50%;
    }
    .mobile-menu-btn:active {
        background: var(--border-light);
    }
    .user-menu .user-name { display: none; }
    .user-menu .btn-sm { padding: 6px 10px; font-size: 0.75rem; }

    /* Mobile search (shown below header) */
    .header-search-mobile {
        display: flex !important;
        padding: 8px 12px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }
    .header-search-mobile .search-bar {
        width: 100%;
        max-width: 100%;
    }

    /* Mobile Sidebar Overlay */
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        z-index: 150;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open { left: 0; }
    .sidebar-close { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 149;
    }
    .sidebar-overlay.open { display: block; }

    /* User Layout */
    .user-layout {
        padding-bottom: 70px; /* space for mobile bottom nav */
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .main-content { padding: 14px; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .section-header h2 { font-size: 1.1rem; }
    .sort-options select { font-size: 0.8rem; padding: 7px 10px; }

    /* Cart Sidebar */
    .cart-sidebar {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }
    .cart-sidebar-header { padding: 16px 20px; }
    .cart-items { padding: 12px 16px; }
    .cart-footer { padding: 16px 20px; }

    /* Admin Layout */
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: #16213e;
    }
    .admin-sidebar::-webkit-scrollbar { display: none; }
    .admin-nav {
        display: flex;
        gap: 0;
        min-width: max-content;
    }
    .admin-nav-item {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 14px 18px;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .admin-nav-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary);
    }
    .admin-main { padding: 14px; }

    /* Stats */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }

    /* Tables */
    .table-container {
        margin: 0 -14px;
        border-radius: 0;
    }
    .admin-table { font-size: 0.78rem; }
    .admin-table th, .admin-table td { padding: 10px 12px; }

    /* Modals */
    .modal { padding: 24px 20px; max-width: 95vw; border-radius: var(--radius-lg); }
    .modal-lg { max-width: 95vw; }

    /* FAB */
    .fab-container { bottom: 80px; right: 16px; }
    .fab { width: 48px; height: 48px; font-size: 1.3rem; }

    /* Toast */
    .toast-container { top: 10px; right: 10px; left: 10px; }
    .toast { max-width: 100%; font-size: 0.85rem; }

    /* Hide desktop-only elements */
    .header-center { display: none; }
    .logo-sm h2 { font-size: 1rem; }
}

/* --- Mobile Phones --- */
@media (max-width: 600px) {
    :root {
        --header-h: 56px;
    }

    .header { padding: 0 10px; }
    .logo-sm span { font-size: 1.1rem; }
    .logo-sm h2 { font-size: 0.9rem; }
    .cart-btn { width: 36px; height: 36px; font-size: 1rem; }
    .cart-count { min-width: 16px; height: 16px; font-size: 0.6rem; top: -3px; right: -3px; }

    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .product-card { padding: 10px; border-radius: var(--radius); }
    .product-card .product-emoji { font-size: 2rem; margin-bottom: 8px; }
    .product-card .product-name { font-size: 0.82rem; }
    .product-card .product-unit { font-size: 0.7rem; }
    .product-card .product-price { font-size: 0.9rem; }
    .product-card .add-btn { width: 30px; height: 30px; font-size: 1.1rem; }
    .product-card .stock-badge { font-size: 0.62rem; padding: 2px 6px; top: 8px; right: 8px; }

    .main-content { padding: 10px; }
    .section-header { margin-bottom: 12px; }

    /* Auth */
    .auth-container { padding: 12px; }
    .auth-card { padding: 20px 16px; border-radius: var(--radius-lg); }
    .auth-header .logo-icon { font-size: 1.6rem; }
    .auth-header .logo h1 { font-size: 1.3rem; }
    .auth-tabs { margin-bottom: 16px; }
    .auth-tab { padding: 8px; font-size: 0.82rem; }
    .role-label { padding: 8px; font-size: 0.78rem; }

    .form-group input,
    .form-group select,
    .form-group textarea { padding: 9px 12px; font-size: 0.85rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 10px; gap: 8px; border-radius: var(--radius-sm); }
    .stat-icon { font-size: 1.3rem; }
    .stat-info h3 { font-size: 1.1rem; }
    .stat-info p { font-size: 0.7rem; }

    .admin-main { padding: 10px; }
    .admin-panel h2 { font-size: 1.1rem; margin-bottom: 12px; }
    .admin-nav-item { padding: 12px 14px; font-size: 0.75rem; }
    .panel-header { flex-direction: column; align-items: stretch; }
    .panel-header .btn { align-self: flex-start; }

    .table-container { margin: 0 -10px; }
    .admin-table { font-size: 0.72rem; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .table-actions { flex-direction: column; gap: 4px; }
    .table-actions button { font-size: 0.7rem; padding: 4px 8px; }

    .order-card { padding: 12px; }
    .cart-item { gap: 8px; padding: 10px 0; }
    .cart-item-emoji { font-size: 1.5rem; }
    .cart-item-controls button { width: 26px; height: 26px; font-size: 0.85rem; }
}

/* --- Small Phones --- */
@media (max-width: 400px) {
    .product-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .product-card { padding: 8px; }
    .product-card .product-emoji { font-size: 1.8rem; margin-bottom: 6px; }
    .product-card .product-name { font-size: 0.78rem; }
    .product-card .product-price { font-size: 0.85rem; }
    .product-card .add-btn { width: 28px; height: 28px; font-size: 1rem; }

    .auth-card { padding: 18px 14px; }
    .auth-tab { font-size: 0.78rem; padding: 7px; }
    .role-label { font-size: 0.72rem; padding: 7px; }
    .btn { padding: 8px 14px; font-size: 0.82rem; }

    .header { padding: 0 8px; }
    .logo-sm h2 { font-size: 0.85rem; }
    .cart-btn { width: 32px; height: 32px; }
    .fab { width: 44px; height: 44px; font-size: 1.2rem; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card { padding: 8px; gap: 6px; }
    .stat-icon { font-size: 1.2rem; }
    .stat-info h3 { font-size: 1rem; }

    .form-row { grid-template-columns: 1fr; gap: 0; }

    .admin-nav-item { padding: 10px 12px; font-size: 0.7rem; }
}

/* --- Landscape Orientation on Mobile --- */
@media (max-height: 500px) and (orientation: landscape) {
    .auth-container {
        align-items: flex-start;
        padding: 10px;
    }
    .auth-card {
        padding: 16px 20px;
        max-width: 500px;
    }
    .auth-header { margin-bottom: 10px; }
    .auth-header .logo-icon { font-size: 1.3rem; }
    .auth-header .logo h1 { font-size: 1.1rem; }
    .auth-tabs { margin-bottom: 10px; }
    .auth-form .form-group { margin-bottom: 8px; }

    .modal { max-height: 85vh; padding: 16px 20px; }
    .modal h2 { font-size: 1rem; margin-bottom: 4px; }
    .modal p { margin-bottom: 10px; font-size: 0.8rem; }
    .modal-icon { font-size: 2rem; margin-bottom: 6px; }
}

/* --- Mobile Bottom Navigation Bar --- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 110;
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.mobile-bottom-nav .bottom-nav-list {
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.mobile-bottom-nav .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    min-width: 50px;
    text-align: center;
}
.mobile-bottom-nav .bottom-nav-item .nav-icon {
    font-size: 1.3rem;
}
.mobile-bottom-nav .bottom-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
}
.mobile-bottom-nav .bottom-nav-item .nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 20px);
    background: var(--danger);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.mobile-bottom-nav .bottom-nav-item:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }
    .user-layout {
        padding-bottom: 75px;
    }
    .fab-container {
        bottom: 85px;
    }
}

/* --- Touch Device Optimizations --- */
@media (hover: none) and (pointer: coarse) {
    .btn, .category-item, .admin-nav-item, .product-card .add-btn,
    .cart-item-controls button, .bottom-nav-item {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }
    .product-card:active {
        transform: scale(0.98);
        box-shadow: var(--shadow-lg);
    }

    .category-item:active {
        background: var(--primary);
        color: #fff;
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
