/**
 * ============================================
 * MOJOLAND MAGICAL AUTH THEME
 * Premium Kids Educational Platform Design
 * ============================================
 */

/* ======================================
   1. IMPORTS & VARIABLES
   ====================================== */
@import url('https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@400;500;600;700;800&family=Reem+Kufi:wght@400;500;600;700&family=Fredoka:wght@400;500;600;700&family=Potta+One&display=swap');

:root {
    /* Brand Colors */
    --magic-purple: #8B1978;
    --magic-purple-dark: #4A0E5C;
    --magic-purple-light: #B44D9E;
    --magic-orange: #FFB74D;
    --magic-orange-dark: #FF9800;
    --magic-orange-light: #FFCC80;
    
    /* Gradient Colors */
    --gradient-purple: linear-gradient(135deg, #8B1978 0%, #4A0E5C 100%);
    --gradient-blue: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-sunset: linear-gradient(135deg, #FFB74D 0%, #FF8A65 100%);
    --gradient-magic: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
    --gradient-forest: linear-gradient(135deg, #2DD4BF 0%, #22C55E 50%, #4ADE80 100%);
    
    /* Form Colors */
    --form-bg: #fdfbf7;
    --form-border: #EEE0C9;
    --form-focus: #FFB74D;
    --text-primary: #5D4037;
    --text-secondary: #8D6E63;
    --text-muted: #A1887F;
    
    /* Background Colors */
    --page-bg-light: #e8f4fc;
    --page-bg-gradient: linear-gradient(180deg, #c7e9fb 0%, #e8d5f7 50%, #fce4ec 100%);
    
    /* Shadows */
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 15px 50px rgba(0, 0, 0, 0.12);
    --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.18);
    --shadow-glow-purple: 0 10px 40px rgba(139, 25, 120, 0.25);
    --shadow-glow-orange: 0 10px 40px rgba(255, 183, 77, 0.4);
    
    /* Animations */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ======================================
   2. PAGE BACKGROUND
   ====================================== */
.auth-magic-page {
    min-height: 100vh;
    background: var(--page-bg-gradient);
    position: relative;
    overflow: hidden;
}

.auth-magic-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.1) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Floating magical elements */
.magic-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.magic-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(168, 85, 247, 0.4) 100%);
    border-radius: 50%;
    animation: floatParticle 15s infinite ease-in-out;
    opacity: 0.6;
}

.magic-particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 12s; }
.magic-particle:nth-child(2) { left: 30%; top: 60%; animation-delay: 2s; animation-duration: 14s; }
.magic-particle:nth-child(3) { left: 50%; top: 30%; animation-delay: 4s; animation-duration: 16s; }
.magic-particle:nth-child(4) { left: 70%; top: 70%; animation-delay: 1s; animation-duration: 13s; }
.magic-particle:nth-child(5) { left: 85%; top: 40%; animation-delay: 3s; animation-duration: 15s; }
.magic-particle:nth-child(6) { left: 20%; top: 80%; animation-delay: 5s; animation-duration: 11s; }

@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-30px) rotate(90deg) scale(1.2);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-15px) rotate(180deg) scale(1);
        opacity: 0.5;
    }
    75% {
        transform: translateY(-40px) rotate(270deg) scale(1.3);
        opacity: 0.7;
    }
}

/* Star particles */
.magic-star {
    position: absolute;
    font-size: 20px;
    color: #FFD700;
    animation: twinkle 3s infinite ease-in-out;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.magic-star:nth-child(1) { left: 5%; top: 15%; animation-delay: 0s; font-size: 16px; }
.magic-star:nth-child(2) { left: 15%; top: 45%; animation-delay: 0.5s; font-size: 12px; }
.magic-star:nth-child(3) { left: 92%; top: 25%; animation-delay: 1s; font-size: 18px; }
.magic-star:nth-child(4) { left: 88%; top: 65%; animation-delay: 1.5s; font-size: 14px; }
.magic-star:nth-child(5) { left: 45%; top: 10%; animation-delay: 0.3s; font-size: 10px; }

@keyframes twinkle {
    0%, 100% { opacity: 0.4; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

/* ======================================
   3. AUTH CONTAINER
   ====================================== */
.auth-magic-container {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 15px;
}

.auth-magic-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    max-width: 1000px;
    width: 100%;
    display: flex;
    flex-direction: row;
    position: relative;
}

/* Glassmorphism glow effect */
.auth-magic-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(59, 130, 246, 0.3), rgba(236, 72, 153, 0.3));
    border-radius: 32px;
    z-index: -1;
    opacity: 0.5;
    filter: blur(8px);
}

