:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #3e3e3e;
    --heading: #222f3e;
    --muted: #888888;
    --primary: #7dc442;
    --primary-dark: #6aad38;
    --accent: #008080;
    --accent-dark: #006666;
    --border: #dddddd;
    --shadow: 0 10px 40px rgba(34, 47, 62, 0.08);
    --radius: 10px;
    --btn-radius: 10px;
    --font: 'Vazirmatn', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}
h1, h2, h3, h4, h5, h6 { color: var(--heading); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
.container { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.narrow { width: min(480px, calc(100% - 2rem)); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; }
.brand-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: min(180px, 42vw);
    object-fit: contain;
}
.auth-brand { text-align: center; margin-bottom: 1.25rem; }
.auth-logo {
    display: inline-block;
    height: 56px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
.nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.user-phone { font-size: .9rem; color: var(--muted); }
.cart-link { position: relative; font-weight: 600; }
.cart-badge {
    position: absolute; top: -8px; left: -10px;
    background: var(--primary); color: #fff;
    font-size: .7rem; min-width: 18px; height: 18px;
    border-radius: 999px; display: grid; place-items: center;
}
 
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: .5rem; border: none;
    border-radius: var(--btn-radius);
    padding: .85rem 1.4rem; font-family: inherit;
    font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 24px rgba(125, 196, 66, 0.28);
}
.btn-primary:hover,
.btn-primary:focus,
a.btn-primary:hover,
a.btn-primary:focus {
    background: var(--primary-dark);
    color: #fff;
}
.btn-ghost {
    background: transparent;
    color: var(--heading);
    border: 1px solid var(--border);
    border-radius: var(--btn-radius);
}
.btn-ghost:hover,
.btn-ghost:focus,
a.btn-ghost:hover,
a.btn-ghost:focus {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}
.btn-sm { padding: .55rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; }
.inline-form { display: inline; }

.hero {
    padding: 4rem 0 3rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(125, 196, 66, 0.12), transparent 40%),
        radial-gradient(circle at 80% 0%, rgba(0, 128, 128, 0.1), transparent 35%),
        var(--bg);
}
.eyebrow {
    color: var(--accent); font-weight: 600; letter-spacing: .04em;
    text-transform: uppercase; font-size: .8rem; margin: 0 0 .5rem;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.2; margin: 0 0 1rem; }
