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

:root {
    --bg-0: #07070b;
    --bg-1: #0d0d14;
    --bg-2: #12121c;
    --bg-card: rgba(22, 22, 34, 0.72);

    --border-soft: rgba(255, 255, 255, 0.06);
    --border-mid: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(124, 58, 237, 0.4);

    --text-1: #f5f5f7;
    --text-2: #a4a4b8;
    --text-3: #6b6b80;

    --accent-1: #7c3aed;
    --accent-2: #06b6d4;
    --accent-grad: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --accent-soft: rgba(124, 58, 237, 0.12);

    --success: #10b981;
    --danger: #ef4444;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --glow-accent: 0 0 24px rgba(124, 58, 237, 0.45);

    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-full: 999px;

    --header-h: 60px;
    --tabs-h: 62px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    overscroll-behavior-y: none;
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-0);
    color: var(--text-1);
    direction: rtl;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 15% 0%, rgba(124, 58, 237, 0.18), transparent 70%),
        radial-gradient(ellipse 50% 40% at 90% 100%, rgba(6, 182, 212, 0.14), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding-top: var(--safe-top);
    background: rgba(10, 10, 16, 0.75);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
}

.header-inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    max-width: 640px;
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
}

.brand-icon {
    font-size: 22px;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.6));
}

.brand-text {
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 18px;
}

.cart-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: var(--r-full);
    display: grid;
    place-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    transition: all 0.25s ease;
}

.cart-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-1);
}

.cart-btn:active {
    transform: scale(0.94);
    border-color: var(--border-glow);
    box-shadow: var(--glow-accent);
}

.cart-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--r-full);
    background: var(--accent-grad);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.8);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cart-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    position: sticky;
    top: calc(var(--header-h) + var(--safe-top));
    z-index: 40;
    display: flex;
    gap: 6px;
    padding: 10px 18px;
    max-width: 640px;
    margin: 0 auto;
    background: rgba(10, 10, 16, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-soft);
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    background: transparent;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.tab svg {
    width: 18px;
    height: 18px;
}

.tab.active {
    color: var(--text-1);
}

.tab-indicator {
    position: absolute;
    top: 10px;
    bottom: 10px;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    border: 1px solid var(--border-glow);
    box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.15), 0 0 20px rgba(124, 58, 237, 0.25);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    position: relative;
    z-index: 2;
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 18px calc(40px + var(--safe-bottom));
    min-height: calc(100vh - var(--header-h) - var(--tabs-h));
}

.tab-panel {
    display: none;
    animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-panel.active {
    display: block;
}

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

.panel-header {
    margin-bottom: 22px;
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.panel-desc {
    color: var(--text-2);
    font-size: 13.5px;
    margin-top: 6px;
}

/* ============================================
   SEARCH
   ============================================ */
.search-box {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    backdrop-filter: blur(12px);
    transition: all 0.25s ease;
}

.search-box:focus-within {
    border-color: var(--border-glow);
    box-shadow: var(--glow-accent);
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: var(--text-3);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--text-1);
}

.search-box input::placeholder {
    color: var(--text-3);
}

/* ============================================
   PRODUCTS GRID
   ============================================ */
.products-grid {
    display: grid;
    gap: 12px;
}

.product-card {
    position: relative;
    padding: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    cursor: pointer;
    animation: cardIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

.product-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--accent-grad);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
    border-radius: inherit;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 1px;
    pointer-events: none;
}

.product-card:active {
    transform: scale(0.985);
}

.product-card:hover::before,
.product-card:focus-visible::before {
    opacity: 1;
}

.product-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.product-card h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11.5px;
    color: var(--text-2);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-full);
}

.product-cta {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px dashed var(--border-soft);
    position: relative;
    z-index: 1;
}

.product-cta span {
    font-size: 13px;
    color: var(--text-2);
}

.product-cta .arrow {
    width: 32px;
    height: 32px;
    border-radius: var(--r-full);
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-2);
    transition: all 0.3s ease;
}

.product-card:active .arrow {
    transform: translateX(-4px);
    background: var(--accent-grad);
    color: #fff;
    box-shadow: var(--glow-accent);
}

.loading-skeleton {
    display: grid;
    gap: 12px;
}

