/* ========== Design Tokens ========== */
:root {
    --bg: #06060b;
    --surface: rgba(14, 14, 24, 0.75);
    --surface-hover: rgba(20, 20, 35, 0.85);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(108, 99, 255, 0.3);
    --accent: #7c6aff;
    --accent-light: #9b8aff;
    --accent-glow: rgba(124, 106, 255, 0.25);
    --accent2: #ff6b8a;
    --accent2-glow: rgba(255, 107, 138, 0.2);
    --text: #eaeaf5;
    --text-secondary: #8888a8;
    --muted: #5a5a78;
    --success: #00d68f;
    --success-bg: rgba(0, 214, 143, 0.08);
    --error: #ff4d6d;
    --error-bg: rgba(255, 77, 109, 0.08);
    --radius: 16px;
    --radius-sm: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset ========== */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

/* ========== Body ========== */
body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== Background ========== */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(124, 106, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 106, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 40%, transparent 100%);
}

#particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(80px);
    z-index: 0;
}

.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(124, 106, 255, 0.12) 0%, transparent 70%);
    top: -150px; right: -100px;
    animation: float-orb 12s ease-in-out infinite;
}

.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255, 107, 138, 0.08) 0%, transparent 70%);
    bottom: -100px; left: -80px;
    animation: float-orb 15s ease-in-out infinite reverse;
}

.orb-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(124, 106, 255, 0.06) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation: float-orb 10s ease-in-out infinite 3s;
}

@keyframes float-orb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ========== Container ========== */
.container {
    background: var(--surface);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 48px 44px;
    max-width: 560px;
    width: 100%;
    position: relative;
    z-index: 1;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.03) inset,
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 24px 80px rgba(0, 0, 0, 0.4),
        0 0 120px var(--accent-glow);
    animation: container-enter 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 40px; right: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
    opacity: 0.6;
}

.container::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 40%);
    pointer-events: none;
}

