/* cafe/static/cafe/css/app.css
   سیستم طراحی مشترک صفحات حساب کاربری، سبد خرید، تسویه‌حساب، درگاه پرداخت
   و باشگاه مشتریان — هم‌راستا با رنگ‌بندی صفحه اصلی (home.html) */

:root {
    --primary: #18a6b5;
    --primary-dark: #138b99;
    --navy: #172b63;
    --text: #111111;
    --muted: #8b8b8b;
    --border: #e8e8e8;
    --soft: #f7f8f8;
    --price-bg: #eaf8fa;
    --white: #ffffff;
    --danger: #e0473e;
    --danger-bg: #fdecec;
    --success: #1f9d55;
    --success-bg: #eafaf1;
    --gold: #b8860b;
    --radius: 20px;
    --radius-sm: 12px;
}

.app-shell * { box-sizing: border-box; }

.app-shell {
    background: var(--white);
    color: var(--text);
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    min-height: 100vh;
}

.app-shell a { text-decoration: none; color: inherit; }
.app-shell button { font-family: inherit; cursor: pointer; }
.app-shell ul { list-style: none; margin: 0; padding: 0; }

/* ===================== HEADER ===================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 72px;
    padding: 0 18px;
    background: rgba(255,255,255,.97);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.app-header-logo {
    font-size: 22px;
    font-weight: 800;
    white-space: nowrap;
    display: flex;
    gap: 4px;
}
.app-header-logo .c { color: var(--text); }
.app-header-logo .v { color: var(--primary); }

.app-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-header-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 999px;
    font-size: 13.5px;
    color: var(--text);
    transition: background .2s ease, color .2s ease;
}
.app-header-link span.label { display: none; }
.app-header-link:hover { background: var(--soft); }
.app-header-link.active { background: var(--price-bg); color: var(--primary-dark); font-weight: 700; }

.app-header-link .badge {
    position: absolute;
    top: 2px;
    left: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 720px) {
    .app-header-link span.label { display: inline; }
}

/* ===================== LAYOUT ===================== */
.app-container {
    max-width: 880px;
    margin: 0 auto;
    padding: 28px 18px 90px;
}
.app-container.narrow { max-width: 480px; }

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    margin: 4px 0 24px;
}
.page-title i { color: var(--primary); }
.page-subtitle { color: var(--muted); font-size: 13.5px; margin-top: -16px; margin-bottom: 24px; }

/* ===================== CARD ===================== */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}
.card + .card { margin-top: 16px; }
.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title i { color: var(--primary); }

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    padding: 13px 22px;
    font-size: 14px;
    font-weight: 700;
    transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { opacity: .92; }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fbdada; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 13px; border-radius: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}
.field-input, .app-shell textarea, .app-shell select {
    width: 100%;
    border: 1.5px solid var(--border);
    background: var(--soft);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    transition: border-color .2s ease, background .2s ease;
}
.field-input:focus, .app-shell textarea:focus, .app-shell select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}
.field-checkbox { width: 18px; height: 18px; accent-color: var(--primary); }
.field-error {
    color: var(--danger);
    font-size: 12.5px;
    margin-top: 6px;
}
.field-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.form-row-split { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row-split .form-group { flex: 1 1 200px; }

/* ===================== ALERTS / MESSAGES ===================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 14px;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error   { background: var(--danger-bg); color: var(--danger); }
.alert-info    { background: var(--price-bg); color: var(--primary-dark); }
.alert-warning { background: #fff6e5; color: #92650c; }

/* ===================== BADGES / PILLS ===================== */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warning { background: #fff6e5; color: #92650c; }
.pill-danger  { background: var(--danger-bg); color: var(--danger); }
.pill-muted   { background: var(--soft); color: var(--muted); }

/* ===================== EMPTY STATE ===================== */
.empty-block {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.empty-block i { font-size: 46px; color: var(--border); display: block; margin-bottom: 14px; }
.empty-block p { font-size: 14.5px; margin-bottom: 20px; }

/* ===================== AVATAR ===================== */
.avatar-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--price-bg);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    flex-shrink: 0;
}

/* ===================== CART ===================== */
.cart-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.cart-row:last-child { border-bottom: none; }
.cart-thumb {
    width: 66px;
    height: 66px;
    border-radius: 14px;
    background: var(--soft);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
    font-size: 22px;
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-info { flex: 1; min-width: 0; }
.cart-name { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.cart-unit-price { color: var(--muted); font-size: 12.5px; }
.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--soft);
    border-radius: 999px;
    padding: 4px;
}
.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    color: var(--text);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qty-btn:hover { background: var(--price-bg); color: var(--primary-dark); }
.qty-val { width: 22px; text-align: center; font-weight: 700; font-size: 13.5px; }
.cart-subtotal { font-weight: 800; font-size: 13.5px; white-space: nowrap; min-width: 84px; text-align: left; }
.cart-remove-btn { color: var(--muted); background: none; border: none; padding: 8px; font-size: 15px; }
.cart-remove-btn:hover { color: var(--danger); }

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13.5px;
    color: var(--muted);
}
.summary-row.total {
    border-top: 1px dashed var(--border);
    margin-top: 8px;
    padding-top: 14px;
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}
.summary-row.total b { color: var(--primary-dark); }

