/* =========================================
   Application Flow — Shared Design System
   ========================================= */

/* Hide nav description */
.main-nav-title small { visibility: hidden; }

/* Page background */
.af-bg {
    background: #F4F5F7;
    min-height: 70vh;
    padding: 0 0 48px;
    position: relative;
    z-index: 5;
}

/* Card */
.af-card {
    background: #fff;
    overflow: hidden;
    font-family: 'main-font', sans-serif;
}
.af-card h1, .af-card h2, .af-card h3,
.af-card h4, .af-card h5, .af-card h6 {
    font-family: 'main-font', sans-serif;
}

/* ---- Step Progress Bar ---- */
.af-steps {
    padding: 14px 22px 13px;
    background: #fff;
    border-bottom: 1px solid #F0F4F8;
}
.af-steps-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 9px;
}
.af-steps-name {
    font-size: 13px;
    font-weight: 600;
    color: #002147;
}
.af-steps-counter {
    font-size: 11px;
    font-weight: 400;
    color: #9CA3AF;
    direction: ltr;
}
.af-steps-bar {
    height: 5px;
    background: #E5E7EB;
    border-radius: 999px;
    overflow: hidden;
}
.af-steps-fill {
    height: 100%;
    background: #002147;
    border-radius: 999px;
    transition: width 0.4s ease;
}
.af-steps-fill.done { background: #10b981; }

/* ---- Form Body ---- */
.af-body {
    padding: 24px 28px 28px;
}

/* Heading */
.af-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    font-family: 'main-font', sans-serif !important;
    color: #002147 !important;
    line-height: 1.4 !important;
    margin: 0 0 4px !important;
}
.af-subtitle {
    font-size: 12px; font-weight: 400; color: #6B7280; margin: 0 0 20px;
    line-height: 1.6;
}

