/* --- VARIABLES --- */
:root {
    --dark-blue: #1C338A; 
    --primary-yellow: #FFD700; 
    --light-bg: #F0F4F8; /* Lighter background for the page */
    --card-bg: #ffffff; /* White card background */
    --dark-text: #1F2937;
    --gray-text: #6B7280;
    --error-red: #e53935;
    --success-green: #4CAF50;
    --shadow-main: 0 10px 30px rgba(0, 0, 0, 0.1); 
    --shadow-yellow: 0 4px 10px rgba(255, 215, 0, 0.4); 
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --sphere-blue: rgba(26, 115, 232, 0.15);
}

/* --- ANIMATIONS --- */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* --- LOADING LINE ANIMATION --- */
@keyframes loadingLine {
    0% {
        transform: scaleX(0);
        opacity: 0.3;
    }
    50% {
        transform: scaleX(1);
        opacity: 1;
    }
    100% {
        transform: scaleX(0);
        opacity: 0.3;
    }
}

.loading-line {
    width: 200px;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary-yellow) 50%, 
        transparent 100%);
    border-radius: 2px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    animation: loadingLine 1.5s ease-in-out infinite;
}

.loading-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.8) 50%, 
        transparent 100%);
    animation: loadingLine 1.5s ease-in-out infinite 0.75s;
}

/* --- BACKGROUND SPHERES --- */
.background-sphere {
    position: absolute; 
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--sphere-blue), rgba(26, 115, 232));
    opacity: 0.5; 
    z-index: 0; 
    animation: float 15s infinite ease-in-out; 
}
.sphere-1 { width: 300px; height: 300px; top: -100px; left: -100px; animation-delay: 0s; }
.sphere-2 { width: 200px; height: 200px; bottom: 50px; right: -50px; animation-delay: 2s; }
.sphere-3 { width: 150px; height: 150px; top: 30%; right: 20%; animation-delay: 4s; }
.sphere-4 { width: 180px; height: 180px; bottom: 30%; left: 10%; animation-delay: 6s; }
.sphere-5 { width: 220px; height: 220px; top: 10%; left: 30%; animation-delay: 8s; }
.sphere-6 { width: 120px; height: 120px; bottom: 10%; right: 30%; animation-delay: 10s; }
.sphere-7 { width: 250px; height: 250px; top: 60%; left: 5%; animation-delay: 12s; }
.sphere-8 { width: 170px; height: 170px; top: 15%; right: 5%; animation-delay: 14s; }

/* --- BASE & LAYOUT --- */
body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center; 
    align-items: center; 
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: var(--dark-text);
    padding: 0;
    box-sizing: border-box;
    opacity: 0;
    animation: fadeInScale 0.8s ease-out forwards;
    overflow: hidden; 
    position: relative;
}

/* Loading overlay styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Notification popup styles */
.notification-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 20px 25px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(150%); 
    transition: 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.4s ease, visibility 0.4s;
}

.notification-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.notification-popup.success {
    background: white;
    color: #6b7280;;
    border-left: 5px solid #0d9668;
}

.notification-popup.error {
    background: white;
    color: #6b7280;;
    border-left: 5px solid #dc2626;
}

.notification-popup.warning {
    background: white;
    color: #6b7280;;
    border-left: 5px solid #d97706;
}

.notification-popup.error i {
    color: var(--error-red) !important;
}
.notification-popup.success i {
    color: var(--success-green) !important;
}
.notification-popup.warning i {
    color: #d97706 !important;
}

.notification-icon.error {
    font-size: 1.5rem;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 700;
    margin-bottom: 5px;
    color: black;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 🔑 SCALED DOWN AUTH CONTAINER */
.auth-container {
    width: 90%;
    max-width: 800px; /* Reduced from 900px */
    min-height: 520px; /* Reduced from 580px */
    max-height: 85vh; /* Reduced from 95vh */
    background-color: var(--card-bg); 
    border-radius: 16px; 
    box-shadow: var(--shadow-main); 
    display: flex; 
    overflow: hidden; 
    box-sizing: border-box;
    padding: 0;
    /* SCALED DOWN to 70% (was 80%) */
    transform: scale(0.7); 
    transform-origin: center;
    transition: var(--transition);
    opacity: 0;
    animation: fadeInScale 0.6s ease-out 0.3s forwards;
    position: relative;
    z-index: 2;
}

/* LEFT SECTION (IMAGE) */


/* RIGHT SECTION (FORM) - Desktop Styles */
.form-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    padding: 25px; /* Reduced padding */
    position: relative;
    text-align: center;
    background-color: var(--card-bg); 
    overflow-y: auto;
    opacity: 0;
    animation: slideInFromRight 0.8s ease-out 0.5s forwards;
}

