:root {
    --blue: #1877f2;
    --blue-dark: #166fe5;
    --green: #25d366;
    --green-dark: #1fb85a;
    --page: #f0f2f5;
    --card: #ffffff;
    --text: #1c1e21;
    --muted: #65676b;
    --line: #d8dadf;
    --soft-blue: #e7f3ff;
    --danger-bg: #fff1f0;
    --danger: #b42318;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, .10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: Tahoma, Arial, "Segoe UI", sans-serif;
    background: var(--page);
    color: var(--text);
    line-height: 1.6;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    width: min(940px, calc(100% - 28px));
    min-height: 58px;
    margin: auto;
    display: flex;
    align-items: center;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--blue);
}
.brand-logo {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 19px;
}

.page-shell {
    width: min(720px, calc(100% - 24px));
    margin: 34px auto 42px;
}
.intro { text-align: center; margin-bottom: 20px; }
.intro h1 { margin: 0 0 7px; font-size: clamp(25px, 4vw, 34px); }
.intro p { margin: 0; color: var(--muted); }

.form-card {
    background: var(--card);
    border: 1px solid #dddfe2;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 26px;
}
.step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
}
.step::before {
    content: "";
    position: absolute;
    top: 16px;
    inset-inline-start: 50%;
    width: 100%;
    height: 2px;
    background: var(--line);
    z-index: 0;
}
.step:last-child::before { display: none; }
.step span {
    position: relative;
    z-index: 1;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e4e6eb;
    color: var(--muted);
    font-weight: 800;
}
.step.active span, .step.done span { background: var(--blue); color: #fff; }
.step.done::before { background: var(--blue); }
.step small { margin-top: 5px; }
.step.active small { color: var(--blue); font-weight: 700; }

.form-step { display: none; }
.form-step.active { display: block; }
.section-title { margin-bottom: 18px; }
.section-title h2, .section-title h3 { margin: 0 0 3px; font-size: 21px; }
.section-title p { margin: 0; color: var(--muted); font-size: 14px; }
.section-title.compact h3 { font-size: 17px; }

.fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-weight: 700; font-size: 14px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
input, select, textarea {
    width: 100%;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 12px 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 105px; }
input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, .14);
}

.notes-box, .bank-box, .whatsapp-note {
    margin-top: 20px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfc;
}
.price-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.price-row, .bank-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
}
.price-row:last-of-type, .bank-row:last-child { border-bottom: 0; }
.price-row span, .bank-row span { color: var(--muted); }
.price-row strong, .bank-row strong { text-align: left; overflow-wrap: anywhere; }
.offer-line {
    background: var(--soft-blue);
    padding: 17px;
    display: grid;
    gap: 2px;
}
.offer-line span { color: var(--blue); font-weight: 700; }
.offer-line strong { color: var(--blue); font-size: 30px; line-height: 1.3; }
.offer-line small { color: var(--muted); }
.bank-box h3 { margin: 0 0 10px; }
.whatsapp-note { border-color: #b7e4c7; background: #f2fff6; }
.whatsapp-note strong { color: #147a38; }
.whatsapp-note p { margin: 5px 0 0; color: #355d43; }


.form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.button {
    min-height: 45px;
    border: 0;
    border-radius: 8px;
    padding: 0 22px;
    cursor: pointer;
    font-weight: 800;
}
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-dark); }
.button-light { background: #e4e6eb; color: var(--text); }
.button-whatsapp { background: var(--green); color: #fff; min-width: 220px; }
.button-whatsapp:hover { background: var(--green-dark); }
.button:disabled { opacity: .65; cursor: wait; }
.hidden, .hp { display: none !important; }

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 14px;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecdca; }
.privacy-note { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 0; }

@media (max-width: 620px) {
    .page-shell { margin-top: 20px; }
    .form-card { padding: 18px 15px; }
    .fields-grid { grid-template-columns: 1fr; gap: 14px; }
    .field.full { grid-column: auto; }
    .form-actions { flex-direction: column-reverse; }
    .button { width: 100%; }
    .price-row, .bank-row { flex-direction: column; gap: 2px; }
    .price-row strong, .bank-row strong { text-align: right; }
}

/* تحسين عرض السعر والتخفيض */
.old-price-row {
    align-items: center;
}
.old-price-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}
.old-price {
    position: relative;
    display: inline-block;
    color: #35383d;
    font-size: 23px;
    font-weight: 900;
    line-height: 1.2;
    direction: rtl;
    text-decoration-line: line-through;
    text-decoration-color: #e41e3f;
    text-decoration-thickness: 4px;
    text-decoration-skip-ink: none;
}
.old-price-label {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #ffebe9;
    color: #c81e1e;
    font-size: 12px;
    font-weight: 800;
}
.offer-line {
    padding: 20px;
    background: linear-gradient(135deg, #edf5ff 0%, #dcecff 100%);
}
.offer-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 3px;
}
.offer-title {
    color: var(--blue);
    font-size: 16px;
    font-weight: 900;
}
.offer-validity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--blue);
    color: #fff !important;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}
