/* Medifaster — shared mobile app-shell (User / Store / Driver panels) */
/* iOS-style liquid glass: blur, translucency, soft gradients */

:root {
    --mf-primary: #0A84FF;
    --mf-primary-dark: #0060DF;
    --mf-success: #34C759;
    --mf-danger: #FF3B30;
    --mf-warning: #FF9F0A;
    --mf-bg: #F2F2F7;
    --mf-surface: rgba(255, 255, 255, 0.72);
    --mf-surface-solid: #FFFFFF;
    --mf-border: rgba(60, 60, 67, 0.12);
    --mf-text: #1C1C1E;
    --mf-text-muted: #6E6E73;
    --mf-radius: 20px;
    --mf-radius-sm: 12px;
    --mf-blur: 20px;
    --mf-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --mf-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light is the default regardless of system preference — dark only applies when
   the user opts in via the Profile toggle (sets data-theme="dark" on <html>). */
:root[data-theme="dark"] {
    --mf-bg: #000000;
    --mf-surface: rgba(28, 28, 30, 0.72);
    --mf-surface-solid: #1C1C1E;
    --mf-border: rgba(255, 255, 255, 0.12);
    --mf-text: #F2F2F7;
    --mf-text-muted: #98989F;
    --mf-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--mf-bg);
    color: var(--mf-text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

.mf-app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: calc(76px + var(--mf-safe-bottom)); }

/* Top bar */
.mf-topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--mf-surface);
    backdrop-filter: blur(var(--mf-blur)); -webkit-backdrop-filter: blur(var(--mf-blur));
    border-bottom: 1px solid var(--mf-border);
}
.mf-topbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.mf-back { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(120,120,128,0.12); }

/* Glass card */
.mf-card {
    background: var(--mf-surface);
    backdrop-filter: blur(var(--mf-blur)); -webkit-backdrop-filter: blur(var(--mf-blur));
    border: 1px solid var(--mf-border);
    border-radius: var(--mf-radius);
    box-shadow: var(--mf-shadow);
    padding: 16px;
    margin: 12px 16px;
}
.mf-card-solid { background: var(--mf-surface-solid); }

/* Buttons */
.mf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px 20px; border: none; border-radius: 14px;
    font-size: 16px; font-weight: 600; cursor: pointer;
    background: var(--mf-primary); color: #fff;
    transition: transform .1s ease, opacity .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.mf-btn:active { transform: scale(0.97); opacity: 0.9; }
.mf-btn.mf-btn-outline { background: transparent; color: var(--mf-primary); border: 1.5px solid var(--mf-primary); }
.mf-btn.mf-btn-danger { background: var(--mf-danger); }
.mf-btn.mf-btn-sm { padding: 8px 14px; font-size: 14px; width: auto; border-radius: 10px; }
.mf-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Inputs */
.mf-field { margin-bottom: 14px; }
.mf-field label { display: block; font-size: 13px; font-weight: 600; color: var(--mf-text-muted); margin-bottom: 6px; }
.mf-input, .mf-select, .mf-textarea {
    width: 100%; padding: 13px 14px; border-radius: 12px;
    border: 1px solid var(--mf-border); background: var(--mf-surface-solid);
    color: var(--mf-text); font-size: 15px; outline: none;
}
.mf-input:focus, .mf-select:focus, .mf-textarea:focus { border-color: var(--mf-primary); }

/* Bottom nav */
.mf-bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    max-width: 560px; margin: 0 auto;
    display: flex; justify-content: space-around; align-items: center;
    padding: 10px 8px calc(10px + var(--mf-safe-bottom));
    background: var(--mf-surface);
    backdrop-filter: blur(var(--mf-blur)); -webkit-backdrop-filter: blur(var(--mf-blur));
    border-top: 1px solid var(--mf-border);
}
.mf-nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--mf-text-muted); text-decoration: none; font-size: 11px; font-weight: 500; padding: 4px 10px; }
.mf-nav-item.active { color: var(--mf-primary); }
.mf-nav-item i { font-size: 22px; }

/* Store / product list rows */
.mf-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--mf-border); }
.mf-row:last-child { border-bottom: none; }
.mf-thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--mf-border); flex-shrink: 0; }
.mf-row-title { font-weight: 600; font-size: 15px; }
.mf-row-sub { font-size: 13px; color: var(--mf-text-muted); }

