/* ============================================================
 * Store registration — ONE8 (ported from React/TSX reference)
 * Scoped under .sr-page / .sr-* to avoid collisions with the
 * global template CSS. Works for both RTL (ar) and LTR (en):
 * base rules are LTR, body.rtl overrides flip alignment.
 * ============================================================ */

.sr-page {
    --sr-brand-primary: #5B2BE0;
    --sr-brand-secondary: #2563EB;
    --sr-bg-page: #F4F6FB;
    --sr-bg-card: #ffffff;
    --sr-text-main: #1E1B4B;
    --sr-text-muted: #6B7280;
    --sr-border: #E5E7EB;
    --sr-tag-bg: #F1F0FF;
    --sr-tag-border: #C4B5FD;
    --sr-tag-text: #5B2BE0;
    --sr-error: #EF4444;

    background: var(--sr-bg-page);
    color: var(--sr-text-main);
    font-family: 'Cairo', 'Almarai', sans-serif;
    padding: 24px 16px 48px;
    text-align: left;
}

body.rtl .sr-page {
    text-align: right;
}

.sr-inner {
    max-width: 780px;
    margin: 0 auto;
}

/* ---------- Header card ---------- */
.sr-hero {
    background: linear-gradient(135deg, #5B2BE0 0%, #2563EB 100%);
    border-radius: 24px;
    padding: 24px 28px 22px;
    margin-bottom: 24px;
    box-shadow: 0 10px 32px rgba(91, 43, 224, 0.25);
    position: relative;
    overflow: hidden;
}

.sr-hero::before,
.sr-hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.sr-hero::before {
    top: -40px;
    left: -40px;
    width: 180px;
    height: 180px;
}

.sr-hero::after {
    bottom: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.05);
}

.sr-hero h1 {
    color: #fff;
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-weight: 800;
    font-size: 26px;
    margin: 0 0 6px;
    position: relative;
    z-index: 1;
}

.sr-hero p {
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-size: 14px;
    margin: 0;
    position: relative;
    z-index: 1;
}

.sr-hero .sr-hero-icon {
    color: rgba(255, 255, 255, 0.9);
    margin-inline-end: 8px;
}

.sr-dots {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    justify-content: flex-end;
    position: relative;
    z-index: 1;
}

body:not(.rtl) .sr-dots {
    justify-content: flex-start;
}

.sr-dots span {
    height: 6px;
    width: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.35);
}

.sr-dots span:first-child {
    width: 24px;
    background: #FCD34D;
}

/* ---------- Form layout ---------- */
.sr-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
}

/* ---------- Section card ---------- */
.sr-card {
    background: var(--sr-bg-card);
    border-radius: 20px;
    padding: 28px;
    border: 1px solid rgba(91, 43, 224, 0.08);
    box-shadow: 0 2px 16px rgba(91, 43, 224, 0.05);
}

.sr-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--sr-brand-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sr-card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, var(--sr-brand-primary), var(--sr-brand-secondary));
    border-radius: 4px;
    flex-shrink: 0;
}

/* ---------- Fields ---------- */
.sr-field {
    margin-bottom: 16px;
}

.sr-field:last-child {
    margin-bottom: 0;
}

.sr-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--sr-text-main);
    margin-bottom: 8px;
}

.sr-label .req {
    color: var(--sr-error);
    margin-inline-start: 2px;
}

.sr-hint {
    font-size: 13px;
    color: var(--sr-text-muted);
    margin: -4px 0 10px;
}

.sr-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--sr-border);
    border-radius: 12px;
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-size: 15px;
    color: var(--sr-text-main);
    background: #FAFAFA;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    outline: none;
    text-align: left;
}

body.rtl .sr-input {
    text-align: right;
}

.sr-input:focus {
    border-color: var(--sr-brand-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(91, 43, 224, 0.1);
}

.sr-input::placeholder {
    color: #9CA3AF;
}

.sr-input.sr-invalid,
.sr-input.error {
    border-color: var(--sr-error);
    /* Neutralize the template's global `.error { margin-bottom: 20px }`
       rule: jQuery-validate adds `error` to the input itself, which would
       resize the field and shift the password eye toggle. */
    margin-bottom: 0;
}

.sr-input.sr-invalid:focus,
.sr-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.sr-input[type="tel"] {
    direction: ltr;
}

/* Hide Edge/IE native password-reveal and clear buttons: the form
   provides its own eye toggle and the native icons would render
   a duplicate eye (visible while typing) inside the field. */
.sr-page .sr-input::-ms-reveal,
.sr-page .sr-input::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}