.offer-price-label {
    margin-top: 5px;
    color: #4b5563;
    font-size: 13px;
    font-weight: 700;
}
.offer-line strong {
    display: block;
    margin: 2px 0 3px;
    color: var(--blue);
    font-size: clamp(38px, 8vw, 56px);
    font-weight: 950;
    letter-spacing: -.8px;
    line-height: 1.05;
    text-shadow: 0 2px 0 rgba(24, 119, 242, .08);
}

@media (max-width: 620px) {
    .old-price-wrap {
        justify-content: flex-start;
    }
    .offer-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .offer-validity {
        width: 100%;
    }
}

/* النسخة المتجاوبة + السعر المركزي + تثبيت التطبيق */
body {
    min-width: 280px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.topbar-inner {
    justify-content: space-between;
    gap: 12px;
}

.install-button {
    min-height: 38px;
    border: 1px solid #c7d9f5;
    border-radius: 8px;
    padding: 0 14px;
    background: #e7f3ff;
    color: var(--blue);
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.offer-line {
    text-align: center;
    align-items: center;
    justify-items: center;
    padding: clamp(24px, 5vw, 40px) 18px;
}

.offer-heading {
    width: 100%;
    justify-content: center;
    gap: 12px;
}

.offer-price-label {
    margin-top: 10px;
    font-size: 14px;
}

.offer-line strong {
    width: 100%;
    margin: 6px auto 8px;
    text-align: center;
    font-size: clamp(58px, 12vw, 88px);
    line-height: 1;
    letter-spacing: -1.5px;
}

.offer-line small {
    display: block;
    width: 100%;
    text-align: center;
}

.button:disabled {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(.2);
}

.button.is-loading:disabled {
    opacity: .7;
    cursor: wait;
}

.required-hint {
    margin: 10px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.install-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .45);
}

.install-modal-card {
    width: min(420px, 100%);
    border-radius: 14px;
    padding: 22px;
    background: #fff;
    box-shadow: 0 16px 45px rgba(0, 0, 0, .25);
    text-align: center;
}

.install-modal-card h2 {
    margin: 0 0 8px;
    font-size: 21px;
}

.install-modal-card p {
    margin: 0 0 18px;
    color: var(--muted);
}

@media (max-width: 620px) {
    body { background: #fff; }
    .topbar-inner { width: calc(100% - 20px); }
    .brand { min-width: 0; }
    .brand > span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
    }
    .install-button { padding: 0 10px; font-size: 13px; }
    .page-shell {
        width: 100%;
        margin: 18px auto 30px;
        padding: 0 10px;
    }
    .intro { padding: 0 8px; }
    .intro h1 { font-size: 26px; }
    .form-card {
        border-radius: 12px;
        padding: 17px 13px;
        box-shadow: 0 1px 5px rgba(0, 0, 0, .08);
    }
    input, select, textarea { font-size: 16px; }
    .steps { margin-bottom: 22px; }
    .step small { font-size: 11px; }
    .offer-heading {
        align-items: center;
        flex-direction: column;
    }
    .offer-validity {
        width: auto;
        max-width: 100%;
    }
    .offer-line strong {
        font-size: clamp(52px, 18vw, 76px);
        letter-spacing: -1px;
    }
    .old-price-wrap { justify-content: flex-start; }
    .form-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin-inline: -13px;
        padding: 14px 13px calc(14px + env(safe-area-inset-bottom, 0));
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 -4px 14px rgba(0, 0, 0, .06);
        backdrop-filter: blur(8px);
    }
}

@media (min-width: 621px) and (max-width: 900px) {
    .page-shell { width: min(720px, calc(100% - 32px)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