@keyframes container-enter {
    from { opacity: 0; transform: translateY(40px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========== Header ========== */
.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.logo-wrapper {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 20px;
    animation: logo-enter 0.6s ease both 0.2s;
}

.logo-text {
    font-size: 1.8em;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-dot {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--text-secondary);
}

@keyframes logo-enter {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.header h1 {
    font-size: 2.4em;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 8px;
    animation: text-enter 0.6s ease both 0.3s;
}

.wave {
    display: inline-block;
    animation: wave-anim 2.5s ease-in-out infinite;
    transform-origin: 70% 70%;
}

@keyframes wave-anim {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); }
    50% { transform: rotate(10deg); }
    60%, 100% { transform: rotate(0deg); }
}

.header p {
    color: var(--text-secondary);
    font-size: 1.05em;
    font-weight: 400;
    animation: text-enter 0.6s ease both 0.4s;
}

@keyframes text-enter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Language Toggle ========== */
.lang-toggle {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 16px;
    border-radius: 100px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.82em;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
}

.lang-toggle:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(124, 106, 255, 0.08);
    transform: translateY(-1px);
}

.lang-toggle svg {
    width: 14px; height: 14px;
    opacity: 0.7;
}

/* ========== Form Groups ========== */
.form-group {
    margin-bottom: 20px;
    opacity: 0;
    animation: field-enter 0.5s ease both;
}

.form-group:nth-child(1) { animation-delay: 0.5s; }
.form-group:nth-child(2) { animation-delay: 0.6s; }
.form-group:nth-child(3) { animation-delay: 0.7s; }
.form-group:nth-child(4) { animation-delay: 0.8s; }

@keyframes field-enter {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Floating Label Inputs ========== */
.input-wrapper {
    position: relative;
}

.input-wrapper label {
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--muted);
    font-size: 0.92em;
    font-weight: 400;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: right;
}

[dir="ltr"] .input-wrapper label {
    right: auto;
    left: 16px;
    transform-origin: left;
}

.input-wrapper input:focus ~ label,
.input-wrapper input:not(:placeholder-shown) ~ label,
.input-wrapper textarea:focus ~ label,
.input-wrapper textarea:not(:placeholder-shown) ~ label {
    top: -10px;
    right: 12px;
    font-size: 0.78em;
    color: var(--accent-light);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 6px;
}

[dir="ltr"] .input-wrapper input:focus ~ label,
[dir="ltr"] .input-wrapper input:not(:placeholder-shown) ~ label,
[dir="ltr"] .input-wrapper textarea:focus ~ label,
[dir="ltr"] .input-wrapper textarea:not(:placeholder-shown) ~ label {
    right: auto;
    left: 12px;
}

.input-wrapper input,
.input-wrapper textarea {
    width: 100%;
    padding: 15px 16px;
    background: rgba(6, 6, 11, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    font-family: 'Tajawal', sans-serif;
    color: var(--text);
    transition: var(--transition);
    resize: vertical;
    direction: inherit;
    outline: none;
}

.input-wrapper textarea {
    min-height: 110px;
}

.input-wrapper input::placeholder,
.input-wrapper textarea::placeholder {
    color: transparent;
}

.input-wrapper input:hover,
.input-wrapper textarea:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(6, 6, 11, 0.8);
}

.input-wrapper input:focus,
.input-wrapper textarea:focus {
    border-color: var(--accent);
    background: rgba(10, 10, 20, 0.9);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 30px rgba(124, 106, 255, 0.08);
}

.input-glow {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    border-radius: 2px;
}

.input-wrapper input:focus ~ .input-glow,
.input-wrapper textarea:focus ~ .input-glow {
    width: calc(100% - 24px);
}

.char-counter {
    position: absolute;
    top: -10px;
    left: 12px;
    font-size: 0.72em;
    color: var(--muted);
    font-weight: 300;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

[dir="ltr"] .char-counter {
    left: auto;
    right: 12px;
}

.input-wrapper input:focus ~ .char-counter,
.input-wrapper textarea:focus ~ .char-counter {
    opacity: 1;
}

.char-limit-warning { color: var(--error) !important; }

/* ========== Submit Button ========== */
.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--accent), #6355e0);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.05em;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    animation: field-enter 0.5s ease both 0.9s;
}

.submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.submit-btn:hover::before { opacity: 1; }

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(124, 106, 255, 0.4), 0 0 60px rgba(124, 106, 255, 0.15);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(124, 106, 255, 0.3);
}

.submit-btn:disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.submit-btn:disabled::before { display: none; }

.btn-icon svg {
    transition: transform 0.3s;
}

.submit-btn:hover .btn-icon svg {
    transform: translate(-3px, -3px);
}

[dir="ltr"] .submit-btn:hover .btn-icon svg {
    transform: translate(3px, -3px);
}

.spinner {
    width: 22px; height: 22px;
    border: 2.5px solid rgba(255,255,255,0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ========== Message Box ========== */
.message {
    margin-top: 20px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 500;
    display: none;
    font-size: 0.95em;
    animation: msg-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    backdrop-filter: blur(10px);
}

@keyframes msg-enter {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(0, 214, 143, 0.2);
}

.message.error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(255, 77, 109, 0.2);
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82em;
    opacity: 0;
    animation: field-enter 0.5s ease both 1s;
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
    body { padding: 16px; }
    .container { padding: 32px 24px; border-radius: 24px; }
    .header h1 { font-size: 1.9em; }
    .logo-text { font-size: 1.5em; }
    .orb-1 { width: 300px; height: 300px; }
    .orb-2 { width: 250px; height: 250px; }
    .orb-3 { display: none; }
}

@media (max-width: 380px) {
    .container { padding: 24px 18px; }
    .header h1 { font-size: 1.6em; }
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(124, 106, 255, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(124, 106, 255, 0.5); }

/* ========== Selection ========== */
::selection {
    background: rgba(124, 106, 255, 0.3);
    color: #fff;
}
