:root {
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-light: #a78bfa;
    --primary-glow: rgba(124, 58, 237, 0.35);
    --accent: #38bdf8;
    --bg-dark: #090d16;
    --bg-card: rgba(15, 23, 42, 0.75);
    --border-glass: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(124, 58, 237, 0.6);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-sub: #cbd5e1;
    --success: #10b981;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    transition: direction 0.3s ease;
}

/* Dynamic Background Elements */
.bg-glow {
    position: fixed;
    width: 550px;
    height: 550px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.45;
    animation: floatGlow 14s infinite alternate ease-in-out;
}

.bg-glow-1 {
    top: -100px;
    right: -100px;
    background: radial-gradient(circle, #7c3aed 0%, rgba(124, 58, 237, 0) 70%);
}

.bg-glow-2 {
    bottom: -120px;
    left: -120px;
    background: radial-gradient(circle, #2563eb 0%, rgba(37, 99, 235, 0) 70%);
    animation-delay: -7s;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 40px) scale(1.15); }
}

/* Container Card */
.card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    padding: 36px 36px 40px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7),
                0 0 40px 0 var(--primary-glow);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Top Action Bar (Language Switcher) */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 12px;
}

html[dir="ltr"] .top-bar {
    justify-content: flex-end;
}

.lang-switch-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-sub);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s ease;
}

.lang-switch-btn:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: var(--primary-light);
    color: #ffffff;
    transform: translateY(-1px);
}

.lang-switch-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* Header */
.brand-header {
    text-align: center;
    margin-bottom: 24px;
}

.brand-logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25) 0%, rgba(37, 99, 235, 0.25) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 16px;
    box-shadow: 0 8px 24px var(--primary-glow);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--primary-light);
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

.badge-dot {
    width: 7px;
    height: 7px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.title {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    text-align: right;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 8px;
}

.form-label span.req {
    color: var(--danger);
    margin-right: 4px;
}

html[dir="ltr"] .form-label span.req {
    margin-right: 0;
    margin-left: 4px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

html[dir="rtl"] .input-wrapper .input-icon {
    right: 16px;
    left: auto;
}

html[dir="ltr"] .input-wrapper .input-icon {
    left: 16px;
    right: auto;
}

.input-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    transition: stroke 0.25s ease;
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--border-glass);
    border-radius: 14px;
    padding: 14px 46px 14px 16px;
    font-size: 15px;
    color: #ffffff;
    outline: none;
    transition: all 0.25s ease;
}

html[dir="ltr"] .input-wrapper .form-control {
    padding: 14px 16px 14px 46px;
}

html[dir="rtl"] .input-wrapper .form-control {
    padding: 14px 46px 14px 16px;
}

.form-control::placeholder {
    color: #475569;
    font-size: 13.5px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: rgba(15, 23, 42, 0.9);
}

.form-control:focus + .input-icon svg,
.input-wrapper:focus-within .input-icon svg {
    stroke: var(--primary-light);
}

.phone-input-group {
    display: flex;
    gap: 8px;
    direction: ltr; /* Always keep phone format logical */
}

.country-code-select {
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid var(--border-glass);
    border-radius: 14px;
    padding: 14px 10px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    width: 112px;
    transition: all 0.25s ease;
    text-align: center;
}

.country-code-select:focus {
    border-color: var(--primary);
}

.country-code-select option {
    background: #0f172a;
    color: #ffffff;
}

.phone-control {
    padding-right: 16px !important;
    padding-left: 16px !important;
    direction: ltr;
    text-align: left;
}

/* Error States */
.form-control.is-invalid,
.country-code-select.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

.error-msg {
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    display: none;
}

.shake {
    animation: shakeAnim 0.4s ease-in-out;
}

@keyframes shakeAnim {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Action Button */
.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    border: none;
    border-radius: 16px;
    padding: 16px 24px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.5);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 26px;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -4px rgba(124, 58, 237, 0.7);
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

.submit-btn:active {
    transform: translateY(1px);
}

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

/* Spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success Overlay Screen */
.success-box {
    display: none;
    text-align: center;
    padding: 20px 0;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.success-icon {
    width: 72px;
    height: 72px;
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid var(--success);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.success-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--success);
}

.redirect-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 14px;
    line-height: 1.6;
}

.manual-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--accent);
    text-decoration: underline;
    font-size: 14px;
    font-weight: 700;
}

/* Footer Guarantee */
.footer-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

.footer-note svg {
    width: 14px;
    height: 14px;
    stroke: #64748b;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .card {
        padding: 28px 18px 32px;
        border-radius: 22px;
    }
    .title {
        font-size: 22px;
    }
    .country-code-select {
        width: 96px;
        font-size: 12.5px;
        padding: 12px 6px;
    }
}