/* ---- Fields ---- */
.af-field {
    margin-bottom: 16px;
}
.af-label {
    display: block;
    font-size: 11px; font-weight: 500; color: #374151;
    margin-bottom: 5px;
}
.af-input {
    width: 100%;
    padding: 10px 13px;
    font-size: 13px;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.af-input:focus {
    outline: none;
    border-color: #002147;
    box-shadow: 0 0 0 3px rgba(0,33,71,0.07);
}
.af-input.valid        { border-color: #10b981; background: #F0FDF4; }
.af-input.invalid      { border-color: #EF4444; background: #FFF5F5; }
.af-input-error        { border-color: #EF4444 !important; background: #FFF5F5 !important; }
.af-input[disabled]    { background: #F9FAFB; color: #6B7280; cursor: not-allowed; }
.af-help               { font-size: 11px; color: #6B7280; margin-top: 4px; }

/* Row: two fields side by side */
.af-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.af-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

/* Error message */
.af-error {
    font-size: 12px; color: #EF4444;
    background: #FFF5F5; border: 1px solid #FECACA;
    border-radius: 8px; padding: 8px 12px;
    margin-top: 6px; display: none;
}
.af-errors-box {
    background: #FFF5F5; border: 1px solid #FECACA;
    border-radius: 10px; padding: 12px 14px;
    margin-bottom: 16px; font-size: 13px; color: #B91C1C;
}
.af-errors-box > div { margin-bottom: 3px; }
.af-errors-box > div:last-child { margin-bottom: 0; }

/* Alerts */
.af-alert { border-radius: 10px; padding: 10px 13px; margin-bottom: 12px; font-size: 12px; }
.af-alert-success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #166534; }
.af-alert-info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.af-alert-error   { background: #FFF5F5; border: 1px solid #FECACA; color: #B91C1C; }

/* ---- Buttons ---- */
.af-btn {
    width: 100%;
    padding: 12px 20px;
    background: #002147; color: #fff;
    border: none; border-radius: 999px;
    font-size: 13px; font-weight: 600;
    font-family: inherit;
    cursor: pointer; margin-top: 8px;
    transition: background 0.15s, transform 0.12s, opacity 0.15s;
}
.af-btn:hover:not(:disabled) {
    background: #00336b;
    transform: translateY(-1px);
}
.af-btn:disabled {
    background: #9CA3AF; cursor: not-allowed;
    transform: none; opacity: 0.8;
}
.af-btn-secondary {
    width: 100%;
    padding: 10px 20px;
    background: transparent; color: #002147;
    border: 1.5px solid #D1D5DB;
    border-radius: 999px;
    font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-top: 8px;
}
.af-btn-secondary:hover { border-color: #002147; background: #F8FAFF; }
.af-btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Shared Section / Row components (cf-*) ---- */
.cf-section {
    border: 1px solid #E8EEFB;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}
.cf-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #F4F7FF;
    border-bottom: 1px solid #E8EEFB;
    font-size: 12px;
    font-weight: 600;
    color: #002147;
}
.cf-section-icon {
    width: 22px; height: 22px;
    background: #002147;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    font-size: 13px;
    border-bottom: 1px solid #F3F4F6;
}
.cf-row:last-child { border-bottom: none; }
.cf-row .cf-label  { color: #6B7280; font-weight: 400; }
.cf-row .cf-value  { font-weight: 500; color: #111827; }
.cf-feature-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    font-size: 13px;
    border-bottom: 1px solid #F3F4F6;
    color: #374151;
}
.cf-feature-row:last-child { border-bottom: none; }
.cf-check {
    width: 18px; height: 18px;
    background: #DCFCE7;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cf-votes-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    background: #EFF6FF;
    font-size: 12px;
    border-top: 1px solid #DBEAFE;
}
.cf-votes-row .cf-label { color: #1E40AF; font-weight: 400; }
.cf-votes-row .cf-value { color: #1E40AF; font-weight: 500; }
.cf-bank-notice {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 12px;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
}

/* ---- Tier Banner (inside card) ---- */
.cf-tier-banner {
    background: linear-gradient(135deg, #002147 0%, #003a7a 100%);
    color: #fff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.cf-tier-banner-label { font-size: 10px; opacity: .6; margin-bottom: 3px; letter-spacing: .4px; }
.cf-tier-banner-name  { font-size: 15px; font-weight: 600; }
.cf-tier-banner-price { font-size: 18px; font-weight: 600; white-space: nowrap; direction: ltr; }
.cf-tier-banner-price small { font-size: 12px; font-weight: 400; opacity: .7; margin-right: 3px; }
.cf-tier-banner-end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

.af-change-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 999px;
    color: rgba(255,255,255,.75);
    font-size: 10px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
    font-family: inherit;
}
.af-change-btn:hover {
    background: rgba(255,255,255,.2);
    border-color: rgba(255,255,255,.4);
    color: #fff;
}

/* ---- Selected Plan Badge ---- */
.af-plan-badge {
    background: linear-gradient(135deg, #002147 0%, #003a7a 100%);
    padding: 14px 18px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.af-plan-badge::before {
    content: '';
    position: absolute;
    right: -24px; top: -24px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
    pointer-events: none;
}
.af-plan-badge-label {
    font-size: 10px;
    color: rgba(255,255,255,.6);
    margin-bottom: 3px;
    letter-spacing: .3px;
}
.af-plan-badge-name { font-size: 14px; font-weight: bold; color: #fff; }
.af-plan-badge-price {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    direction: ltr;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}
.af-plan-badge-price .sar {
    width: 1em;
    height: 1.1em;
    vertical-align: middle;
}

/* ---- OTP ---- */
.af-otp-wrap {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    direction: ltr;
}
.af-otp-input {
    width: 52px; height: 56px;
    text-align: center; font-size: 22px; font-weight: bold;
    border: 2px solid #E5E7EB; border-radius: 12px;
    background: #fff; font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.af-otp-input:focus {
    outline: none; border-color: #002147;
    box-shadow: 0 0 0 3px rgba(0,33,71,0.07);
}
.af-otp-input.filled { border-color: #002147; background: #F0F4FF; }
.af-timer { text-align: center; font-size: 13px; color: #6B7280; margin-top: 6px; }

/* ---- Confirmation Summary ---- */
.af-summary {
    border: 1.5px solid #E5E7EB;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
}
.af-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 12px;
    border-bottom: 1px solid #F3F4F6;
}
.af-summary-row:last-child { border-bottom: none; }
.af-summary-row .label { color: #6B7280; }
.af-summary-row .value { font-weight: 600; color: #111827; }
.af-summary-header {
    background: #002147; color: #fff;
    padding: 10px 14px;
    font-weight: 600; font-size: 12px;
    text-align: center;
}

/* ---- Invoice / Receipt Block ---- */
.inv-wrap {
    border: 1.5px solid #E5E7EB;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
    background: #fff;
}
.inv-header {
    background: #F8FAFF;
    border-bottom: 1px dashed #CBD5F0;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.inv-header-title {
    font-size: 11px;
    font-weight: 600;
    color: #002147;
    display: flex;
    align-items: center;
    gap: 6px;
}
.inv-header-badge {
    font-size: 9.5px;
    font-weight: 500;
    background: #EEF2FF;
    color: #4338CA;
    border: 1px solid #C7D2FE;
    border-radius: 999px;
    padding: 2px 9px;
    white-space: nowrap;
}
.inv-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 12.5px;
    border-bottom: 1px dashed #F3F4F6;
}
.inv-row:last-of-type { border-bottom: none; }
.inv-label { color: #6B7280; font-weight: 400; }
.inv-value { font-weight: 500; color: #111827; }
.inv-vat .inv-value { color: #059669; }
.inv-sep {
    border: none;
    border-top: 1.5px dashed #D1D5DB;
    margin: 0 14px;
}
.inv-total {
    background: linear-gradient(135deg, #002147 0%, #003a7a 100%);
    padding: 13px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}
.inv-total-label { font-size: 12px; font-weight: 600; opacity: .75; }
.inv-total-value {
    font-size: 19px;
    font-weight: bold;
    direction: ltr;
    display: flex;
    align-items: center;
    gap: 5px;
}
.inv-total-value .sar { width: 1em; height: 1.1em; }
.inv-votes {
    background: #EFF6FF;
    border-top: 1px solid #BFDBFE;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: #1E40AF;
}
.inv-footer {
    background: #FAFAFA;
    border-top: 1px dashed #E5E7EB;
    padding: 7px 16px;
    font-size: 9.5px;
    color: #9CA3AF;
    text-align: center;
    line-height: 1.6;
}

/* ---- Divider ---- */
.af-divider {
    border: none; border-top: 1px solid #F3F4F6;
    margin: 16px 0;
}

@media (max-width: 600px) {
    .af-bg    { padding: 10px 10px 40px; }
    .af-body  { padding: 16px 16px 20px; }
    .af-steps { padding: 11px 14px 10px; }
    .af-row   { grid-template-columns: 1fr; }
    .af-row-3 { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .af-otp-input { width: 44px; height: 50px; font-size: 18px; }
    .af-plan-badge { padding: 11px 14px; }
    .af-plan-badge-name { font-size: 12px; }
    .af-plan-badge-price { font-size: 17px; }
    /* Tier banner */
    .cf-tier-banner { padding: 12px 16px; gap: 8px; }
    .cf-tier-banner-name  { font-size: 13px; }
    .cf-tier-banner-price { font-size: 15px; }
    /* Rows: prevent long values overflowing — use text-align:end so Arabic aligns correctly */
    .cf-row .cf-value,
    .cf-price-row .cf-value,
    .cf-price-total .cf-value { max-width: 60%; text-align: end; word-break: break-word; }
    /* Invoice: shrink total on small screens */
    .inv-total-value { font-size: 16px; }
    .inv-row { font-size: 12px; padding: 9px 12px; }
    .inv-total { padding: 11px 12px; }
    .inv-votes { padding: 7px 12px; font-size: 11px; }
    /* Success card */
    .sc-card { flex-direction: column; align-items: flex-start; gap: 8px; }
    .sc-card-num { font-size: 14px; }
    .sc-header-title { font-size: 15px; }
    /* Payment options */
    .pm-name { font-size: 12px; }
    /* EP header */
    .ep-header { padding: 14px 16px; }
    .ep-header-total { font-size: 18px; }
}