/* ======================================
   4. FORM SECTION
   ====================================== */
.auth-form-section {
    flex: 1;
    padding: 50px 40px;
    background: linear-gradient(180deg, #fffefb 0%, #fdf8f0 100%);
}

.auth-form-section h1.auth-title {
    font-family: 'Reem Kufi', 'Fredoka', sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--magic-purple);
    text-align: center;
    margin-bottom: 10px;
}

.auth-form-section .auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
    font-family: 'Baloo Bhaijaan 2', cursive;
}

/* Form Groups */
.auth-form-group {
    margin-bottom: 22px;
}

.auth-form-group label {
    display: block;
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.auth-form-group .input-wrapper {
    position: relative;
}

.auth-form-group .input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    z-index: 2;
}

[dir="ltr"] .auth-form-group .input-icon { left: 18px; }
[dir="rtl"] .auth-form-group .input-icon { right: 18px; }

.auth-form-group .form-control,
.auth-magic-page .form-control {
    width: 100%;
    padding: 16px 20px;
    padding-left: 50px;
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: #FFFFFF;
    border: 2px solid var(--form-border);
    border-radius: 16px;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[dir="rtl"] .auth-form-group .form-control,
[dir="rtl"] .auth-magic-page .form-control {
    padding-right: 50px;
    padding-left: 20px;
    text-align: right;
}

.auth-form-group .form-control:focus,
.auth-magic-page .form-control:focus {
    border-color: var(--magic-orange);
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(255, 183, 77, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
    outline: none;
}

.auth-form-group .form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

/* Password toggle */
.password-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

[dir="ltr"] .password-toggle { right: 12px; }
[dir="rtl"] .password-toggle { left: 12px; }

.password-toggle:hover {
    color: var(--magic-purple);
}

/* ======================================
   5. BUTTONS
   ====================================== */
.btn-magic-primary {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-size: 1.2rem;
    font-weight: 700;
    color: #3f2b20;
    background: var(--gradient-sunset);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: var(--shadow-glow-orange);
    position: relative;
    overflow: hidden;
}

.btn-magic-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-magic-primary:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 35px rgba(255, 152, 0, 0.5);
}

.btn-magic-primary:hover::before {
    left: 100%;
}

.btn-magic-primary:active {
    transform: translateY(-2px) scale(0.98);
}

/* Social Login Buttons */
.auth-social-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
}

.auth-social-divider::before,
.auth-social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--form-border), transparent);
}

.auth-social-divider span {
    padding: 0 20px;
    color: var(--text-muted);
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-size: 0.9rem;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: #FFFFFF;
    border: 2px solid var(--form-border);
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 12px;
    text-decoration: none;
}

.btn-social:hover {
    border-color: var(--magic-purple-light);
    background: #FBF7FF;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 25, 120, 0.1);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-social img {
    width: 22px;
    height: 22px;
}

/* ======================================
   6. ILLUSTRATION SECTION
   ====================================== */
.auth-illustration-section {
    flex: 1;
    min-height: 400px;
    background: var(--gradient-purple);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-illustration-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 70% 30%, rgba(255, 183, 77, 0.15) 0%, transparent 40%);
    animation: rotateGradient 20s linear infinite;
}

@keyframes rotateGradient {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.auth-illustration-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

/* Floating decorations */
.auth-illustration-section .floating-element {
    position: absolute;
    z-index: 2;
    animation: floatElement 6s ease-in-out infinite;
}

.auth-illustration-section .floating-element:nth-child(1) {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.auth-illustration-section .floating-element:nth-child(2) {
    top: 25%;
    right: 15%;
    animation-delay: 2s;
}

.auth-illustration-section .floating-element:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 1s;
}

@keyframes floatElement {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(10deg); }
}

