/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE PREMIUM ANIMATIONS
   Smooth, modern animations for login experience
══════════════════════════════════════════════════════════════ */

/* ════════════════════════════════
   PAGE LOAD ANIMATIONS
════════════════════════════════ */

/* Smooth body fade-in */
body {
    animation: bodyFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bodyFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Login container entrance */
.login-container {
    animation: containerSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}

@keyframes containerSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Left side content stagger */
.login-left .logo-section {
    animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s backwards;
}

.login-left .tagline {
    animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s backwards;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Right side form stagger */
.login-right .form-header {
    animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s backwards;
}

.login-right form {
    animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.7s backwards;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ════════════════════════════════
   BACKGROUND ANIMATIONS
════════════════════════════════ */

/* Enhanced pulse animation for left side */
.login-left::before {
    animation: enhancedPulse 10s ease-in-out infinite;
}

@keyframes enhancedPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.3;
    }
    25% {
        transform: scale(1.05) rotate(5deg);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.1) rotate(0deg);
        opacity: 0.5;
    }
    75% {
        transform: scale(1.05) rotate(-5deg);
        opacity: 0.4;
    }
}

/* Floating animation for logo */
.logo {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ════════════════════════════════
   FORM INPUT ANIMATIONS
════════════════════════════════ */

/* Input focus animation */
.form-control {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.form-control:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(230, 57, 70, 0.2);
}

/* Input label float effect */
.form-group {
    position: relative;
}

/* Smooth placeholder transition */
.form-control::placeholder {
    transition: all 0.3s ease;
}

.form-control:focus::placeholder {
    transform: translateX(5px);
    opacity: 0.5;
}

/* ════════════════════════════════
   BUTTON ANIMATIONS
════════════════════════════════ */

/* Submit button hover and ripple */
.btn-submit {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-submit:active::before {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(230, 57, 70, 0.5);
}

.btn-submit:active {
    transform: translateY(-1px);
}

/* Back link hover */
.back-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-link:hover {
    transform: translateX(-5px);
}

/* Social buttons hover */
.btn-social {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-social:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-social:active {
    transform: translateY(0);
}

/* ════════════════════════════════
   PASSWORD TOGGLE ANIMATION
════════════════════════════════ */

.toggle-password {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-password:hover {
    transform: scale(1.1);
}

.toggle-password:active {
    transform: scale(0.95);
}

/* Icon rotation on toggle */
.toggle-password i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-password:active i {
    transform: rotate(15deg);
}

/* ════════════════════════════════
   CHECKBOX ANIMATION
════════════════════════════════ */

.checkbox-group {
    transition: all 0.3s ease;
}

.checkbox-group input[type="checkbox"] {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"]:checked {
    animation: checkboxPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkboxPop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.checkbox-group label {
    transition: color 0.3s ease;
}

.checkbox-group:hover label {
    color: #d1d5db;
}

/* ════════════════════════════════
   ALERT ANIMATIONS
════════════════════════════════ */

.alert {
    animation: alertSlideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes alertSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Alert shake on error */
.alert {
    animation: alertSlideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1),
               shake 0.5s ease 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ════════════════════════════════
   CAROUSEL DOTS ANIMATION
════════════════════════════════ */

.carousel-dots {
    animation: fadeIn 1s ease 1s backwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dot {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot.active {
    animation: dotExpand 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dotExpand {
    0% {
        width: 40px;
        opacity: 0.5;
    }
    50% {
        width: 70px;
        opacity: 1;
    }
    100% {
        width: 60px;
        opacity: 1;
    }
}

/* ════════════════════════════════
   MODAL ANIMATIONS
════════════════════════════════ */

/* Terms modal entrance */
#termsModal {
    animation: modalBackdropFade 0.3s ease;
}

@keyframes modalBackdropFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#termsModal > div {
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal close animation */
#termsModal[style*="display: none"] {
    animation: modalBackdropFadeOut 0.3s ease;
}

@keyframes modalBackdropFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Modal buttons */
#termsModal button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#termsModal button:hover {
    transform: translateY(-2px);
}

#termsModal button:active {
    transform: translateY(0);
}

/* Modal close button */
#termsModal button[onclick="closeTermsModal()"]:first-of-type {
    transition: all 0.3s ease;
}

#termsModal button[onclick="closeTermsModal()"]:first-of-type:hover {
    transform: rotate(90deg) scale(1.1);
    color: #e63946;
}

/* ════════════════════════════════
   FORM VALIDATION ANIMATIONS
════════════════════════════════ */

/* Invalid input shake */
.form-control:invalid:not(:placeholder-shown) {
    animation: inputShake 0.5s ease;
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Valid input glow */
.form-control:valid:not(:placeholder-shown) {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ════════════════════════════════
   LOADING STATE ANIMATIONS
════════════════════════════════ */

/* Button loading state */
.btn-submit.loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ════════════════════════════════
   LINK ANIMATIONS
════════════════════════════════ */

.form-header p a,
.checkbox-group label a {
    position: relative;
    transition: all 0.3s ease;
}

.form-header p a::after,
.checkbox-group label a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #e63946;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-header p a:hover::after,
.checkbox-group label a:hover::after {
    width: 100%;
}

.form-header p a:hover,
.checkbox-group label a:hover {
    color: #f4a800;
}

/* ════════════════════════════════
   DIVIDER ANIMATION
════════════════════════════════ */

.divider::before {
    animation: dividerExpand 1s ease 0.8s backwards;
}

@keyframes dividerExpand {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

.divider span {
    animation: fadeIn 0.5s ease 1.3s backwards;
}

/* ════════════════════════════════
   GLASSMORPHISM ENHANCEMENTS
════════════════════════════════ */

/* Enhanced backdrop blur for modal */
#termsModal {
    backdrop-filter: blur(8px);
}

#termsModal > div {
    backdrop-filter: blur(10px);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
}

/* Back link glassmorphism */
.back-link {
    backdrop-filter: blur(12px);
}

/* ════════════════════════════════
   RESPONSIVE ANIMATIONS
════════════════════════════════ */

@media (max-width: 768px) {
    /* Faster animations on mobile */
    .login-container {
        animation-duration: 0.6s;
    }
    
    .login-left .logo-section,
    .login-left .tagline,
    .login-right .form-header,
    .login-right form {
        animation-duration: 0.6s;
    }
    
    /* Reduce transform distances */
    @keyframes containerSlideUp {
        from {
            opacity: 0;
            transform: translateY(20px) scale(0.98);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    /* Disable 3D effects on mobile */
    .btn-submit:hover {
        transform: translateY(-2px);
    }
}

/* ════════════════════════════════
   ACCESSIBILITY - REDUCED MOTION
════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .login-left::before {
        animation: none !important;
    }
    
    .logo {
        animation: none !important;
    }
}

/* ════════════════════════════════
   FOCUS STATES
════════════════════════════════ */

/* Enhanced focus ring */
.form-control:focus-visible,
.btn-submit:focus-visible,
.btn-social:focus-visible,
.checkbox-group input:focus-visible {
    outline: 2px solid #e63946;
    outline-offset: 2px;
    animation: focusRing 0.3s ease;
}

@keyframes focusRing {
    from {
        outline-offset: 0;
    }
    to {
        outline-offset: 2px;
    }
}

/* ════════════════════════════════
   CUSTOM SCROLLBAR FOR MODAL
════════════════════════════════ */

#termsModal div[style*="overflow-y: auto"]::-webkit-scrollbar {
    width: 8px;
}

#termsModal div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
    background: #3d3d52;
    border-radius: 4px;
}

#termsModal div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #e63946, #f4a800);
    border-radius: 4px;
    transition: background 0.3s;
}

#termsModal div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f4a800, #e63946);
}

/* ════════════════════════════════
   PERFORMANCE OPTIMIZATIONS
════════════════════════════════ */

/* Hardware acceleration */
.login-container,
.btn-submit,
.form-control,
.toggle-password,
.btn-social,
.back-link,
#termsModal > div {
    will-change: transform;
}

/* Reduce will-change after animation */
.login-container {
    animation: containerSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}

@keyframes removeWillChange {
    to {
        will-change: auto;
    }
}

/* ════════════════════════════════
   HOVER GLOW EFFECTS
════════════════════════════════ */

/* Logo icon glow on hover */
.logo i {
    transition: all 0.3s ease;
}

.logo:hover i {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
    transform: scale(1.1) rotate(5deg);
}

/* Form header title glow */
.form-header h1 {
    transition: all 0.3s ease;
}

.form-header:hover h1 {
    text-shadow: 0 0 20px rgba(230, 57, 70, 0.3);
}

/* ════════════════════════════════
   MICRO-INTERACTIONS
════════════════════════════════ */

/* Input icon animation (if you add icons) */
.form-group i {
    transition: all 0.3s ease;
}

.form-control:focus ~ i {
    color: #e63946;
    transform: scale(1.1);
}

/* Checkbox label slide */
.checkbox-group input:checked ~ label {
    animation: labelSlide 0.3s ease;
}

@keyframes labelSlide {
    0% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}