/* --- HEADER & TITLES --- */
.icon-circle {
    width: 60px; /* Reduced from 70px */
    height: 60px;
    background: linear-gradient(135deg, var(--primary-yellow) 0%, #ffc400 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px; /* Reduced margin */
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3); 
    transition: var(--transition);
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out 0.8s forwards;
}

.icon-circle:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 25px rgba(255, 215, 0, 0.4);
}

.icon-circle .fas { 
    font-size: 25px; /* Reduced from 30px */
    color: var(--card-bg); 
}

h1 { 
    font-size: 1.4rem; /* Reduced from 1.6rem */
    color: var(--dark-blue); 
    margin-bottom: 20px; /* Reduced margin */
    font-weight: 700; 
    position: relative;
    display: inline-block;
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out 1s forwards;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background-color: var(--primary-yellow);
    border-radius: 2px;
}

/* --- FORM ELEMENTS --- */
.signup-form { 
    width: 100%; 
    max-width: 300px; /* Reduced from 340px */
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out 1.2s forwards;
}

.form-group { 
    width: 100%; 
    text-align: left; 
    margin-bottom: 15px; /* Reduced margin */
    position: relative; 
    opacity: 0;
    transform: translateY(20px);
    animation: slideInFromBottom 0.5s ease-out forwards;
}

.form-group:nth-child(1) { animation-delay: 1.4s; }
.form-group:nth-child(2) { animation-delay: 1.5s; }

.form-group label { 
    display: block; 
    font-size: 0.8em; /* Slightly smaller */
    color: var(--dark-blue); 
    margin-bottom: 6px; /* Reduced */
    font-weight: 500;
    transition: color 0.2s ease;
}

.input-container {
    display: flex;
    align-items: center;
    border: 1px solid #E5E7EB; 
    border-radius: 10px; /* Slightly smaller */
    padding: 10px 12px; /* Reduced padding */
    transition: var(--transition);
    background-color: var(--card-bg); 
    position: relative;
}

.input-container:focus-within { 
    border-color: var(--primary-yellow);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
    transform: translateY(-2px);
}

.input-container:focus-within + label { 
    color: var(--primary-yellow);
}

.input-container .fas { 
    color: var(--gray-text); 
    margin-right: 10px; /* Reduced */
    font-size: 0.9em; /* Slightly smaller */
    transition: var(--transition);
    width: 16px; /* Reduced */
    text-align: center;
}

.input-container:focus-within .fas {
    color: var(--primary-yellow);
    transform: scale(1.1);
}

.input-container:hover .fas {
    transform: translateX(2px);
}

.form-group input {
    border: none; 
    outline: none; 
    background: transparent;
    font-size: 0.9em; /* Slightly smaller */
    color: var(--dark-text); 
    width: 100%; 
    padding: 0;
}

.input-container.error {
    border-color: var(--error-red) !important;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2) !important;
    animation: shake 0.5s ease;
}

.input-container.success {
    border-color: var(--success-green) !important;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2) !important;
}

/* --- BUTTON & LINKS --- */
.create-button {
    background: linear-gradient(135deg, var(--primary-yellow) 0%, #ffc400 100%);
    color: var(--dark-blue); 
    border: none; 
    border-radius: 10px; /* Slightly smaller */
    padding: 12px 25px; /* Reduced padding */
    font-size: 0.9em; /* Slightly smaller */
    font-weight: 700; 
    cursor: pointer; 
    width: 100%;
    box-shadow: var(--shadow-yellow); 
    transition: var(--transition);
    margin-top: 10px; /* Reduced */
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out 1.6s forwards;
}

.create-button::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;
}

.create-button:hover:not(:disabled) { 
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5); 
}

.create-button:hover:not(:disabled)::before {
    left: 100%;
}

.create-button:active {
    transform: translateY(-1px) scale(1.01);
}

.create-button i {
    margin-right: 8px; /* Reduced */
    transition: transform 0.3s ease;
}

