/**
 * Apex Registration Form
 * Branded with General Board for Fairs (GBF) identity
 * Primary: Deep Navy Blue | Accent: Gold
 */

/* ===== متغيرات الهوية البصرية ===== */
.apex-form-wrapper {
    --apex-primary: #0a3d62;
    --apex-primary-dark: #062a44;
    --apex-primary-light: #1e5380;
    --apex-accent: #d4a017;
    --apex-accent-dark: #b8890e;
    --apex-accent-light: #f4c542;
    --apex-text: #1a2332;
    --apex-text-muted: #5a6878;
    --apex-bg: #ffffff;
    --apex-bg-soft: #f5f7fa;
    --apex-bg-section: #fafbfc;
    --apex-border: #e1e7ef;
    --apex-success: #1e7e34;
    --apex-error: #c82333;
    --apex-radius: 10px;
    --apex-radius-sm: 6px;
    --apex-shadow: 0 4px 24px rgba(10, 61, 98, 0.08);
    --apex-shadow-lg: 0 12px 40px rgba(10, 61, 98, 0.12);
    --apex-font: 'Tajawal', 'Cairo', -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* ===== الحاوية الرئيسية ===== */
.apex-form-wrapper {
    max-width: 880px;
    margin: 40px auto;
    background: var(--apex-bg);
    border-radius: var(--apex-radius);
    box-shadow: var(--apex-shadow-lg);
    overflow: hidden;
    font-family: var(--apex-font);
    direction: rtl;
    text-align: right;
    color: var(--apex-text);
    line-height: 1.6;
    position: relative;
    border-top: 4px solid var(--apex-accent);
}

.apex-form-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--apex-accent) 0%, var(--apex-accent-light) 50%, var(--apex-accent) 100%);
    z-index: 1;
}

.apex-form-wrapper *,
.apex-form-wrapper *::before,
.apex-form-wrapper *::after {
    box-sizing: border-box;
}

/* ===== شريط الهوية ===== */
.apex-brand-bar {
    background: linear-gradient(135deg, var(--apex-primary) 0%, var(--apex-primary-dark) 100%);
    padding: 22px 35px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.apex-brand-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--apex-accent) 0%, var(--apex-accent-light) 50%, var(--apex-accent) 100%);
}

.apex-brand-logo {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.97);
    padding: 8px 16px;
    border-radius: 6px;
    height: 56px;
    display: flex;
    align-items: center;
}

.apex-brand-logo img {
    max-height: 40px;
    width: auto;
    display: block;
}

.apex-brand-text {
    flex: 1;
    color: #fff;
}

.apex-brand-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 0.2px;
}

.apex-brand-subtitle {
    font-size: 12px;
    opacity: 0.75;
    letter-spacing: 1px;
    font-weight: 400;
}

/* ===== رأس النموذج ===== */
.apex-form-header {
    padding: 40px 35px 30px;
    text-align: center;
    background: linear-gradient(180deg, var(--apex-bg-soft) 0%, #fff 100%);
    border-bottom: 1px solid var(--apex-border);
    position: relative;
}

.apex-event-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--apex-accent) 0%, var(--apex-accent-dark) 100%);
    color: #fff;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 10px rgba(212, 160, 23, 0.3);
}

.apex-form-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--apex-primary);
    margin: 0 0 14px;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

.apex-form-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: var(--apex-text-muted);
    background: #fff;
    padding: 8px 18px;
    border-radius: 30px;
    border: 1px solid var(--apex-border);
    font-weight: 500;
}

.apex-form-subtitle svg {
    color: var(--apex-accent);
    flex-shrink: 0;
}

/* ===== النموذج ===== */
.apex-form {
    padding: 30px 35px 35px;
}

/* ===== رسائل النموذج ===== */
.apex-form-message {
    padding: 16px 20px;
    margin-bottom: 25px;
    border-radius: var(--apex-radius-sm);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    position: relative;
    padding-right: 50px;
}

.apex-form-message::before {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 700;
}

.apex-form-message.success {
    background: #d4edda;
    color: #155724;
    border-right: 4px solid var(--apex-success);
}
.apex-form-message.success::before { content: '✓'; }

.apex-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border-right: 4px solid var(--apex-error);
}
.apex-form-message.error::before { content: '⚠'; }

/* ===== الأقسام ===== */
.apex-section {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--apex-bg-section);
    border-radius: var(--apex-radius);
    border: 1px solid var(--apex-border);
    transition: border-color 0.2s;
}

.apex-section:hover {
    border-color: rgba(10, 61, 98, 0.2);
}

.apex-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 17px;
    font-weight: 700;
    color: var(--apex-primary);
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 2px dashed var(--apex-border);
}

.apex-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--apex-primary) 0%, var(--apex-primary-light) 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(10, 61, 98, 0.25);
}

.apex-section-desc {
    color: var(--apex-text-muted);
    font-size: 14px;
    margin: -8px 0 18px;
}

/* ===== الحقول ===== */
.apex-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.apex-field {
    margin-bottom: 18px;
}

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

.apex-field label {
    display: block;
    font-weight: 600;
    color: var(--apex-text);
    margin-bottom: 8px;
    font-size: 14px;
    letter-spacing: 0.1px;
}

.apex-required {
    color: var(--apex-error);
    font-weight: 700;
    margin-right: 2px;
}

.apex-field input[type="text"],
.apex-field input[type="email"],
.apex-field input[type="tel"],
.apex-field input[type="date"],
.apex-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--apex-border);
    border-radius: var(--apex-radius-sm);
    background: #fff;
    font-size: 15px;
    font-family: inherit;
    color: var(--apex-text);
    transition: all 0.2s;
    line-height: 1.5;
    direction: rtl;
}