.discount-form { display: flex; gap: 8px; }
.discount-form .field-input { flex: 1; }

/* ===================== ORDER ITEMS TABLE ===================== */
.order-item-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13.5px;
}
.order-item-row:last-child { border-bottom: none; }
.order-item-name { font-weight: 600; }
.order-item-meta { color: var(--muted); font-size: 12px; }

/* ===================== PAYMENT GATEWAY ===================== */
.bank-mock {
    background: linear-gradient(135deg, var(--navy), #223a7d);
    border-radius: var(--radius);
    padding: 26px 22px;
    color: #fff;
    margin-bottom: 18px;
}
.bank-mock-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    font-size: 13px;
    opacity: .85;
}
.bank-mock-amount { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.bank-mock-amount span { font-size: 13px; font-weight: 500; opacity: .8; }
.bank-mock-order { font-size: 12.5px; opacity: .75; }

.card-visual {
    background: #fff;
    color: var(--text);
    border-radius: 16px;
    padding: 20px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    font-size: 17px;
    margin-top: 14px;
}

.gateway-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fff6e5;
    color: #92650c;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 12.5px;
    margin-bottom: 18px;
}
.gateway-note i { margin-top: 2px; }

.gateway-actions { display: flex; gap: 10px; margin-top: 18px; }
.gateway-actions .btn { flex: 1; }

/* ===================== RESULT PAGE ===================== */
.result-icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 18px;
}
.result-icon.success { background: var(--success-bg); color: var(--success); }
.result-icon.fail { background: var(--danger-bg); color: var(--danger); }

/* ===================== LOYALTY / CLUB ===================== */
.loyalty-hero {
    background: linear-gradient(135deg, var(--primary), #14808c 70%);
    border-radius: var(--radius);
    padding: 26px 22px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.loyalty-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.loyalty-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,.18);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
}
.loyalty-points-num { font-size: 34px; font-weight: 800; margin: 14px 0 2px; }
.loyalty-points-label { font-size: 12.5px; opacity: .85; }

.progress-track {
    height: 8px;
    background: rgba(255,255,255,.25);
    border-radius: 999px;
    margin-top: 18px;
    overflow: hidden;
}
.progress-fill { height: 100%; background: #fff; border-radius: 999px; transition: width .4s ease; }
.progress-caption { font-size: 11.5px; opacity: .85; margin-top: 8px; display: flex; justify-content: space-between; }

.tier-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 18px 2px 4px;
}
.tier-chip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--soft);
    color: var(--muted);
    border: 1.5px solid transparent;
}
.tier-chip.reached { background: var(--price-bg); color: var(--primary-dark); }
.tier-chip.current { border-color: var(--primary); background: var(--white); color: var(--primary-dark); }

.reward-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.reward-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.reward-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--price-bg);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.reward-title { font-weight: 700; font-size: 14px; }
.reward-desc { font-size: 12.5px; color: var(--muted); flex: 1; }
.reward-cost { font-size: 12.5px; font-weight: 700; color: var(--gold); display: flex; align-items: center; gap: 5px; }

.tx-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.tx-row:last-child { border-bottom: none; }
.tx-reason { color: var(--text); }
.tx-date { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.tx-amount { font-weight: 800; }
.tx-amount.positive { color: var(--success); }
.tx-amount.negative { color: var(--danger); }

/* ===================== OTP VERIFY ===================== */
.otp-phone-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--price-bg);
    color: var(--primary-dark);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 22px;
    direction: ltr;
}
.otp-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 6px 0 8px;
    direction: ltr;
}
.otp-box {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
    color: var(--text);
    font-family: 'Courier New', monospace;
    transition: border-color .2s ease, background .2s ease;
}
.otp-box:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}
.otp-box.filled { border-color: var(--primary); background: var(--white); }