/* Badges */
.mf-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.mf-badge-success { background: rgba(52,199,89,.15); color: var(--mf-success); }
.mf-badge-warning { background: rgba(255,159,10,.15); color: var(--mf-warning); }
.mf-badge-danger { background: rgba(255,59,48,.15); color: var(--mf-danger); }
.mf-badge-muted { background: rgba(120,120,128,.15); color: var(--mf-text-muted); }

/* Empty state */
.mf-empty { text-align: center; padding: 60px 24px; color: var(--mf-text-muted); }
.mf-empty i { font-size: 44px; opacity: .4; margin-bottom: 10px; display: block; }

/* Status stepper (order tracking) */
.mf-steps { display: flex; flex-direction: column; gap: 0; padding: 4px 0; }
.mf-step { display: flex; gap: 14px; position: relative; padding-bottom: 24px; }
.mf-step:last-child { padding-bottom: 0; }
.mf-step-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mf-border); margin-top: 4px; flex-shrink: 0; position: relative; z-index: 1; }
.mf-step.done .mf-step-dot { background: var(--mf-success); }
.mf-step:not(:last-child)::before {
    content: ''; position: absolute; left: 5px; top: 16px; bottom: -8px; width: 2px; background: var(--mf-border);
}
.mf-step.done:not(:last-child)::before { background: var(--mf-success); }
.mf-step-title { font-weight: 600; font-size: 14px; }
.mf-step-time { font-size: 12px; color: var(--mf-text-muted); }

.mf-toast {
    position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
    background: rgba(28,28,30,0.92); color: #fff; padding: 12px 20px; border-radius: 14px;
    font-size: 14px; z-index: 999; backdrop-filter: blur(10px);
    opacity: 0; pointer-events: none; transition: opacity .25s ease, bottom .25s ease;
}
.mf-toast.show { opacity: 1; bottom: 120px; }

a { color: inherit; }

