/*
 * Components shared by every design option, on top of snb.css (tokens + base components).
 * Option-specific styles live in variants/<id>/<id>.css and are scoped to .v-<id>.
 */

:root,
[data-theme="dark"] {
    --sheet-foot: rgba(23, 63, 48, 0.97);
    --skel-hi: rgba(255, 255, 255, 0.14);
    --snb-badge-bg: #FFFFFF;
    --snb-badge-fg: #0B5A45;
}

[data-theme="light"] {
    --sheet-foot: rgba(255, 255, 255, 0.97);
    --skel-hi: #E9EEE6;
    --snb-badge-bg: #034638;
    --snb-badge-fg: #FFFFFF;
}

/* ── "Recommended by SNB" ── */
.badge.snb {
    background: var(--snb-badge-bg);
    color: var(--snb-badge-fg);
}

.note.snb {
    color: var(--text);
}

.note.snb i,
.sort-group i,
.sort-star {
    color: var(--accent);
}

/* `overflow: hidden` made .app a scroll container, so sticky footers stuck to it instead of the
   viewport. `clip` keeps the rounded frame without that side effect. */
.app {
    overflow: hidden;
    overflow: clip;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stack.tight {
    gap: 10px;
}

.center {
    text-align: center;
}

button.link {
    padding: 0;
    cursor: pointer;
}

button.link:disabled {
    color: var(--faint);
    cursor: not-allowed;
}

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

/* ── Fursah consent sheet ── */
.fursah-consent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.fursah-consent .icon-tile {
    width: 64px;
    height: 64px;
    font-size: 28px;
}

.fursah-consent h3 {
    font-size: 18px;
    line-height: 1.3;
}

.fursah-consent p {
    font-size: 14px;
    line-height: 1.55;
}

.fursah-points {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: start;
    width: 100%;
}

.fursah-points li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 12px;
}

.fursah-points i {
    color: var(--accent);
    width: 18px;
    text-align: center;
    margin-top: 2px;
}