.otp-timer {
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    margin: 14px 0 20px;
}
.otp-timer b { color: var(--primary-dark); font-family: 'Courier New', monospace; }
.otp-timer.expired b { color: var(--danger); }

.otp-resend-form { text-align: center; margin-top: 14px; }
.otp-resend-btn {
    background: none;
    border: none;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}
.otp-resend-btn:disabled { color: var(--muted); cursor: not-allowed; }

@media (max-width: 380px) {
    .otp-box { width: 40px; height: 50px; font-size: 19px; }
    .otp-boxes { gap: 7px; }
}

/* ===================== ORDER TRACKING ===================== */
.tracker {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin: 30px 6px 10px;
}
.tracker::before {
    content: "";
    position: absolute;
    top: 17px;
    right: 5%;
    left: 5%;
    height: 3px;
    background: var(--border);
    z-index: 0;
}
.tracker-fill {
    position: absolute;
    top: 17px;
    right: 5%;
    height: 3px;
    background: var(--primary);
    z-index: 1;
    transition: width .5s ease;
}
.tracker-step {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.tracker-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--border);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: border-color .3s ease, color .3s ease, background .3s ease;
}
.tracker-step.done .tracker-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.tracker-step.current .tracker-dot {
    border-color: var(--primary);
    color: var(--primary-dark);
    box-shadow: 0 0 0 5px var(--price-bg);
}
.tracker-label {
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
    max-width: 70px;
}
.tracker-step.done .tracker-label,
.tracker-step.current .tracker-label {
    color: var(--text);
    font-weight: 700;
}
.tracker-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--success);
    font-weight: 700;
}
.tracker-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: trackerPulse 1.6s infinite;
}
@keyframes trackerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

/* ===================== BREADCRUMB ===================== */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 18px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary-dark); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ===================== PRODUCT / CATEGORY GRID ===================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.product-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s ease, transform .15s ease;
}
.product-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.06); transform: translateY(-2px); }
.product-card-img {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--soft);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
    font-size: 30px;
}
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card-name { font-weight: 700; font-size: 14.5px; }
.product-card-name .en { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; direction: ltr; text-align: right; }
.product-card-desc { font-size: 12px; color: var(--muted); flex: 1; }
.product-card-price { font-weight: 800; color: var(--primary-dark); font-size: 13.5px; }
.product-card-unavailable {
    font-size: 11px; font-weight: 700; color: var(--danger); background: var(--danger-bg);
    padding: 3px 10px; border-radius: 999px; display: inline-block; width: fit-content;
}

.pd-hero { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.pd-image {
    flex: 1 1 300px;
    max-width: 380px;
    aspect-ratio: 4/3;
    border-radius: var(--radius);
    background: var(--soft);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
    font-size: 46px;
}
.pd-image img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { flex: 1 1 280px; }
.pd-name-en { color: var(--muted); font-size: 14px; direction: ltr; display: block; margin-top: 4px; }
.pd-price { font-size: 24px; font-weight: 800; color: var(--primary-dark); margin: 14px 0; }
.pd-desc { font-size: 14px; color: var(--text); line-height: 1.9; margin-bottom: 18px; }

/* ===================== DELIVERY TYPE TOGGLE (checkout) ===================== */
.delivery-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.delivery-option {
    border: 1.5px solid var(--border);
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all .15s ease;
}
.delivery-option i { font-size: 20px; color: var(--muted); }
.delivery-option .title { font-size: 13.5px; font-weight: 700; }
.delivery-option .sub { font-size: 11px; color: var(--muted); }
.delivery-option.active {
    border-color: var(--primary);
    background: var(--price-bg);
}
.delivery-option.active i,
.delivery-option.active .title { color: var(--primary-dark); }
.delivery-option:active { transform: scale(.97); }

.delivery-panel { display: none; }
.delivery-panel.active { display: block; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 520px) {
    .app-header { padding: 0 12px; }
    .app-header-logo { font-size: 19px; }
    .cart-subtotal { display: none; }
    .app-container { padding: 20px 14px 90px; }
}

/* ===================== LOADING SCREEN (shared, all pages) ===================== */
#loader {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .35s ease, visibility .35s ease;
    z-index: 99999;
}
#loader.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
body.loading { overflow: hidden; }

.loader-logo {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 22px;
}
.loader-cafe { color: var(--text); }
.loader-vina { color: var(--navy); }

.loader-cup {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eefafb;
    color: var(--primary);
    font-size: 22px;
    animation: loaderPulse 1.1s infinite ease-in-out;
}
@keyframes loaderPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
    .loader-cup { animation: none; }
}