/* Store cards (home page listing) — premium block + shadow style */
.store-grid { display: flex; flex-direction: column; gap: 16px; padding: 4px 16px 16px; }
.store-card {
    display: block; text-decoration: none; color: inherit;
    background: var(--mf-surface-solid); border-radius: 20px; overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
    border: 1px solid var(--mf-border);
    transition: transform .15s ease, box-shadow .15s ease;
}
.store-card:active { transform: scale(.98); box-shadow: 0 3px 10px rgba(0,0,0,.10); }
.store-card-cover {
    position: relative; height: 140px; background-size: cover; background-position: center;
    background-color: var(--mf-border);
}
.store-card-cover::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,.35) 100%);
}
.store-card-closed-badge {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    background: rgba(28,28,30,.75); color: #fff; font-size: 11px; font-weight: 700;
    padding: 4px 10px; border-radius: 20px; backdrop-filter: blur(6px);
}
.store-card-logo {
    position: absolute; left: 14px; bottom: -20px; z-index: 2;
    width: 52px; height: 52px; border-radius: 14px; object-fit: cover;
    border: 3px solid var(--mf-surface-solid); box-shadow: 0 4px 10px rgba(0,0,0,.15);
    background: var(--mf-surface-solid);
}
.store-card-body { padding: 28px 16px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.store-card-info { flex: 1; min-width: 0; }
.store-card-name { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.store-card-meta { font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.store-card-rating { color: var(--mf-warning); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.store-card-dot { color: var(--mf-text-muted); }
.store-card-arrow {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--mf-primary), #0060DF); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    box-shadow: 0 6px 14px rgba(10,132,255,.32);
    transition: transform .15s ease;
}
.store-card:active .store-card-arrow { transform: scale(.9); }

/* Store detail page — hero, search, category pills, product cards */
.store-hero { position: relative; margin-bottom: 44px; }
.store-hero-cover { height: 170px; background-size: cover; background-position: center; background-color: var(--mf-border); }
.store-hero-cover::after { content: ''; position: absolute; inset: 0; height: 170px; background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.55) 100%); }
.store-hero-body { padding: 0 16px; position: relative; }
.store-hero-logo {
    width: 68px; height: 68px; border-radius: 18px; object-fit: cover; margin-top: -34px;
    border: 4px solid var(--mf-surface-solid); box-shadow: 0 6px 16px rgba(0,0,0,.18); background: var(--mf-surface-solid);
    position: relative; z-index: 2; display: block;
}
.store-hero-name { font-size: 20px; font-weight: 800; margin-top: 10px; letter-spacing: -.2px; }
.store-hero-meta { font-size: 13px; margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.store-hero-meta .muted { color: var(--mf-text-muted); }
.store-hero-rating { color: var(--mf-warning); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.store-hero-addr { font-size: 12px; color: var(--mf-text-muted); margin-top: 6px; }

.store-search-bar { padding: 0 16px; margin-bottom: 4px; }
.store-search-input {
    display: flex; align-items: center; gap: 10px; background: var(--mf-surface-solid);
    border: 1px solid var(--mf-border); border-radius: 14px; padding: 12px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.store-search-input i { color: var(--mf-text-muted); }
.store-search-input input { border: none; background: none; outline: none; flex: 1; font-size: 14px; color: var(--mf-text); }

.store-cat-pills { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px; }
.store-cat-pill {
    white-space: nowrap; padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
    background: var(--mf-surface-solid); border: 1px solid var(--mf-border); color: var(--mf-text-muted); text-decoration: none;
}
.store-cat-pill.active { background: var(--mf-primary); color: #fff; border-color: var(--mf-primary); }

.product-list { padding: 0 16px 100px; display: flex; flex-direction: column; gap: 12px; }
.product-card {
    display: flex; gap: 12px; align-items: center; background: var(--mf-surface-solid);
    border: 1px solid var(--mf-border); border-radius: 16px; padding: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,.05);
}
.product-card-img-wrap { position: relative; flex-shrink: 0; }
.product-card-img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--mf-border); display: block; }
.product-card-discount { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); background: var(--mf-danger); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 8px; white-space: nowrap; }
.product-card-info { flex: 1; min-width: 0; }
.product-card-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.product-card-generic { font-size: 11px; color: var(--mf-text-muted); margin-top: 1px; }
.product-card-price { margin-top: 6px; display: flex; align-items: baseline; gap: 6px; }
.price-now { font-weight: 700; font-size: 15px; }
.price-mrp { font-size: 12px; color: var(--mf-text-muted); text-decoration: line-through; }
.product-card-action { flex-shrink: 0; }
.add-btn {
    background: var(--mf-surface-solid); color: var(--mf-primary); border: 1.5px solid var(--mf-primary);
    font-weight: 700; font-size: 13px; padding: 9px 20px; border-radius: 10px; letter-spacing: .3px; cursor: pointer;
}
.add-btn:active { background: rgba(10,132,255,.08); }
.qty-stepper { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--mf-primary); border-radius: 10px; overflow: hidden; }
.qty-btn { width: 32px; height: 34px; border: none; background: var(--mf-surface-solid); color: var(--mf-primary); font-size: 16px; font-weight: 700; cursor: pointer; }
.qty-btn-primary { background: var(--mf-primary); color: #fff; }
.qty-val { min-width: 22px; text-align: center; font-weight: 700; font-size: 14px; }

.cart-float-bar {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    width: calc(100% - 32px); max-width: 528px; z-index: 60;
    background: linear-gradient(135deg, var(--mf-primary), #0060DF); color: #fff; text-decoration: none;
    border-radius: 16px; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 10px 30px rgba(10,132,255,.35);
}
.cart-float-count { font-size: 12px; opacity: .85; font-weight: 600; }
.cart-float-label { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.cart-float-total { font-weight: 700; font-size: 15px; }

/* Driver app — premium components */
.drv-status-hero {
    margin: 12px 16px; border-radius: 22px; padding: 20px;
    background: linear-gradient(135deg, var(--mf-primary), #0060DF); color: #fff;
    box-shadow: 0 12px 30px rgba(10,132,255,.3);
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.drv-status-hero.offline { background: linear-gradient(135deg, #6E6E73, #48484A); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.drv-status-left { display: flex; align-items: center; gap: 12px; }
.drv-status-dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; position: relative; flex-shrink: 0; }
.drv-status-hero:not(.offline) .drv-status-dot::after {
    content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6);
    animation: drvPulse 1.8s ease-out infinite;
}
@keyframes drvPulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
.drv-status-title { font-weight: 800; font-size: 16px; }
.drv-status-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.drv-status-switch { position: relative; width: 54px; height: 30px; flex-shrink: 0; }
.drv-status-switch input { opacity: 0; width: 0; height: 0; }
.drv-status-switch-track { position: absolute; inset: 0; background: rgba(255,255,255,.25); border-radius: 30px; cursor: pointer; }
.drv-status-switch-track::before { content: ''; position: absolute; height: 24px; width: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s ease; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.drv-status-switch input:checked + .drv-status-switch-track::before { transform: translateX(24px); }

.drv-stat-row { display: flex; gap: 12px; padding: 4px 16px; }
.drv-stat-card { flex: 1; background: var(--mf-surface-solid); border: 1px solid var(--mf-border); border-radius: 16px; padding: 16px; text-align: center; box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.drv-stat-num { font-size: 24px; font-weight: 800; }
.drv-stat-label { font-size: 11px; color: var(--mf-text-muted); margin-top: 3px; font-weight: 600; letter-spacing: .2px; }

.drv-wallet-card {
    margin: 12px 16px; background: var(--mf-surface-solid); border: 1px solid var(--mf-border); border-radius: 18px;
    padding: 18px; box-shadow: 0 4px 14px rgba(0,0,0,.05); display: flex; align-items: center; justify-content: space-between;
}
.drv-wallet-label { font-size: 12px; color: var(--mf-text-muted); font-weight: 600; }
.drv-wallet-amount { font-size: 22px; font-weight: 800; color: var(--mf-primary); margin-top: 2px; }
.drv-wallet-icon { width: 46px; height: 46px; border-radius: 14px; background: rgba(10,132,255,.1); color: var(--mf-primary); display: flex; align-items: center; justify-content: center; font-size: 20px; }

.drv-request-card {
    margin: 10px 16px; background: var(--mf-surface-solid); border: 1px solid var(--mf-border); border-radius: 18px;
    padding: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.07);
    animation: drvSlideIn .3s ease;
}
@keyframes drvSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.drv-request-badge { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,159,10,.12); color: var(--mf-warning); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; margin-bottom: 10px; }
.drv-request-store { font-weight: 700; font-size: 16px; }
.drv-request-meta { font-size: 13px; color: var(--mf-text-muted); margin-top: 3px; }
.drv-request-earn { font-weight: 700; color: var(--mf-success); }

.drv-waiting-card { margin: 30px 16px; text-align: center; padding: 30px 20px; }
.drv-waiting-icon { width: 72px; height: 72px; border-radius: 50%; background: rgba(10,132,255,.1); color: var(--mf-primary); display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 16px; }
.drv-radar { position: relative; width: 72px; height: 72px; margin: 0 auto 16px; }
.drv-radar-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--mf-primary); opacity: 0; animation: drvRadar 2s ease-out infinite; }
.drv-radar-ring:nth-child(2) { animation-delay: .6s; }
.drv-radar-ring:nth-child(3) { animation-delay: 1.2s; }
@keyframes drvRadar { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
.drv-radar-center { position: absolute; inset: 22px; border-radius: 50%; background: var(--mf-primary); display: flex; align-items: center; justify-content: center; color: #fff; }

/* Delivery flow (order-view) */
.drv-route-card { margin: 10px 16px; background: var(--mf-surface-solid); border: 1px solid var(--mf-border); border-radius: 18px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.drv-route-row { display: flex; gap: 12px; padding: 16px; align-items: flex-start; }
.drv-route-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.drv-route-icon.pickup { background: rgba(255,159,10,.12); color: var(--mf-warning); }
.drv-route-icon.drop { background: rgba(52,199,89,.12); color: var(--mf-success); }
.drv-route-label { font-size: 11px; color: var(--mf-text-muted); font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.drv-route-name { font-weight: 700; font-size: 15px; margin-top: 2px; }
.drv-route-addr { font-size: 13px; color: var(--mf-text-muted); margin-top: 3px; line-height: 1.4; }
.drv-route-divider { height: 1px; background: var(--mf-border); margin: 0 16px; }
.drv-route-nav { flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; background: var(--mf-primary); color: #fff; display: flex; align-items: center; justify-content: center; text-decoration: none; }

.drv-cod-banner { margin: 10px 16px; padding: 14px 16px; background: rgba(255,159,10,.1); border: 1px solid rgba(255,159,10,.25); border-radius: 14px; display: flex; align-items: center; gap: 12px; }
.drv-cod-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--mf-warning); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.drv-otp-input { font-size: 28px !important; letter-spacing: 12px !important; text-align: center; font-weight: 800; }

/* Toggle switch */
.mf-switch { position: relative; display: inline-block; width: 46px; height: 27px; flex-shrink: 0; }
.mf-switch input { opacity: 0; width: 0; height: 0; }
.mf-switch-track { position: absolute; inset: 0; background: var(--mf-border); border-radius: 27px; transition: background .2s ease; cursor: pointer; }
.mf-switch-track::before { content: ''; position: absolute; height: 21px; width: 21px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.mf-switch input:checked + .mf-switch-track { background: var(--mf-primary); }
.mf-switch input:checked + .mf-switch-track::before { transform: translateX(19px); }