body.rtl .sr-input[type="tel"] {
    text-align: right;
}

/* grid */
.sr-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

/* ---------- Chips ---------- */
.sr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sr-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--sr-tag-border);
    background: var(--sr-tag-bg);
    color: var(--sr-tag-text);
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    white-space: nowrap;
    line-height: 1.6;
}

.sr-chip:hover {
    background: #EDE9FE;
    border-color: var(--sr-brand-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(91, 43, 224, 0.15);
}

.sr-chip:focus-visible {
    outline: 2px solid var(--sr-brand-primary);
    outline-offset: 2px;
}

.sr-chip.active {
    background: var(--sr-brand-primary);
    border-color: var(--sr-brand-primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(91, 43, 224, 0.3);
    transform: translateY(-1px);
}

/* car chips */
.sr-car-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.sr-car-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    border-radius: 16px;
    border: 2px solid var(--sr-tag-border);
    background: var(--sr-tag-bg);
    color: var(--sr-tag-text);
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    min-width: 90px;
    line-height: 1.4;
}

.sr-car-chip .sr-car-icon {
    font-size: 24px;
    line-height: 1;
}

.sr-car-chip .sr-car-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.sr-car-chip:hover {
    background: #EDE9FE;
    border-color: var(--sr-brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 43, 224, 0.15);
}

.sr-car-chip:focus-visible {
    outline: 2px solid var(--sr-brand-primary);
    outline-offset: 2px;
}

.sr-car-chip.active {
    background: var(--sr-brand-primary);
    border-color: var(--sr-brand-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(91, 43, 224, 0.35);
    transform: translateY(-2px);
}

/* order count chips reuse tag chip with stronger weight */
.sr-chip.sr-strong {
    padding: 8px 20px;
    font-weight: 700;
}

/* ---------- Percent segmented ---------- */
.sr-pct-box {
    background: #F8F7FF;
    border-radius: 16px;
    padding: 16px;
    border: 1.5px solid #EDE9FE;
}

.sr-pct-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.sr-pct {
    flex: 1;
    padding: 10px 4px;
    border-radius: 12px;
    border: 2px solid var(--sr-border);
    background: #fff;
    color: #374151;
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.18s ease;
    direction: ltr;
}

.sr-pct:hover {
    border-color: var(--sr-tag-border);
}

.sr-pct:focus-visible {
    outline: 2px solid var(--sr-brand-primary);
    outline-offset: 2px;
}

.sr-pct.active {
    border: 2px solid var(--sr-brand-primary);
    background: linear-gradient(135deg, #5B2BE0, #2563EB);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 43, 224, 0.3);
}

.sr-pct-chosen {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--sr-brand-primary);
    font-weight: 600;
}

.sr-pct-chosen .fa-check {
    margin-inline-end: 4px;
}

/* ---------- Password eye ---------- */
.sr-pass-wrap {
    position: relative;
}

.sr-pass-wrap .sr-input {
    padding-inline-end: 16px;
    padding-inline-start: 42px;
}

body:not(.rtl) .sr-pass-wrap .sr-input {
    padding-inline-start: 16px;
    padding-inline-end: 42px;
}

.sr-eye {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-start: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sr-text-muted);
    font-size: 16px;
    padding: 4px;
    line-height: 1;
}

.sr-eye:hover {
    color: var(--sr-brand-primary);
}

/* ---------- Errors ---------- */
.sr-error {
    font-size: 12px;
    color: var(--sr-error);
    margin-top: 4px;
    font-family: 'Cairo', 'Almarai', sans-serif;
    display: none;
}

.sr-error.show {
    display: block;
}

label.sr-error,
.sr-page label.error {
    font-size: 12px;
    color: var(--sr-error);
    margin-top: 4px;
    margin-bottom: 0;
    font-weight: 600;
}

/* ---------- Summary ---------- */
.sr-summary {
    background: linear-gradient(135deg, #F0EDFF, #EFF6FF);
    border-radius: 16px;
    padding: 16px 20px;
    border: 1.5px solid #C4B5FD;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.sr-summary-title {
    font-size: 13px;
    font-weight: 700;
    color: #5B2BE0;
    margin-inline-end: 8px;
}

.sr-summary .sr-chip {
    font-size: 12px;
    padding: 4px 12px;
    cursor: default;
}

.sr-summary .sr-chip:hover {
    transform: none;
}

.sr-summary .sr-chip.sr-plain {
    background: #EDE9FE;
}

/* ---------- Submit ---------- */
.sr-submit {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--sr-brand-primary) 0%, var(--sr-brand-secondary) 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    letter-spacing: 0.5px;
}

.sr-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 43, 224, 0.4);
}

