:root {
    --bg-base: #060913;
    --bg-surface: rgba(14, 21, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-highlight: rgba(255, 255, 255, 0.22);
    --accent-blue: #3b82f6;
    --accent-indigo: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-heading: 'Sora', sans-serif;
}

[dir="rtl"] {
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    min-height: 100vh;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background Scene with Ambient Orbs */
.scene-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.aurora-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
    animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-1 {
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.6) 0%, rgba(59, 130, 246, 0.2) 60%, transparent 80%);
    top: -10%;
    left: 10%;
    animation-duration: 22s;
}

.orb-2 {
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.5) 0%, rgba(217, 70, 239, 0.2) 60%, transparent 80%);
    bottom: -15%;
    right: 5%;
    animation-duration: 26s;
    animation-delay: -5s;
}

.orb-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.45) 0%, rgba(16, 185, 129, 0.2) 60%, transparent 80%);
    top: 40%;
    left: 70%;
    animation-duration: 20s;
    animation-delay: -10s;
}

.cyber-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
}

#particleCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, -40px) scale(1.12); }
    100% { transform: translate(-40px, 50px) scale(0.92); }
}

/* 3D Floating Glass Geometric Shapes */
.floating-shapes {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.glass-crystal {
    position: absolute;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(255, 255, 255, 0.08);
}

.shape-cube {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    top: 15%;
    left: 8%;
    transform: rotate(25deg);
    animation: floatCrystal 9s ease-in-out infinite;
}

.shape-diamond {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    bottom: 20%;
    left: 12%;
    transform: rotate(45deg);
    animation: floatCrystal 12s ease-in-out infinite 2s;
}

.shape-ring {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    top: 25%;
    right: 10%;
    animation: floatCrystal 10s ease-in-out infinite 1s;
}

@keyframes floatCrystal {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-24px) rotate(8deg); }
}

/* Main Layout */
.app-container {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Header */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 36px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: transform 0.3s ease;
}

.brand-wrapper:hover .brand-icon {
    transform: scale(1.06) rotate(3deg);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 11px;
    color: var(--accent-cyan);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Language Dropdown Selector */
.lang-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
}

[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

.lang-dropdown.active {
    display: flex;
    animation: dropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.lang-option.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.2));
    color: #ffffff;
    font-weight: 700;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* 3D Glass Card Container */
.main-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 48px;
    perspective: 1200px;
}

.card-3d-wrapper {
    width: 100%;
    max-width: 480px;
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
}

.glass-card {
    position: relative;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.02) 100%);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 38px 34px;
    box-shadow: 
        0 35px 80px rgba(0, 0, 0, 0.65),
        0 0 50px rgba(99, 102, 241, 0.12),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transform-style: preserve-3d;
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, transparent 40%, rgba(6, 182, 212, 0.4) 80%, rgba(99, 102, 241, 0.4) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Card Header Elements */
.card-header {
    text-align: center;
    transform: translateZ(35px);
    margin-bottom: 28px;
}

.route-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: 18px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.route-badge .badge-source {
    color: #fca5a5;
}

.route-badge .badge-arrow {
    color: var(--accent-cyan);
    font-size: 14px;
    animation: pulseArrow 1.5s infinite alternate;
}

.route-badge .badge-target {
    color: #86efac;
}

@keyframes pulseArrow {
    0% { transform: translateX(-2px); opacity: 0.7; }
    100% { transform: translateX(2px); opacity: 1; }
}

.card-title {
    font-family: var(--font-heading);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.6px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto;
}

/* Notice Box */
.notice-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 24px;
    transform: translateZ(25px);
}

.notice-box i {
    color: var(--accent-rose);
    font-size: 18px;
    margin-top: 1px;
    flex-shrink: 0;
}

