:root {
    --primary: #6f3df4;
    --primary-dark: #5426d6;
    --primary-soft: #f1ebff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --background: #f7f8fc;
    --white: #ffffff;
    --danger-bg: #fff1f2;
    --danger-text: #b42318;
    --shadow: 0 20px 50px rgba(42, 24, 92, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(
            circle at top right,
            rgba(111, 61, 244, 0.12),
            transparent 35%
        ),
        linear-gradient(
            180deg,
            #fbfbfe 0%,
            var(--background) 100%
        );
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

[hidden] {
    display: none !important;
}

.language-switcher {
    position: fixed;
    top: 18px;
    inset-inline-end: 22px;
    z-index: 10;
    display: flex;
    gap: 8px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
    backdrop-filter: blur(12px);
}

.language-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 9px 13px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.language-switcher a.active {
    color: var(--white);
    background: var(--primary);
    text-decoration: none;
}

.registration-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 90px 20px 40px;
}

.registration-card {
    width: min(100%, 640px);
    padding: 38px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.registration-header {
    margin-bottom: 28px;
    text-align: center;
}

.registration-header::before {
    content: "A";
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 18px;
    color: var(--white);
    background: linear-gradient(
        135deg,
        var(--primary),
        #9b6cff
    );
    font-size: 28px;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(111, 61, 244, 0.28);
}

.registration-header h1 {
    margin: 0 0 10px;
    font-size: clamp(27px, 5vw, 38px);
    line-height: 1.25;
}

.registration-header p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.alert {
    margin-bottom: 22px;
    padding: 16px 18px;
    border-radius: 14px;
    line-height: 1.7;
}

.alert ul {
    margin: 0;
    padding-inline-start: 20px;
}

.alert-error {
    color: var(--danger-text);
    background: var(--danger-bg);
    border: 1px solid #fecdd3;
}

.registration-form {
    display: grid;
    gap: 18px;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.form-group input,
.form-group select {
    min-height: 50px;
    padding: 0 15px;
}

.form-group textarea {
    padding: 14px;
    resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #a0a6b2;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(111, 61, 244, 0.12);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #c7b8fb;
}

.conditional-group {
    padding: 16px;
    background: var(--primary-soft);
    border: 1px solid #ddd0ff;
    border-radius: 16px;
}

.submit-button {
    width: 100%;
    min-height: 54px;
    margin-top: 4px;
    color: var(--white);
    background: linear-gradient(
        135deg,
        var(--primary),
        #8657ff
    );
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 14px 26px rgba(111, 61, 244, 0.24);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

.submit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(111, 61, 244, 0.3);
}

.submit-button:active {
    transform: translateY(0);
}

.login-link {
    margin-top: 24px;
    padding-top: 20px;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.login-link a {
    font-weight: 800;
}

html[dir="rtl"] .form-group input,
html[dir="rtl"] .form-group select,
html[dir="rtl"] .form-group textarea {
    text-align: right;
}

html[dir="ltr"] .form-group input,
html[dir="ltr"] .form-group select,
html[dir="ltr"] .form-group textarea {
    text-align: left;
}

/* النافذة المنبثقة */

.success-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
}

.success-modal {
    width: min(100%, 430px);
    padding: 34px 24px;
    text-align: center;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
    animation: modalAppear 0.25s ease;
}

.success-icon {
    margin-bottom: 14px;
    font-size: 54px;
}

.success-modal h2 {
    margin: 0 0 12px;
    font-size: 28px;
}

.success-modal p {
    margin: 0 0 24px;
    color: #6b7280;
    line-height: 1.8;
}

.whatsapp-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 18px;
    color: #ffffff;
    background: #25d366;
    border-radius: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 14px 30px rgba(37, 211, 102, 0.28);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.whatsapp-button:hover {
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(37, 211, 102, 0.34);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 640px) {
    .language-switcher {
        position: static;
        width: fit-content;
        margin: 16px auto 0;
    }

    .registration-page {
        min-height: auto;
        padding: 24px 14px 30px;
    }

    .registration-card {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .registration-header {
        margin-bottom: 22px;
    }

    .registration-header::before {
        width: 56px;
        height: 56px;
        border-radius: 16px;
        font-size: 24px;
    }

    .success-modal {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .success-modal h2 {
        font-size: 24px;
    }
    .home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    margin-top: 14px;
    padding: 0 18px;
    color: #ffffff;
    background: #6f3df4;
    border-radius: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 14px 30px rgba(111,61,244,.28);
    transition: .25s;
}

.home-button:hover {
    color: #ffffff;
    background: #5426d6;
    text-decoration: none;
    transform: translateY(-2px);
}

}

/* =========================================================
   القوائم المخصصة وحركات حقول التسجيل
   ========================================================= */

body.custom-select-open {
    overflow: hidden;
    touch-action: none;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    cursor: pointer;
    text-align: inherit;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease,
        background-color 0.2s ease;
}

.custom-select-trigger:hover {
    border-color: #c7b8fb;
    transform: translateY(-1px);
}

.custom-select-trigger:focus-visible,
.custom-select-trigger[aria-expanded="true"] {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(111, 61, 244, 0.12);
}

.custom-select-trigger:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.custom-select-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.custom-select-value.is-placeholder {
    color: #9ca3af;
    font-weight: 500;
}

.custom-select-arrow {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-inline-end: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: 0.65;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.22s ease;
}

.custom-select-trigger[aria-expanded="true"]
.custom-select-arrow {
    transform: rotate(225deg) translate(-2px, -2px);
}

.custom-select-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(15, 23, 42, 0.58);
    opacity: 0;
    backdrop-filter: blur(5px);
    transition: opacity 0.22s ease;
}

.custom-select-backdrop.is-open {
    opacity: 1;
}

.custom-select-sheet {
    position: fixed;
    inset-inline: 12px;
    bottom: 12px;
    z-index: 9999;
    width: auto;
    max-height: min(76vh, 620px);
    padding: 10px 14px 16px;
    overflow: hidden;
    color: var(--text);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(229, 231, 235, 0.92);
    border-radius: 26px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.32);
    opacity: 0;
    transform: translateY(calc(100% + 28px));
    transition:
        opacity 0.22s ease,
        transform 0.22s cubic-bezier(.2, .8, .2, 1);
}

.custom-select-sheet.is-open {
    opacity: 1;
    transform: translateY(0);
}

.custom-select-sheet-handle {
    width: 46px;
    height: 5px;
    margin: 2px auto 9px;
    background: #d1d5db;
    border-radius: 999px;
}

.custom-select-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 4px 13px;
    border-bottom: 1px solid var(--border);
}

.custom-select-sheet-header h2 {
    margin: 0;
    font-size: 19px;
    line-height: 1.4;
}

.custom-select-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--muted);
    background: #f3f4f6;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 25px;
    line-height: 1;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.custom-select-close:hover {
    color: var(--primary);
    background: var(--primary-soft);
    transform: rotate(4deg);
}