/* ======================================
   7. LINKS & HELPERS
   ====================================== */
.auth-links {
    text-align: center;
    margin-top: 25px;
    font-family: 'Baloo Bhaijaan 2', cursive;
}

.auth-links a {
    color: var(--magic-purple);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-links a:hover {
    color: var(--magic-purple-dark);
    text-decoration: underline;
}

.auth-links span {
    color: var(--text-secondary);
}

/* Forgot password link */
.auth-forgot-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--magic-purple);
    font-weight: 600;
    text-decoration: none;
    font-family: 'Baloo Bhaijaan 2', cursive;
    transition: color 0.2s ease;
}

.auth-forgot-link:hover {
    color: var(--magic-orange);
}

/* ======================================
   8. CHECKBOX STYLING
   ====================================== */
.auth-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border: 2px solid var(--form-border);
    border-radius: 6px;
    cursor: pointer;
    accent-color: var(--magic-purple);
    flex-shrink: 0;
    margin-top: 2px;
}

.auth-checkbox-group label {
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.5;
}

.auth-checkbox-group label a {
    color: var(--magic-purple);
    font-weight: 600;
    text-decoration: none;
}

.auth-checkbox-group label a:hover {
    text-decoration: underline;
}

/* ======================================
   9. ERROR STATES
   ====================================== */
.form-control.is-invalid {
    border-color: #F44336 !important;
    background-image: none !important;
}

.invalid-feedback {
    display: block;
    color: #F44336;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 8px;
    font-family: 'Baloo Bhaijaan 2', cursive;
}

/* ======================================
   10. TABS STYLING
   ====================================== */
.auth-tabs {
    display: flex;
    background: #F5F0E8;
    border-radius: 14px;
    padding: 5px;
    margin-bottom: 25px;
}

.auth-tabs .nav-link {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-muted);
    background: transparent;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.auth-tabs .nav-link.active {
    background: #FFFFFF;
    color: var(--magic-purple);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.auth-tabs .nav-link:hover:not(.active) {
    color: var(--text-primary);
}

/* ======================================
   11. RESPONSIVE DESIGN
   ====================================== */
@media (max-width: 991px) {
    .auth-magic-card {
        flex-direction: column-reverse;
        max-width: 500px;
        margin: 20px auto;
    }
    
    .auth-illustration-section {
        min-height: 200px;
        border-radius: 30px 30px 0 0;
    }
    
    .auth-form-section {
        padding: 35px 25px;
        border-radius: 0 0 30px 30px;
    }
    
    .auth-form-section h1.auth-title {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .auth-magic-container {
        padding: 20px 10px;
    }
    
    .auth-form-section {
        padding: 30px 20px;
    }
    
    .auth-form-section h1.auth-title {
        font-size: 1.8rem;
    }
    
    .auth-illustration-section {
        min-height: 150px;
    }
    
    .magic-particles,
    .magic-star {
        display: none;
    }
}

/* ======================================
   12. RTL SUPPORT
   ====================================== */
[dir="rtl"] .auth-form-section,
[dir="rtl"] .auth-links,
[dir="rtl"] .auth-checkbox-group label {
    text-align: right;
}

[dir="rtl"] .auth-checkbox-group {
    flex-direction: row-reverse;
}

/* ======================================
   13. CENTERED FORM (No Illustration)
   ====================================== */
.auth-magic-card.centered-only {
    max-width: 500px;
}

.auth-magic-card.centered-only .auth-form-section {
    border-radius: 30px;
}

/* ======================================
   14. ANIMATION ENTRANCE
   ====================================== */
.auth-magic-card {
    animation: slideUpFade 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-form-group {
    animation: slideInLeft 0.4s ease forwards;
    opacity: 0;
}

.auth-form-group:nth-child(1) { animation-delay: 0.1s; }
.auth-form-group:nth-child(2) { animation-delay: 0.15s; }
.auth-form-group:nth-child(3) { animation-delay: 0.2s; }
.auth-form-group:nth-child(4) { animation-delay: 0.25s; }
.auth-form-group:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] .auth-form-group {
    animation-name: slideInRight;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