.sk-card {
    height: 130px;
    border-radius: var(--r-lg);
    background: linear-gradient(90deg, var(--bg-2) 25%, rgba(255,255,255,0.03) 50%, var(--bg-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   STEP BAR
   ============================================ */
.step-bar {
    position: sticky;
    bottom: calc(12px + var(--safe-bottom));
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    margin-top: 20px;
    background: rgba(18, 18, 28, 0.92);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-lg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 58, 237, 0.08);
}

.step-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.step-label {
    font-size: 12px;
    color: var(--text-2);
}

.step-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-1);
    white-space: nowrap;
}

/* ============================================
   CUSTOM FORM
   ============================================ */
.custom-form {
    display: grid;
    gap: 20px;
}

.upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 36px 20px;
    background: var(--bg-card);
    border: 2px dashed var(--border-mid);
    border-radius: var(--r-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(14px);
}

.upload-zone:active {
    border-color: var(--accent-1);
    background: var(--accent-soft);
}

.upload-zone.dragover {
    border-color: var(--accent-2);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.2);
}

.upload-zone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.06);
}

.upload-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--r-full);
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    border: 1px solid var(--border-glow);
    box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.2);
}

.upload-icon svg {
    width: 26px;
    height: 26px;
    color: var(--accent-2);
}

.upload-zone.has-file .upload-icon {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
}

.upload-zone.has-file .upload-icon svg {
    color: var(--success);
}

.upload-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
}

.upload-text strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    word-break: break-all;
}

.upload-text span {
    font-size: 12.5px;
    color: var(--text-2);
}

/* Upload Progress */
.upload-progress {
    width: 100%;
    margin-top: 8px;
    display: none;
}

.upload-progress.show {
    display: block;
    animation: fadeUp 0.3s ease;
}

.upload-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--r-full);
    overflow: hidden;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-grad);
    border-radius: var(--r-full);
    transition: width 0.25s ease;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.7);
    position: relative;
}

.upload-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: progress-shine 1.4s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-2);
}

.upload-progress-percent {
    font-weight: 700;
    color: var(--accent-2);
    font-size: 13px;
}

/* Detected Pages */
.detected-pages {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: var(--accent-soft);
    border: 1px solid var(--border-glow);
    border-radius: var(--r-md);
    backdrop-filter: blur(10px);
}

.detected-value {
    font-size: 20px;
    font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.detected-suffix {
    font-size: 13.5px;
    color: var(--text-2);
}

/* ============================================
   FIELDS
   ============================================ */
.field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-2);
    padding-right: 4px;
}

.input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 0 16px;
    height: 52px;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.input-wrap:focus-within {
    border-color: var(--border-glow);
    box-shadow: var(--glow-accent);
}

.input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text-1);
    height: 100%;
}

.input-wrap input::placeholder {
    color: var(--text-3);
}

.input-suffix {
    font-size: 13px;
    color: var(--text-3);
}

/* ============================================
   CHIPS
   ============================================ */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-full);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

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

.chip.selected {
    color: #fff;
    background: var(--accent-grad);
    border-color: transparent;
    box-shadow: var(--glow-accent);
    font-weight: 700;
}

.chip-price {
    font-size: 11px;
    opacity: 0.75;
    margin-right: 4px;
}

.chip-skeleton {
    width: 90px;
    height: 40px;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--bg-2) 25%, rgba(255,255,255,0.03) 50%, var(--bg-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}

/* ============================================
   QTY
   ============================================ */
.qty-control {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-full);
    padding: 4px;
    backdrop-filter: blur(10px);
    align-self: flex-start;
    transition: all 0.25s ease;
}

.qty-control:focus-within {
    border-color: var(--border-glow);
    box-shadow: var(--glow-accent);
}

.qty-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--r-full);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-1);
    background: transparent;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    line-height: 1;
    -webkit-user-select: none;
    user-select: none;
}

.qty-btn:active {
    background: var(--accent-soft);
    color: var(--accent-2);
    transform: scale(0.9);
}

.qty-control input {
    width: 52px;
    text-align: center;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
    pointer-events: none;
}

/* ============================================
   PRICE BAR
   ============================================ */
.price-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(18, 18, 28, 0.92);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.price-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.price-label {
    font-size: 12px;
    color: var(--text-2);
}