.sr-submit:active:not(:disabled) {
    transform: translateY(0);
}

.sr-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ---------- Terms ---------- */
.sr-terms {
    text-align: center;
    font-size: 13px;
    color: var(--sr-text-muted);
    font-family: 'Cairo', 'Almarai', sans-serif;
    margin: 0;
}

.sr-terms a {
    color: var(--sr-brand-primary);
    text-decoration: none;
    font-weight: 600;
}

.sr-terms a:hover {
    text-decoration: underline;
}

/* ---------- Recaptcha ---------- */
.sr-recaptcha {
    min-height: 78px;
}

.sr-recaptcha > div {
    margin: 0 auto;
}

body.rtl .sr-recaptcha > div {
    margin: 0;
}

/* ---------- Server alert ---------- */
.sr-alert {
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    display: none;
}

.sr-alert.show {
    display: block;
}

.sr-alert.error {
    background: #FEF2F2;
    border: 1.5px solid #FCA5A5;
    color: #991B1B;
}

/* ---------- Loading dots on chips while shipment types load ---------- */
.sr-loading-note {
    font-size: 13px;
    color: var(--sr-text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .sr-page {
        padding: 16px 12px 40px;
    }

    .sr-card {
        padding: 20px;
        border-radius: 16px;
    }

    .sr-hero {
        padding: 20px 20px 18px;
        border-radius: 20px;
    }

    .sr-hero h1 {
        font-size: 22px;
    }

    .sr-grid-2 {
        grid-template-columns: 1fr;
    }

    .sr-car-chip {
        flex: 1 1 30%;
        min-width: 0;
        padding: 10px 8px;
    }

    .sr-pct-row {
        flex-wrap: wrap;
    }

    .sr-pct {
        flex: 1 1 28%;
    }
}

@media (max-width: 400px) {
    .sr-recaptcha {
        overflow-x: auto;
    }

    .sr-chip {
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* ---------- "More cities" dropdown ---------- */
.sr-more {
    position: relative;
    display: inline-flex;
}

.sr-more-btn .sr-more-caret {
    font-size: 11px;
    transition: transform 0.18s ease;
}

.sr-more.open .sr-more-btn {
    border-color: var(--sr-brand-primary);
    box-shadow: 0 0 0 3px rgba(91, 43, 224, 0.12);
}

.sr-more.open .sr-more-btn .sr-more-caret {
    transform: rotate(180deg);
}

.sr-more-panel {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-start: 0;
    min-width: 230px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border: 1.5px solid #EDE9FE;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(91, 43, 224, 0.18);
    padding: 8px;
    z-index: 60;
}

.sr-more-panel[hidden] {
    display: none;
}

.sr-more-search {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--sr-border);
    border-radius: 10px;
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-size: 13px;
    color: var(--sr-text-main);
    background: #FAFAFA;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.sr-more-search:focus {
    border-color: var(--sr-brand-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(91, 43, 224, 0.1);
}

.sr-more-search::placeholder {
    color: #9CA3AF;
}

.sr-more-list {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sr-more-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: 10px;
    font-family: 'Cairo', 'Almarai', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--sr-text-main);
    cursor: pointer;
    text-align: start;
    transition: background 0.12s ease;
}

.sr-more-item:hover {
    background: #F5F3FF;
}

.sr-more-item .fa-check {
    display: none;
    color: var(--sr-brand-primary);
    font-size: 12px;
    flex-shrink: 0;
}

.sr-more-item.selected {
    background: #EDE9FE;
    color: var(--sr-brand-primary);
}

.sr-more-item.selected .fa-check {
    display: inline;
}