.custom-select-options {
    display: grid;
    gap: 9px;
    max-height: calc(76vh - 105px);
    padding-top: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.custom-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 58px;
    padding: 12px 15px;
    color: var(--text);
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    cursor: pointer;
    text-align: inherit;
    font-weight: 700;
    transition:
        color 0.18s ease,
        border-color 0.18s ease,
        background-color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
    border-color: #c7b8fb;
    background: #faf8ff;
    outline: none;
    transform: translateY(-1px);
}

.custom-select-option.is-selected {
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(111, 61, 244, 0.12);
}

.custom-select-check {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 27px;
    height: 27px;
    color: transparent;
    background: transparent;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 900;
    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.custom-select-option.is-selected
.custom-select-check {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.06);
}

.conditional-group {
    max-height: 600px;
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
    transition:
        max-height 0.23s ease,
        opacity 0.2s ease,
        transform 0.23s ease,
        padding 0.23s ease,
        border-width 0.23s ease;
}

.conditional-group:not(.is-visible) {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    opacity: 0;
    transform: translateY(-8px);
}

.submit-button {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.submit-button::before {
    content: "";
    position: absolute;
    inset-block: 0;
    left: -45%;
    z-index: -1;
    width: 32%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.32),
        transparent
    );
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.submit-button:hover::before {
    left: 115%;
}

.submit-button:active {
    transform: translateY(1px) scale(0.995);
}

@media (min-width: 768px) {
    .custom-select-sheet {
        inset-inline: auto;
        top: 50%;
        bottom: auto;
        left: 50%;
        width: min(92vw, 470px);
        transform: translate(-50%, calc(-50% + 24px)) scale(0.98);
    }

    .custom-select-sheet.is-open {
        transform: translate(-50%, -50%) scale(1);
    }

    .custom-select-sheet-handle {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .custom-select-trigger,
    .custom-select-arrow,
    .custom-select-backdrop,
    .custom-select-sheet,
    .custom-select-option,
    .custom-select-check,
    .conditional-group,
    .submit-button,
    .submit-button::before {
        transition: none !important;
        animation: none !important;
    }
}

/* =========================================================
   إصلاح ظهور جميع خيارات الحقول الشرطية
   ========================================================= */

.conditional-group.is-visible {
    overflow: visible !important;
    transform: none !important;
}

.conditional-group:not(.is-visible) {
    overflow: hidden !important;
}

.custom-select-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483646 !important;
}

.custom-select-sheet {
    position: fixed !important;
    z-index: 2147483647 !important;
}

.registration-card,
.registration-form,
.form-group,
.custom-select {
    overflow: visible;
}