/* ── Segmented tabs ── */
.seg {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.seg-btn {
    flex: 1;
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.seg-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.seg-btn i {
    font-size: 12px;
    color: var(--accent);
}

.seg-btn.on {
    background: var(--chip-on-bg);
    color: var(--chip-on-fg);
}

.seg-btn.on i {
    color: inherit;
}

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

.seg-badge {
    font-size: 11px;
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 9px;
    background: var(--surface-strong);
}

.seg-btn.on .seg-badge {
    background: rgba(0, 0, 0, 0.14);
}

/* ── Bottom sheet body + sticky footer ── */
.sheet-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sheet.has-foot {
    padding-bottom: 0;
}

.sheet-foot {
    position: sticky;
    bottom: 0;
    margin: 0 -16px;
    padding: 12px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--sheet-foot);
    border-top: 1px solid var(--divider);
}

/* While a sheet is open its footer holds the main action, so toasts move to the top. */
.sheet-overlay ~ .toast {
    bottom: auto;
    top: 64px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.total-line .amount {
    font-size: 20px;
}

/* ── Loading skeletons ── */
.skel,
.skel-dot {
    border-radius: 14px;
    background: linear-gradient(90deg, var(--surface) 0%, var(--skel-hi) 50%, var(--surface) 100%);
    background-size: 200% 100%;
    animation: skel 1.2s linear infinite;
}

.skel-dot {
    border-radius: 50%;
}

@keyframes skel {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* ── Profile card (prefilled from the SNB profile) ── */
.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--shadow);
}

.avatar,
.avatar-tile {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-card .li-body {
    flex: 1;
    min-width: 0;
}

/* ── Smaller insurer logo for dense rows ── */
.logo-box.sm {
    width: 52px;
    height: 40px;
    font-size: 13px;
}

.logo-box.sm i {
    font-size: 16px;
}

/* ── Large single input ── */
.field.big .control input {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ── Thin progress bar ── */
.progress-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--divider);
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.4s ease-out;
}

.v-result {
    animation: screen-in 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Status tracker (SNB request tracker: current stage filled, all stages named, dates below) ── */
.tracker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tracker-bar,
.tracker-labels {
    display: grid;
    grid-template-columns: repeat(var(--steps), 1fr);
    gap: 6px;
}

.tracker-bar span {
    height: 6px;
    border-radius: 3px;
    background: var(--divider);
}

.tracker-bar span.now {
    background: var(--chip-on-bg);
}

.tracker-bar span.now.warn {
    background: var(--warning);
}

.tracker-bar span.now.bad {
    background: var(--danger);
}

.tracker-labels div {
    text-align: center;
    font-size: 12px;
    line-height: 1.35;
    color: var(--muted);
    min-width: 0;
}

.tracker-labels b {
    display: block;
    font-weight: 500;
}

.tracker-labels small {
    display: block;
    font-size: 11px;
    color: var(--faint);
}

.tracker-labels .now b {
    color: var(--text);
    font-weight: 700;
}

.tracker-labels .now.warn b {
    color: var(--warning);
}

.tracker-labels .now.bad b {
    color: var(--danger);
}

/* ── Policy status (Pending, Active, Active & Renew, Expired & Renew) and the renewal cycle ── */
.badge.bad {
    color: var(--danger);
}

.badge.info {
    color: var(--text);
}

.kv-note {
    margin-top: 4px;
    font-weight: 400;
    text-align: end;
}

.renewal-cycle {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface);
}

.renewal-cycle .li-title i {
    color: var(--accent);
    margin-inline-end: 6px;
}

.renewal-cycle p {
    margin: 0;
    line-height: 1.5;
}

/* ── Payment options grouped by kind; an option the customer can't use is dimmed ── */
.pay-group {
    margin-bottom: -4px;
}

.option.off {
    opacity: 0.55;
    cursor: not-allowed;
}

.warn-text {
    color: var(--warning);
}

/* ── Read-only fields: contact details that come from the SNB profile ── */
.field.readonly .control {
    background: transparent;
    border: 1.5px dashed var(--divider);
}

.field.readonly input {
    cursor: default;
    color: var(--text);
}

.field.readonly .suffix-icon {
    color: var(--muted);
    font-size: 13px;
}

/* ── Arabic / English (core/i18n.js) ── */
.topbar-lang {
    min-width: 36px;
    height: 32px;
    padding: 0 8px;
    border-radius: 16px;
    border: 1px solid var(--divider);
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.brandbar .topbar-lang { margin-inline-end: 4px; }
.topbar-lang:active { background: var(--surface); }
html[lang="ar"] body { font-family: "Neo Sans Arabic", "Tajawal", SNBFont, "Segoe UI", Roboto, Arial, sans-serif; }
html[lang="ar"] .topbar-lang { font-family: "Segoe UI", Roboto, Arial, sans-serif; font-size: 13px; }
/* Arrows point the way the page reads */
[dir="rtl"] .fa-chevron-right, [dir="rtl"] .fa-chevron-left, [dir="rtl"] .fa-arrow-right, [dir="rtl"] .fa-arrow-left,
[dir="rtl"] .fa-angle-right, [dir="rtl"] .fa-angle-left, [dir="rtl"] .fa-arrow-right-long, [dir="rtl"] .fa-arrow-left-long { transform: scaleX(-1); }
/* Numbers, plates, IDs and amounts keep their own order inside Arabic text */
[dir="rtl"] input[inputmode="numeric"], [dir="rtl"] input[type="tel"] { unicode-bidi: isolate; }
/* Amounts read "2,478.83 ر.س": the currency follows the number */
[dir="rtl"] .amount { display: inline-flex; flex-direction: row-reverse; align-items: baseline; gap: 3px; unicode-bidi: isolate; }
[dir="rtl"] .amount small { margin: 0; }