.price-value {
    font-size: 18px;
    font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    font-size: 14.5px;
    font-weight: 700;
    color: #fff;
    background: var(--accent-grad);
    border-radius: var(--r-full);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn-primary svg {
    width: 16px;
    height: 16px;
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 0 24px rgba(124, 58, 237, 0.7);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary:disabled:active {
    transform: none;
}

.btn-block {
    width: 100%;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.open {
    display: flex;
    animation: modalIn 0.3s ease;
}

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

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    background: linear-gradient(180deg, #16162280 0%, #0f0f18 100%), var(--bg-1);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    border: 1px solid var(--border-mid);
    border-bottom: none;
    padding: 24px 20px calc(24px + var(--safe-bottom));
    animation: slideUp 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.06);
}

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

.modal-content::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: var(--r-full);
    background: var(--border-mid);
}

.modal-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 34px;
    height: 34px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-2);
    font-size: 14px;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
}

.modal-close:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.9);
}

.modal-header {
    padding: 8px 0 20px;
    text-align: right;
    padding-left: 44px;
}

.modal-header h3 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.modal-header p {
    font-size: 13px;
    color: var(--text-2);
}

.modal-body {
    display: grid;
    gap: 18px;
    padding-bottom: 18px;
}

.modal-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 0 0;
    margin-top: 4px;
    border-top: 1px solid var(--border-soft);
    background: linear-gradient(180deg, transparent, var(--bg-1) 30%);
}

/* ============================================
   TOAST
   ============================================ */
.toast-wrap {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: calc(100% - 32px);
    max-width: 380px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(22, 22, 34, 0.96);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-md);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    font-size: 13.5px;
    font-weight: 500;
}

.toast.leaving {
    animation: toastOut 0.3s ease forwards;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
}
.toast.success .toast-icon { color: var(--success); }

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
}
.toast.error .toast-icon { color: var(--danger); }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

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

@keyframes toastOut {
    to { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* ============================================
   GLOBAL LOADER
   ============================================ */
.global-loader {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    place-items: center;
    background: rgba(7, 7, 11, 0.6);
    backdrop-filter: blur(4px);
}

.global-loader.show {
    display: grid;
}

.loader-ring {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid rgba(124, 58, 237, 0.15);
    border-top-color: var(--accent-1);
    border-left-color: var(--accent-2);
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
    }
    .product-card {
        padding: 16px;
    }
}

@media (max-width: 360px) {
    .container { padding: 16px 14px 32px; }
    .header-inner { padding: 0 14px; }
    .tabs { padding: 10px 14px; }
    .tab { padding: 10px 8px; font-size: 13px; }
    .tab svg { width: 16px; height: 16px; }
    .step-bar { padding: 12px; gap: 8px; }
    .btn-primary { padding: 12px 16px; font-size: 13.5px; }
    .price-value { font-size: 16px; }
}

/* ============================================
   ACTION ROW (دو دکمه کنار هم)
   ============================================ */
.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

/* دکمه ثانویه (Outline) */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-1);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-full);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.btn-secondary svg {
    width: 16px;
    height: 16px;
}

.btn-secondary:active {
    transform: scale(0.96);
    border-color: var(--border-glow);
    background: var(--accent-soft);
    box-shadow: var(--glow-accent);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary:disabled:active {
    transform: none;
    box-shadow: none;
}

/* در موبایل‌های خیلی باریک، دکمه‌ها زیر هم */
@media (max-width: 360px) {
    .action-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FILTERS
   ============================================ */
.filters {
    margin-top: 12px;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-1);
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-full);
    backdrop-filter: blur(10px);
    transition: all 0.25s ease;
    position: relative;
}

.filter-toggle svg {
    width: 16px;
    height: 16px;
    color: var(--accent-2);
}

.filter-toggle .chev {
    width: 14px;
    height: 14px;
    color: var(--text-2);
    transition: transform 0.3s ease;
}

.filter-toggle.open {
    border-color: var(--border-glow);
    box-shadow: var(--glow-accent);
}

.filter-toggle.open .chev {
    transform: rotate(180deg);
}

.filter-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--r-full);
    background: var(--accent-grad);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    place-items: center;
}

.filter-badge.show {
    display: grid;
}

.filter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                margin-top 0.3s ease,
                opacity 0.3s ease;
    opacity: 0;
}

.filter-panel.open {
    max-height: 900px;
    margin-top: 14px;
    opacity: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.filter-group > label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    padding-right: 4px;
}

.chips-filter {
    gap: 6px;
}

.chips-filter .chip {
    padding: 7px 13px;
    font-size: 12.5px;
}

.filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--r-md);
    transition: all 0.25s ease;
    margin-top: 4px;
}

.filter-clear svg {
    width: 14px;
    height: 14px;
}

.filter-clear:active {
    background: rgba(239, 68, 68, 0.15);
    transform: scale(0.98);
}

/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */
[data-theme="light"] {
    /* Background */
    --bg-0: #f4f5f8;
    --bg-1: #ffffff;
    --bg-2: #eef0f5;
    --bg-card: rgba(255, 255, 255, 0.85);

    /* Borders */
    --border-soft: rgba(0, 0, 0, 0.06);
    --border-mid: rgba(0, 0, 0, 0.1);
    --border-glow: rgba(124, 58, 237, 0.35);

    /* Text */
    --text-1: #1a1a2e;
    --text-2: #5a5a72;
    --text-3: #9094a8;

    /* Accents — همون‌ها می‌مونن */
    --accent-soft: rgba(124, 58, 237, 0.1);

    /* Shadows */
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
    --glow-accent: 0 0 24px rgba(124, 58, 237, 0.25);
}

[data-theme="light"] body {
    background: var(--bg-0);
    color: var(--text-1);
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 60% 40% at 15% 0%, rgba(124, 58, 237, 0.1), transparent 70%),
        radial-gradient(ellipse 50% 40% at 90% 100%, rgba(6, 182, 212, 0.08), transparent 70%);
}

[data-theme="light"] .app-header,
[data-theme="light"] .tabs {
    background: rgba(255, 255, 255, 0.75);
    border-bottom-color: var(--border-soft);
}

[data-theme="light"] .cart-btn,
[data-theme="light"] .back-btn,
[data-theme="light"] .theme-toggle {
    background: #ffffff;
    border-color: var(--border-mid);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .product-card,
[data-theme="light"] .cart-card,
[data-theme="light"] .upload-zone,
[data-theme="light"] .input-wrap,
[data-theme="light"] .price-bar,
[data-theme="light"] .cart-summary,
[data-theme="light"] .step-bar,
[data-theme="light"] .search-box,
[data-theme="light"] .qty-control,
[data-theme="light"] .modal-content {
    background: #ffffff;
    border-color: var(--border-soft);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .chip {
    background: #ffffff;
    border-color: var(--border-mid);
    color: var(--text-2);
}

[data-theme="light"] .chip.selected {
    color: #fff;
    background: var(--accent-grad);
}

[data-theme="light"] .meta-pill,
[data-theme="light"] .info-pill,
[data-theme="light"] .option-tag,
[data-theme="light"] .option-box,
[data-theme="light"] .info-box,
[data-theme="light"] .info-item {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--border-soft);
}

[data-theme="light"] .modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .modal-content::before {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-footer {
    background: linear-gradient(180deg, transparent, #ffffff 30%);
}

[data-theme="light"] .cart-summary,
[data-theme="light"] .step-bar,
[data-theme="light"] .price-bar {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .upload-zone {
    background: #ffffff;
    border-color: rgba(124, 58, 237, 0.2);
}

[data-theme="light"] .upload-zone.has-file {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--success);
}

[data-theme="light"] .global-loader {
    background: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .toast {
    background: rgba(255, 255, 255, 0.98);
    border-color: var(--border-mid);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    color: var(--text-1);
}

[data-theme="light"] .search-box input,
[data-theme="light"] .input-wrap input,
[data-theme="light"] .input-wrap textarea {
    color: var(--text-1);
}

[data-theme="light"] .qty-control input {
    color: var(--text-1);
}

[data-theme="light"] .qty-btn {
    color: var(--text-1);
}

[data-theme="light"] .tab {
    color: var(--text-2);
}

[data-theme="light"] .tab.active {
    color: var(--text-1);
}

[data-theme="light"] .tab-indicator {
    background: var(--accent-soft);
}

[data-theme="light"] .product-card:hover::before,
[data-theme="light"] .product-card:focus-visible::before {
    opacity: 1;
}

[data-theme="light"] .brand-text {
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: var(--r-full);
    display: grid;
    place-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    transition: all 0.25s ease;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--text-1);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:active {
    transform: scale(0.94);
    border-color: var(--border-glow);
    box-shadow: var(--glow-accent);
}

.theme-toggle:active svg {
    transform: rotate(60deg);
}