@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@300;400;500;600;700;800&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    min-height: 100vh;
    background: #ffffff;
    overflow-x: hidden;
    position: relative;
    direction: rtl;
}

/* ========== PARTICLES ========== */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.particles {
    position: relative;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: linear-gradient(45deg, #5B4BFF, #2E2A6F);
    border-radius: 50%;
    animation: floatParticle 6s ease-in-out infinite;
    opacity: 0.22;
}

.particle:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { top: 60%; left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { top: 40%; left: 80%; animation-delay: 2s; }
.particle:nth-child(4) { top: 80%; left: 70%; animation-delay: 3s; }
.particle:nth-child(5) { top: 30%; left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { top: 70%; left: 30%; animation-delay: 5s; }
.particle:nth-child(7) { top: 10%; left: 90%; animation-delay: 6s; }
.particle:nth-child(8) { top: 90%; left: 10%; animation-delay: 7s; }

@keyframes floatParticle {
    0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.22; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 0.55; }
}

/* ========== LEFT SIDE ========== */
.left-side {
    flex: 1;
    display: flex;
    background: linear-gradient(135deg, #5B4BFF 0%, #2E2A6F 100%);
    justify-content: center;
    align-items: center;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.left-side::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 70%);
    animation: bgRotate 22s linear infinite;
}

.left-side::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    animation: bgRotate 28s linear infinite reverse;
}

@keyframes bgRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animated-content {
    text-align: center;
    color: white;
    z-index: 2;
    position: relative;
    max-width: 500px;
}

/* ========== EMAIL ANIMATION ========== */
.email-animation {
    margin-bottom: 40px;
}

.email-container {
    display: inline-block;
    animation: emailFloat 3s ease-in-out infinite;
}

.email-icon {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.envelope {
    width: 100%;
    height: 100%;
}

.envelope-body {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: envelopePulse 2s ease-in-out infinite;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: rgba(255,255,255,0.1);
    border-radius: 24px 24px 0 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    animation: flapOpen 3s ease-in-out infinite;
}

.envelope-content {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    height: 55%;
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.letter {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.letter-content {
    width: 80%;
}

.code-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.dot {
    width: 8px;
    height: 8px;
    background: #5B4BFF;
    border-radius: 50%;
    animation: dotBlink 1.5s ease-in-out infinite;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
.dot:nth-child(4) { animation-delay: 0.45s; }
.dot:nth-child(5) { animation-delay: 0.6s; }
.dot:nth-child(6) { animation-delay: 0.75s; }

@keyframes emailFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
}

@keyframes envelopePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
    50% { transform: scale(1.05); box-shadow: 0 18px 50px rgba(0,0,0,0.3); }
}

@keyframes flapOpen {
    0%, 40%, 100% { transform: rotateX(0deg); }
    20% { transform: rotateX(-30deg); }
}

@keyframes dotBlink {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.4); opacity: 1; }
}

/* Welcome text */
.welcome-text {
    margin-bottom: 40px;
}

.welcome-text h1 {
    font-size: 2.3rem;
    font-weight: 800;
    margin-bottom: 15px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.gradient-text {
    background: linear-gradient(45deg, #ffffff, rgba(255,255,255,0.8), #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-text p {
    font-size: 1.05rem;
    opacity: 0.88;
    line-height: 1.75;
}

/* Recovery features */
.recovery-features {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.feature-item:nth-child(1) { animation-delay: 0.2s; }
.feature-item:nth-child(2) { animation-delay: 0.4s; }
.feature-item:nth-child(3) { animation-delay: 0.6s; }

.feature-icon {
    font-size: 2rem;
    animation: iconBounce 2s ease-in-out infinite;
}

.feature-item span {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

/* ========== RIGHT SIDE ========== */
.right-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: #fff;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.content {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

/* Site header */
.site-header-center {
    margin-bottom: 32px;
}

.logo-large-container {
    display: flex;
    justify-content: center;
}

.logo-large {
    height: 80px;
    width: auto;
    object-fit: contain;
    transition: all 0.3s ease;
}

.logo-large:hover { transform: scale(1.04); }

/* Titles */
.content h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #1E1E2F;
    margin-bottom: 12px;
}

.content > p {
    color: #6B6F85;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 32px;
}

/* Animation classes */
.animate-fade-in {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.6s ease;
}

.animate-slide-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.animate-input {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s ease;
    width: 100%;
}

.animate-button {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.6s ease;
}

/* Input group */
.input-group {
    position: relative;
    margin-bottom: 28px;
    width: 100%;
    text-align: right;
}

.input-group input {
    width: 100%;
    padding: 18px 15px;
    border: 2px solid #e8e8f0;
    border-radius: 12px;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #F6F7FB;
    direction: rtl;
    color: #1E1E2F;
}

.input-group input:focus {
    border-color: #5B4BFF;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(91, 75, 255, 0.1);
    transform: translateY(-2px);
}

.floating-label {
    position: absolute;
    right: 15px;
    top: 18px;
    transition: all 0.3s ease;
    color: #6B6F85;
    pointer-events: none;
    background: transparent;
    padding: 0 5px;
    font-size: 15px;
}

.input-group input:focus ~ .floating-label,
.input-group input:not(:placeholder-shown) ~ .floating-label {
    top: -10px;
    font-size: 12px;
    color: #5B4BFF;
    background: #fff;
    font-weight: 700;
}

/* Submit button */
button[type="submit"] {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #5B4BFF, #2E2A6F);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-family: inherit;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(91, 75, 255, 0.3);
}

button[type="submit"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

button[type="submit"]:hover::before { left: 100%; }

button[type="submit"]:hover {
    background: linear-gradient(135deg, #4a3aee, #2E2A6F);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(91, 75, 255, 0.4);
}

button[type="submit"]:active { transform: translateY(-1px); }

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Messages */
.error-message {
    color: #dc3545;
    text-align: center;
    margin: 0 0 20px 0;
    padding: 14px;
    background: #fff0f0;
    border: 1px solid #ffc5c5;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}

.success-message {
    color: #22c55e;
    text-align: center;
    margin: 0 0 20px 0;
    padding: 14px;
    background: #f0fff4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}

.info-message {
    color: #5B4BFF;
    text-align: center;
    margin: 0 0 20px 0;
    padding: 14px;
    background: rgba(91, 75, 255, 0.07);
    border: 1px solid rgba(91, 75, 255, 0.2);
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}

/* Options / back link */
.options {
    margin-top: 28px;
    text-align: center;
}

.options a {
    color: #5B4BFF;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.options a:hover {
    color: #2E2A6F;
    text-decoration: underline;
}

/* Loading spinner */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.spinner {
    border: 4px solid rgba(91, 75, 255, 0.15);
    border-radius: 50%;
    border-top: 4px solid #5B4BFF;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
}

.loading p {
    color: #6B6F85;
    font-size: 14px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    body { flex-direction: column; }
    .left-side { display: none; }
    .right-side {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        justify-content: center;
        padding: 60px 20px 40px;
    }
}

@media (max-width: 576px) {
    .right-side { padding: 32px 16px; }
    .content h2 { font-size: 1.7rem; }
    .logo-large { height: 60px; }
}