.hero-lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; margin-bottom: 1.5rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.section { padding: 3rem 0; }
.section-muted { background: #f5f5f5; }
.section-head { margin-bottom: 2rem; }
.section-head h1, .section-head h2 { margin: 0 0 .35rem; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.6);
    display: flex; flex-direction: column;
}
.product-thumb { aspect-ratio: 4/3; overflow: hidden; background: #f5f5f5; }
.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform .3s ease;
}
.product-card:hover .product-thumb img { transform: scale(1.04); }
.product-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; flex: 1; }
.product-body h3 { margin: 0; font-size: 1.05rem; }
.product-excerpt { margin: 0; color: var(--muted); font-size: .92rem; }
.product-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.product-body h3 a { color: var(--heading); }
.product-body h3 a:hover { color: var(--accent); }
.price { font-weight: 700; color: var(--accent); }
.price-lg { font-size: 1.4rem; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.feature {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex; flex-direction: column; gap: .35rem;
}

.product-detail {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 2rem;
    align-items: start;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.5rem;
    font-size: .9rem;
    color: var(--muted);
}
.breadcrumb a:hover { color: var(--accent); }
.product-detail-media {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}
.product-detail-media img {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
    object-position: center;
}
.product-detail-info h1 { margin-top: 0; }
.product-description { color: var(--muted); margin: 1rem 0; }
.price-box { margin: 1.5rem 0; }
.product-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.auth-card, .checkout-card, .result-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-card h1, .result-card h1 { margin-top: 0; }
label { display: block; margin: 1rem 0 .35rem; font-weight: 600; }
input[type="text"], input[type="tel"], input[type="email"] {
    width: 100%; padding: .9rem 1rem; border: 1px solid var(--border);
    border-radius: 12px; font-family: inherit; font-size: 1rem;
    background: #fff;
}
input:focus { outline: 2px solid rgba(125, 196, 66, 0.25); border-color: var(--primary); }
.phone-field {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .15rem .15rem .15rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    direction: ltr;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.phone-field:focus-within {
    outline: 2px solid rgba(125, 196, 66, 0.25);
    border-color: var(--primary);
}
.phone-prefix {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .02em;
    user-select: none;
}
.phone-input {
    flex: 1;
    min-width: 0;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: .75rem .25rem .75rem 0 !important;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: .04em;
    background: transparent;
}
.phone-input::placeholder {
    color: #b8b2a8;
    font-weight: 500;
    letter-spacing: .03em;
}
.phone-field:has(.phone-input.is-valid) {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(125, 196, 66, 0.12);
}
.phone-field:has(.phone-input.is-invalid) {
    border-color: #b42318;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}
.phone-hint {
    margin: .45rem 0 1rem;
    font-size: .85rem;
}
.form-message { min-height: 1.5rem; margin-top: 1rem; font-size: .92rem; }
.form-message.error { color: #b42318; }
.form-message.success { color: var(--primary); }

.otp-phone-display { margin: 0 0 .5rem; font-size: .92rem; }
.otp-input {
    position: relative;
    display: flex;
    justify-content: center;
    gap: .65rem;
    margin: .5rem 0 1.25rem;
    direction: ltr;
}
.otp-autofill {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}
.otp-box {
    width: 3rem;
    height: 3.4rem;
    padding: 0;
    text-align: center;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
    caret-color: transparent;
}
.otp-box:hover { border-color: #d4cdc4; }
.otp-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(125, 196, 66, 0.15);
    transform: translateY(-1px);
}
.otp-input.otp-complete .otp-box {
    border-color: var(--primary);
    background: #f7fbf3;
}
.otp-input.otp-error {
    animation: otp-shake .45s ease;
}
.otp-input.otp-error .otp-box {
    border-color: #b42318;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}
@keyframes otp-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.btn-link {
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 500;
    border-radius: var(--btn-radius);
}
.btn-link:hover { color: var(--accent); transform: none; }

.nav a:not(.btn):hover { color: var(--accent); }

@media (max-width: 420px) {
    .otp-input { gap: .45rem; }
    .otp-box {
        width: 2.55rem;
        height: 3rem;
        font-size: 1.25rem;
        border-radius: 12px;
    }
}

.cart-table { display: flex; flex-direction: column; gap: 1rem; }
.cart-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 1rem; align-items: center;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
}
.cart-product { display: flex; gap: 1rem; align-items: center; }
.cart-product img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.cart-summary {
    margin-top: 2rem; background: var(--surface);
    border-radius: var(--radius); padding: 1.5rem;
    box-shadow: var(--shadow);
}
.summary-row, .checkout-line, .checkout-total {
    display: flex; justify-content: space-between; gap: 1rem;
}
.checkout-total { margin: 1.25rem 0; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 1.1rem; }
.summary-actions { display: flex; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }

.download-list { display: flex; flex-direction: column; gap: 1rem; }
.download-item {
    display: grid; grid-template-columns: 80px 1fr auto;
    gap: 1rem; align-items: center;
    background: var(--surface); border-radius: var(--radius);
    padding: 1rem 1.25rem; box-shadow: var(--shadow);
}
.download-item img { width: 80px; height: 60px; object-fit: cover; border-radius: 10px; }
.download-info h3 { margin: 0 0 .25rem; font-size: 1rem; }

.result-card { text-align: center; }
.result-icon {
    width: 64px; height: 64px; border-radius: 50%;
    display: grid; place-items: center; margin: 0 auto 1rem;
    font-size: 1.8rem; font-weight: 700;
}
.result-success .result-icon { background: #edf7e4; color: #5a9a2e; }
.result-error .result-icon { background: #fee2e2; color: #991b1b; }
.result-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

.alert {
    margin: 1rem auto; padding: .85rem 1rem;
    border-radius: 12px; font-size: .95rem;
}
.alert-success { background: #f3faeb; color: #4a7a28; }
.alert-error { background: #fef3f2; color: #b42318; }
.alert-info { background: #eefafa; color: var(--accent-dark); }

.empty-state {
    text-align: center; padding: 3rem 1rem;
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.site-footer {
    margin-top: 4rem;
    padding: 3rem 0 1.5rem;
    background: var(--heading);
    color: rgba(255, 255, 255, 0.88);
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: 2rem 1.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-brand { max-width: 320px; }
.footer-logo-link { display: inline-block; margin-bottom: 1rem; }
.footer-logo {
    height: 48px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}
.footer-tagline {
    margin: 0;
    font-size: .92rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.72);
}
.footer-heading {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}
.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.footer-links a {
    color: rgba(255, 255, 255, 0.78);
    font-size: .92rem;
    transition: color .15s ease;
}
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1.25rem;
    font-size: .88rem;
    color: rgba(255, 255, 255, 0.6);
}
.footer-bottom p { margin: 0; }
.footer-bottom-links {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.footer-bottom-links a {
    color: rgba(255, 255, 255, 0.72);
}
.footer-bottom-links a:hover { color: var(--primary); }

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .footer-brand {
        grid-column: 1 / -1;
        max-width: none;
    }
}
@media (max-width: 520px) {
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .product-detail { grid-template-columns: 1fr; }
    .cart-row { grid-template-columns: 1fr; }
    .download-item { grid-template-columns: 64px 1fr; }
    .download-item .btn { grid-column: 1 / -1; }
    .header-inner { flex-direction: column; align-items: stretch; padding: .75rem 0; }
    .nav { justify-content: center; }
}
