:root {
    --ooredoo-red: #ed1c24;
    --ooredoo-pink: #fff0f0;
    --ooredoo-pink-soft: #fde8e9;
    --ink: #080808;
    --muted: #9da3ae;
    --border: #e0e0e0;
    --border-strong: #d2d5db;
    --error-bg: #f9eae8;
    --page-bg: #f5f5f5;
    --card-shadow: 0px 2px 14px 0px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    background: #fff;
    color: var(--ink);
    font-family: "Noto Kufi Arabic", "Rubik", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.app-shell {
    min-height: 100vh;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.page-header {
    background: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-header h1 {
    margin: 0;
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #080808;
    font-family: Rubik, "Noto Kufi Arabic", sans-serif;
}
.icon-btn {
    width: 32px; height: 32px; border: 0; background: transparent;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink); cursor: pointer; text-decoration: none; padding: 0;
}
.icon-btn svg { width: 20px; height: 20px; }

.page-main {
    width: 100%;
    min-width: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 160px;
    flex: 1;
}

.card {
    background: #fff;
    padding: 20px 12px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    width: 100%;
    min-width: 0;
}

.row-between { display: flex; align-items: center; justify-content: space-between; }
.checkbox-label {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    user-select: none; font-size: 12px; color: #000;
}
.checkbox-box {
    width: 18px; height: 18px; border-radius: 4px;
    border: 2px solid #d2d5db; background: #fff;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    color: #fff; font-size: 11px; line-height: 1;
    transition: background .15s, border-color .15s;
}
.checkbox-box.is-checked { background: #080808; border-color: #080808; }

.add-btn {
    border: 1px solid var(--ink); background: #fff; color: var(--ink);
    border-radius: 24px; padding: 6px 22px; font-size: 12px;
    font-family: Rubik, sans-serif; font-weight: 500; height: 32px; cursor: pointer;
    transition: color .15s, border-color .15s, transform .1s;
}
.add-btn:hover { border-color: var(--ooredoo-red); color: var(--ooredoo-red); }
.add-btn:active { transform: scale(0.97); }

.divider { border-bottom: 1px solid #d2d4db; margin: 12px 0 0; }
.entry-row { padding: 16px 0; border-bottom: 1px solid #d2d4db; }
.entry-row:last-child { border-bottom: 0; padding-bottom: 0; }
.entry-main { display: flex; align-items: flex-start; gap: 8px; direction: rtl; width: 100%; }
.entry-check { margin-top: 32px; }
.entry-fields { flex: 1 1 auto; min-width: 0; }
.label-group, .input-group { display: flex; gap: 16px; width: 100%; min-width: 0; }
.label-group { margin-bottom: 4px; }
.label-group label { font-size: 14px; font-weight: 500; font-family: Rubik, sans-serif; }
.label-group label:first-child, .phone-wrap { flex: 1.5; min-width: 0; }
.label-group label:last-child, .amount-wrap { flex: 1; min-width: 0; }
.req { color: var(--ooredoo-red); }

.field-wrap {
    position: relative; display: flex; align-items: center; background: #fff;
    border-radius: 10px; border: 1px solid var(--border); height: 48px;
    padding: 0 8px; min-width: 0; transition: border-color .15s;
}
.field-wrap:focus-within { border-color: var(--ooredoo-red); }
.field-wrap.has-error { border-color: var(--ooredoo-red); }
.field-wrap input {
    border: 0; background: transparent; font-size: 14px; font-family: Rubik, sans-serif;
    font-weight: 500; color: var(--ink); width: 100%; min-width: 0; outline: none; direction: ltr;
}
.phone-wrap input { text-align: right; }
.amount-wrap input { text-align: left; }
.field-wrap .currency {
    font-size: 14px; color: var(--ink); margin-right: 6px;
    font-family: Rubik, sans-serif; font-weight: 500; white-space: nowrap;
}
.clear-btn {
    position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: #bdbdbd; cursor: pointer; padding: 0; line-height: 1;
}
.meta-group {
    display: flex; justify-content: space-between; font-size: 12px;
    color: var(--muted); margin-top: 2px;
}
.status-error {
    display: flex; align-items: center; gap: 8px; border-radius: 10px;
    font-size: 12px; padding: 8px; background: var(--error-bg); color: var(--ink); margin-top: 8px;
}

.payment-options {
    width: 100%;
    max-width: 375px;
    margin: 0 auto;
    border-radius: 16px;
}
.payment-options__intro { margin-bottom: 18px; }
.section-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 500;
    color: #000;
    font-family: Rubik, "Noto Kufi Arabic", sans-serif;
}
.section-desc {
    margin: 0;
    font-size: 14px;
    color: #000;
    line-height: 1.5;
}
.option-list { display: flex; flex-direction: column; gap: 12px; }
.option-card {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: #fff; border: 1.5px solid #eee; border-radius: 12px;
    padding: 16px 16px 16px 10px; cursor: pointer; text-align: start; color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.option-card:hover {
    border-color: #ed1c24;
    box-shadow: 0 2px 8px rgba(237, 28, 36, 0.08);
}
.option-icon {
    width: 24px; height: 24px; color: var(--ooredoo-red); flex: 0 0 24px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
.option-icon svg { width: 20px; height: 20px; }
.option-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}
.option-text {
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 500;
    color: #080808;
    font-family: Rubik, "Noto Kufi Arabic", sans-serif;
    text-align: start;
}
.option-arrow {
    width: 20px;
    height: 20px;
    color: #bdbdbd;
    flex-shrink: 0;
    display: inline-flex;
}
.option-arrow svg { width: 20px; height: 20px; }

.pay-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 56px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: -2px 1px 15px 0 rgba(0, 0, 0, 0.12);
    padding: 14px 16px 20px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.pay-btn {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 100px;
    background: #ebecef;
    color: #9da3ae;
    font-size: 16px;
    font-weight: 500;
    font-family: "Noto Kufi Arabic", Rubik, sans-serif;
    cursor: not-allowed;
    opacity: 0.7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    line-height: normal;
    transition: background-color .2s, transform .1s, opacity .2s;
}
.pay-btn.is-ready {
    background: #ed1c24;
    color: #fff;
    cursor: pointer;
    opacity: 1;
}
.pay-btn.is-ready:hover { transform: translateY(-1px); }
.pay-btn.is-ready:active { transform: translateY(0); }
.pay-btn.is-loading {
    background: #ed1c24;
    color: #fff;
    opacity: 1;
    cursor: wait;
}
.spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bottom-nav {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
    width: min(100%, 480px); background: #fff; border-top: 1px solid #f3f4f6;
    display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 8px 10px; z-index: 50;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px; color: #6b7280; text-decoration: none;
    font-family: Rubik, "Noto Kufi Arabic", sans-serif;
}
.nav-item.active { color: #ed1c24; font-weight: 500; }
.nav-icon {
    width: 36px; height: 28px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
}
.nav-item.active .nav-icon { background: #fde8e9; color: #ed1c24; }
.nav-icon svg { width: 20px; height: 20px; }

.total-bar {
    background: #f6f6f6; border-radius: 12px; display: flex;
    align-items: center; justify-content: space-between; padding: 12px 18px; direction: rtl;
}
.total-bar .label { font-size: 14px; font-family: Rubik, sans-serif; }
.total-bar .value {
    font-size: 18px; font-weight: 500; font-family: Rubik, sans-serif; direction: ltr;
}

.pm-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 64px;
    background: #fff;
    border: 1px solid #ebecef;
    border-radius: 12px;
    padding: 19px 16px;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    text-align: left;
    transition: border .2s, box-shadow .2s;
}
.pm-option.is-selected {
    border: 2px solid #ed1c24;
    box-shadow: none;
}
.pm-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #d2d5db;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pm-option.is-selected .pm-radio {
    border-color: #ed1c24;
    background: #ed1c24;
}
.pm-label {
    flex: 1 1 auto;
    text-align: right;
    font-size: 16px;
    font-weight: 500;
    color: #080808;
    font-family: "Noto Kufi Arabic", Rubik, sans-serif;
}
.pm-logo-img {
    width: 48px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
    background: #fff;
}

/* Credit card form — shows under selected card option (RTL like MyOoredoo) */
.mc-form {
    display: none;
    flex-direction: column;
    margin-top: 4px;
    padding: 0 4px 0 8px;
    direction: rtl;
}
.mc-form.is-open { display: flex; }
.mc-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #e0e0e0;
}
.mc-brand {
    width: 44px;
    height: 20px;
    object-fit: contain;
    flex: 0 0 auto;
}
.mc-brand--mc {
    width: 40px;
    height: 24px;
}
.mc-brand--amex {
    width: 36px;
    height: 24px;
}
.mc-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 14px;
    font-weight: 400;
    font-family: Rubik, "Noto Kufi Arabic", sans-serif;
    color: #080808;
    text-align: right;
    direction: rtl;
    padding: 0;
    height: 24px;
}
.mc-input::placeholder { color: #9da3ae; opacity: 1; }
.mc-input--card {
    direction: ltr;
    text-align: right;
}
.mc-input--name {
    direction: rtl;
    text-align: right;
    font-family: "Noto Kufi Arabic", Rubik, sans-serif;
}
.mc-input--expiry,
.mc-input--cvv {
    text-align: left;
    direction: ltr;
}
.mc-input--cvv {
    width: 60px;
    flex: 0 0 60px;
}
.mc-split {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    direction: rtl;
}
.mc-split-line {
    width: 1px;
    height: 20px;
    background: #d0d0d0;
    margin: 0 16px;
    flex-shrink: 0;
}

.continue-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 56px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    padding: 14px 16px 20px;
    border-radius: 24px 24px 0 0;
    box-shadow: -2px 1px 15px 0 rgba(0, 0, 0, 0.12);
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.continue-btn {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 100px;
    background: #ed1c24;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    font-family: "Noto Kufi Arabic", Rubik, sans-serif;
    cursor: pointer;
}

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: none; align-items: flex-end; justify-content: center; z-index: 80;
}
.modal-backdrop.is-open { display: flex; }
.modal-sheet {
    width: min(100%, 480px); background: #fff; border-radius: 20px 20px 0 0;
    padding: 12px 16px 28px; animation: sheetUp .22s ease;
}
@keyframes sheetUp {
    from { transform: translateY(24px); opacity: .85; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-handle {
    width: 42px; height: 4px; border-radius: 999px; background: #d1d5db;
    margin: 0 auto 14px;
}
.modal-sheet h3 { margin: 0; font-size: 18px; text-align: right; font-weight: 700; }
.modal-title-row {
    display: flex; align-items: center; gap: 12px; margin-bottom: 18px; direction: rtl;
}
.modal-title-icon {
    width: 36px; height: 36px; color: var(--ooredoo-red); flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.modal-title-icon svg,
.modal-title-icon img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}
.modal-field-label {
    display: block; margin: 0 0 8px; font-size: 14px; font-weight: 600; text-align: right;
}
.modal-desc { margin: 0 0 14px; font-size: 13px; color: #6b7280; text-align: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions-stack { flex-direction: column; }
.modal-actions button { flex: 1; height: 48px; border-radius: 24px; border: 0; cursor: pointer; font-weight: 700; font-size: 16px; }
.btn-secondary { background: #f3f4f6; color: var(--ink); }
.btn-primary { background: var(--ooredoo-red); color: #fff; }
.btn-primary:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; }
.modal-spinner {
    width: 48px; height: 48px; border: 4px solid #f9c6c8; border-top-color: var(--ooredoo-red);
    border-radius: 50%; margin: 0 auto 16px; animation: spin .8s linear infinite;
}
.checking-box { text-align: center; padding: 36px 0; color: #6b7280; font-size: 14px; }
.checking-box strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

/* Visitor IP modal */
.visitor-modal {
    align-items: center;
    z-index: 120;
}
.visitor-sheet {
    border-radius: 20px;
    margin: 16px;
    width: min(100% - 32px, 420px);
    animation: visitorPop .22s ease;
}
@keyframes visitorPop {
    from { transform: translateY(12px) scale(.98); opacity: .85; }
    to { transform: none; opacity: 1; }
}
.visitor-loading {
    text-align: center;
    padding: 20px 0 8px;
    color: #6b7280;
    font-size: 14px;
}
.visitor-ip-btn {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.visitor-ip-btn:hover,
.visitor-ip-btn.is-open {
    border-color: #c9a0a2;
    box-shadow: 0 6px 18px rgba(237, 28, 36, 0.1);
}
.visitor-ip-btn:active { transform: scale(.99); }
.visitor-ip-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
}
.visitor-ip-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    font-family: Rubik, "Noto Kufi Arabic", sans-serif;
    letter-spacing: .02em;
    word-break: break-all;
}
.visitor-ip-hint {
    font-size: 12px;
    color: var(--ooredoo-red);
    font-weight: 600;
}
.visitor-details {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}
.visitor-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.visitor-detail-row:last-child { border-bottom: 0; }
.visitor-detail-row span { color: #6b7280; }
.visitor-detail-row strong {
    color: var(--ink);
    font-weight: 700;
    text-align: left;
    direction: ltr;
    unicode-bidi: plaintext;
}
.visitor-error {
    text-align: center;
    color: #a92222;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 0;
}
.checking-box p { margin: 0; }