.apex-field input[type="email"],
.apex-field input[type="tel"] {
    direction: ltr;
    text-align: right;
}

.apex-field input::placeholder,
.apex-field textarea::placeholder {
    color: #a0aab8;
    font-size: 14px;
}

.apex-field input:focus,
.apex-field textarea:focus {
    outline: none;
    border-color: var(--apex-primary);
    box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.1);
    background: #fff;
}

.apex-field input.apex-error,
.apex-field textarea.apex-error {
    border-color: var(--apex-error);
    background: #fef5f5;
    animation: apexShake 0.4s;
}

@keyframes apexShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.apex-field textarea {
    resize: vertical;
    min-height: 110px;
    font-family: inherit;
}

/* ===== الشروط ===== */
.apex-terms-section {
    background: #fff;
    border: 1px solid var(--apex-border);
}

.apex-terms-list {
    margin-bottom: 18px;
    max-height: 380px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--apex-border);
    border-radius: var(--apex-radius-sm);
    background: var(--apex-bg-soft);
}

.apex-terms-list::-webkit-scrollbar {
    width: 8px;
}
.apex-terms-list::-webkit-scrollbar-track {
    background: transparent;
}
.apex-terms-list::-webkit-scrollbar-thumb {
    background: var(--apex-primary-light);
    border-radius: 4px;
}

.apex-term-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
    padding: 12px 14px;
    border-radius: var(--apex-radius-sm);
    transition: all 0.2s;
    background: #fff;
    border: 1px solid transparent;
}

.apex-term-item:last-child {
    margin-bottom: 0;
}

.apex-term-item:hover {
    background: #fff;
    border-color: var(--apex-border);
    transform: translateX(-2px);
}

.apex-term-checkbox {
    margin-left: 12px;
    margin-top: 3px;
    flex-shrink: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--apex-primary);
}

.apex-term-item label {
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 0 !important;
    line-height: 1.7;
    color: var(--apex-text);
    flex: 1;
    font-size: 14px;
    display: flex;
    gap: 6px;
}

.apex-term-item:has(input:checked) {
    background: #f0f7ec;
    border-color: #c8e1bd;
}

.apex-term-num {
    color: var(--apex-accent-dark);
    font-weight: 700;
    flex-shrink: 0;
}

.apex-btn-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid var(--apex-primary);
    color: var(--apex-primary);
    padding: 9px 20px;
    border-radius: var(--apex-radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.apex-btn-select-all:hover {
    background: var(--apex-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 61, 98, 0.2);
}

.apex-btn-select-all.is-active {
    background: var(--apex-primary);
    color: #fff;
}

/* ===== معلومات الاتصال ===== */
.apex-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 25px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fff8e7 0%, #fef3d4 100%);
    border-right: 4px solid var(--apex-accent);
    border-radius: var(--apex-radius-sm);
    font-size: 14px;
    color: var(--apex-text);
}

.apex-contact-info svg {
    color: var(--apex-accent-dark);
    flex-shrink: 0;
}

.apex-contact-info strong {
    color: var(--apex-primary);
    font-weight: 700;
}

/* ===== زر الإرسال ===== */
.apex-submit-wrapper {
    text-align: center;
    margin-top: 30px;
}

.apex-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--apex-primary) 0%, var(--apex-primary-light) 100%);
    color: #fff;
    padding: 14px 50px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
    min-width: 200px;
    box-shadow: 0 6px 20px rgba(10, 61, 98, 0.25);
    position: relative;
    overflow: hidden;
}

.apex-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.apex-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(10, 61, 98, 0.35);
}

.apex-submit-btn:hover:not(:disabled)::before {
    left: 100%;
}

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

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

.apex-submit-btn.is-loading {
    pointer-events: none;
}

.apex-submit-btn.is-loading .apex-btn-icon {
    animation: apexSpin 1s linear infinite;
}

@keyframes apexSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.apex-btn-icon {
    transform: scaleX(-1);
}

/* ===== التذييل ===== */
.apex-form-footer {
    background: var(--apex-bg-soft);
    padding: 18px 35px;
    text-align: center;
    border-top: 1px solid var(--apex-border);
    font-size: 13px;
    color: var(--apex-text-muted);
}

.apex-form-footer p {
    margin: 0;
}

/* ===== استجابة الموبايل ===== */
@media (max-width: 768px) {
    .apex-form-wrapper {
        margin: 15px;
        border-radius: 8px;
    }

    .apex-brand-bar {
        padding: 16px 20px;
        gap: 12px;
    }

    .apex-brand-logo {
        padding: 6px 12px;
        height: 46px;
    }

    .apex-brand-logo img {
        max-height: 32px;
    }

    .apex-brand-title {
        font-size: 15px;
    }

    .apex-brand-subtitle {
        font-size: 11px;
    }

    .apex-form-header {
        padding: 25px 20px 22px;
    }

    .apex-form-title {
        font-size: 20px;
    }

    .apex-form {
        padding: 20px;
    }

    .apex-section {
        padding: 18px;
    }

    .apex-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .apex-submit-btn {
        width: 100%;
        padding: 14px 30px;
    }

    .apex-form-footer {
        padding: 14px 20px;
        font-size: 12px;
    }

    .apex-terms-list {
        max-height: 320px;
    }
}

@media (max-width: 480px) {
    .apex-brand-text {
        min-width: 0;
    }

    .apex-brand-title {
        font-size: 13px;
        line-height: 1.3;
    }

    .apex-form-title {
        font-size: 18px;
    }

    .apex-event-badge {
        font-size: 11px;
        padding: 5px 14px;
    }
}