.create-button:hover:not(:disabled) i {
    transform: translateX(3px);
}

.login-link { 
    margin-top: 15px; /* Reduced */
    font-size: 0.8em; /* Slightly smaller */
    color: var(--gray-text);
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out 1.8s forwards;
}
.login-link a {
    color: var(--dark-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

.login-link a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--primary-yellow);
    transition: width 0.3s ease;
}

.login-link a:hover {
    color: var(--primary-yellow);
}

.login-link a:hover::after {
    width: 100%;
}

/* Close and Translate Icon Styles */
.close-icon {
    position: absolute;
    top: 15px; /* Reduced */
    right: 15px; /* Reduced */
    font-size: 1.2rem; /* Reduced from 1.4rem */
    color: var(--gray-text);
    cursor: pointer;
    transition: var(--transition);
    z-index: 10; 
    width: 32px; /* Reduced from 38px */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out 0.7s forwards;
}

.close-icon:hover {
    color: var(--dark-blue);
    background-color: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg) scale(1.1);
}

.translate-button {
    background: none;
    border: 1px solid #E5E7EB; 
    border-radius: 18px; /* Slightly smaller */
    cursor: pointer;
    color: var(--gray-text);
    font-size: 0.8em; /* Slightly smaller */
    padding: 6px 12px; /* Reduced padding */
    margin-bottom: 15px; /* Reduced margin */
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute; 
    top: 15px; /* Reduced */
    left: 15px; /* Reduced */
    opacity: 0;
    animation: slideInFromBottom 0.6s ease-out 0.7s forwards;
}

.translate-button:hover {
    border-color: var(--primary-yellow);
    color: var(--dark-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px) scale(1.05);
}

.translate-button i {
    margin-right: 5px; /* Reduced */
    transition: transform 0.3s ease;
}

.translate-button:hover i {
    transform: rotate(15deg);
}

/* --- ERROR MESSAGES --- */
.error-message {
    color: var(--error-red);
    font-size: 0.7em; /* Slightly smaller */
    margin-top: 6px; /* Reduced */
    display: none; 
    font-weight: 500;
    text-align: left;
    padding-left: 5px;
    animation: shake 0.5s ease;
}

.success-message {
    color: var(--success-green);
    font-size: 0.7em;
    margin-top: 6px;
    display: none;
    font-weight: 500;
    text-align: left;
    padding-left: 5px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* MOBILE ADJUSTMENTS (Cardless/Floating Form) */
@media (max-width: 800px) {
    body {
        align-items: center; 
        justify-content: center;
        padding-top: 30px; 
        animation: fadeInScale 0.8s ease-out forwards;
        overflow-y: auto; 
        overflow-x: hidden;
    }

    .auth-container {
        flex-direction: column; 
        height: auto; 
        min-height: auto;
        max-height: none;
        max-width: 340px; /* Reduced */
        width: 90%; 
        background-color: transparent; 
        box-shadow: none;
        border-radius: 0;
        transform: none;
        animation: slideInFromBottom 0.8s ease-out 0.3s forwards;
    }
    
    .image-section {
        display: none; 
    }

    .form-section {
        flex: none; 
        width: 100%;
        padding: 0;
        background-color: transparent; 
        justify-content: flex-start;
        align-items: center;
        text-align: center;
        overflow-y: visible;
        animation: slideInFromBottom 0.8s ease-out 0.5s forwards;
    }
    
    .signup-form {
        max-width: 300px; /* Reduced */
        width: 100%;
    }
    
    .icon-circle { 
        margin-top: 0; 
        align-self: center; 
    }
    
    .translate-button {
        position: static; 
        margin: 0 auto 15px auto; /* Reduced */
        align-self: center;
        animation: slideInFromBottom 0.6s ease-out 0.8s forwards;
    }
    
    .close-icon {
        position: fixed; 
        top: 10px; /* Reduced */
        right: 10px; /* Reduced */
        z-index: 100;
        animation: slideInFromBottom 0.6s ease-out 0.8s forwards;
    }

    /* Mobile adjustments for notifications */
    .notification-popup {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-150%);
    }
    
    .notification-popup.show {
        transform: translateY(0);
    }
}

/* Accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-yellow);
    outline-offset: 3px;
    border-radius: 5px;
}