.notice-box span {
    font-size: 12px;
    color: #fecdd3;
    line-height: 1.5;
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
    transform: translateZ(30px);
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-hint {
    font-size: 11px;
    color: var(--accent-cyan);
    font-weight: 600;
    background: rgba(6, 182, 212, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

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

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
    transition: color 0.2s ease;
}

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

.glass-input {
    width: 100%;
    height: 50px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 0 46px 0 46px;
    color: #ffffff;
    font-family: var(--font-main);
    font-size: 14.5px;
    outline: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

[dir="rtl"] .glass-input {
    padding: 0 46px 0 46px;
}

.glass-input:focus {
    border-color: var(--accent-indigo);
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 
        0 0 0 3px rgba(99, 102, 241, 0.25),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.glass-input:focus + .input-icon {
    color: var(--accent-indigo);
}

.glass-input::placeholder {
    color: var(--text-muted);
    font-size: 13.5px;
}

.password-toggle-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

[dir="rtl"] .password-toggle-btn {
    right: auto;
    left: 14px;
}

.password-toggle-btn:hover {
    color: var(--text-primary);
}

/* Alert Message */
.inline-alert {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
    transform: translateZ(25px);
    animation: shakeAlert 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.inline-alert.error {
    display: flex;
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fecdd3;
}

.inline-alert i {
    font-size: 18px;
    color: var(--accent-rose);
    flex-shrink: 0;
}

@keyframes shakeAlert {
    10%, 90% { transform: translate3d(-1px, 0, 25px); }
    20%, 80% { transform: translate3d(2px, 0, 25px); }
    30%, 50%, 70% { transform: translate3d(-3px, 0, 25px); }
    40%, 60% { transform: translate3d(3px, 0, 25px); }
}

/* Submit Button */
.submit-btn {
    position: relative;
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-blue) 50%, var(--accent-cyan) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 
        0 12px 30px rgba(99, 102, 241, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transform: translateZ(35px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-btn:hover {
    transform: translateZ(42px) scale(1.015);
    box-shadow: 
        0 16px 36px rgba(99, 102, 241, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.submit-btn:active {
    transform: translateZ(28px) scale(0.985);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: translateZ(30px);
}

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

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

.submit-btn.loading .btn-text,
.submit-btn.loading .btn-icon {
    display: none;
}

.submit-btn.loading .btn-spinner {
    display: inline-block;
}

/* Back Link */
.card-footer-links {
    margin-top: 24px;
    text-align: center;
    transform: translateZ(20px);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text-primary);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px;
    font-size: 12.5px;
    color: var(--text-muted);
}

/* 3D Success Dialog Modal */
.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(3, 7, 18, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dialog-overlay.active {
    display: flex;
    opacity: 1;
}

.dialog-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 26px;
    padding: 36px 30px;
    text-align: center;
    box-shadow: 
        0 30px 90px rgba(0, 0, 0, 0.8),
        0 0 60px rgba(16, 185, 129, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.dialog-overlay.active .dialog-card {
    transform: scale(1) translateY(0);
}

.dialog-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-icon-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
    animation: pulseRing 2s infinite;
}

.dialog-icon-circle {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 34px;
}

@keyframes pulseRing {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 0.3; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.dialog-title {
    font-family: var(--font-heading);
    font-size: 23px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 12px;
}

.dialog-message {
    font-size: 15px;
    color: #e2e8f0;
    line-height: 1.6;
    margin-bottom: 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 14px;
    padding: 16px;
    word-break: break-word;
}

.dialog-message strong {
    color: #a7f3d0;
    font-weight: 700;
}

.dialog-sub {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.dialog-btn {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #059669 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

.dialog-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(16, 185, 129, 0.55);
}

/* Confetti canvas */
#confettiCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}

/* Responsive */
@media (max-width: 600px) {
    .top-nav {
        padding: 18px 20px;
    }
    .glass-card {
        padding: 30px 22px;
        border-radius: 22px;
    }
    .card-title {
        font-size: 22px;
    }
    .card-desc {
        font-size: 13px;
    }
    .floating-shapes {
        display: none;
    }
}
