/* ===================================
   AUTHENTICATION PAGES STYLING
   Login, Register, Forgot Password
   ================================== */

/* CSS Variables */
:root {
    --primary-color: #9b59b6;
    --secondary-color: #e67e22;
    --accent-color: #2ecc71;
    --dark-bg: #1a1a2e;
    --darker-bg: #0f0f1e;
    --card-bg: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --border-color: #2d3561;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--darker-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Animated Background */
.auth-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
}

.auth-background::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(155, 89, 182, 0.1) 0%, transparent 70%);
    animation: pulseGlow 8s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

/* Floating Particles */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 10s infinite ease-in-out;
}

.particle:nth-child(1) { width: 80px; height: 80px; top: 10%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { width: 60px; height: 60px; top: 70%; left: 80%; animation-delay: 2s; background: var(--secondary-color); }
.particle:nth-child(3) { width: 100px; height: 100px; top: 40%; left: 60%; animation-delay: 4s; background: var(--accent-color); }
.particle:nth-child(4) { width: 40px; height: 40px; top: 80%; left: 20%; animation-delay: 6s; }
.particle:nth-child(5) { width: 70px; height: 70px; top: 20%; left: 70%; animation-delay: 8s; background: var(--secondary-color); }

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, -30px) rotate(90deg); }
    50% { transform: translate(-20px, 20px) rotate(180deg); }
    75% { transform: translate(40px, 10px) rotate(270deg); }
}

/* Auth Container */
.auth-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-wrapper {
    max-width: 480px;
    width: 100%;
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auth Card */
.auth-card {
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(155, 89, 182, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.2);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(155, 89, 182, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Logo Section */
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(155, 89, 182, 0.4);
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(155, 89, 182, 0.6); }
}

.auth-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Form Elements */
.auth-form {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-primary);
}

.form-group label i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.form-input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-color: var(--primary-color);
    background: rgba(26, 26, 46, 0.8);
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.2);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.form-input:focus ~ .input-icon {
    color: var(--secondary-color);
    transform: translateY(-50%) scale(1.1);
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: var(--primary-color);
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.form-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.form-checkbox label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
    cursor: pointer;
}

/* Links */
.forgot-password {
    display: block;
    text-align: right;
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: var(--secondary-color);
}

/* Buttons */
.btn-auth {
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(155, 89, 182, 0.3);
}

.btn-auth::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-auth:hover::before {
    left: 100%;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(155, 89, 182, 0.5);
}

.btn-auth:active {
    transform: translateY(0);
}

/* Social Login */
.social-login {
    margin-top: 2rem;
}

.social-divider {
    text-align: center;
    position: relative;
    margin: 2rem 0;
}

.social-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: var(--border-color);
}

.social-divider span {
    background: rgba(22, 33, 62, 0.95);
    padding: 0 1rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.social-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.btn-social {
    padding: 1rem;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-social:hover {
    border-color: var(--primary-color);
    background: rgba(155, 89, 182, 0.1);
    transform: translateY(-3px);
}

.btn-social.google:hover { border-color: #DB4437; color: #DB4437; }
.btn-social.facebook:hover { border-color: #1877F2; color: #1877F2; }
.btn-social.discord:hover { border-color: #5865F2; color: #5865F2; }

/* Footer Text */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-footer a:hover {
    color: var(--secondary-color);
}

/* Back to Home */
.back-to-home {
    position: absolute;
    top: 2rem;
    left: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem;
    background: rgba(22, 33, 62, 0.6);
    border-radius: 50px;
    transition: all 0.3s ease;
    z-index: 10;
}

.back-to-home:hover {
    color: var(--primary-color);
    background: rgba(22, 33, 62, 0.9);
    transform: translateX(-5px);
}

/* Success/Error Messages */
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.alert-error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

/* Loading State */
.btn-auth.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-auth.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    right: 1.5rem;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spinner 0.6s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .auth-card {
        padding: 2.5rem 1.5rem;
        border-radius: 20px;
    }

    .auth-logo h1 {
        font-size: 1.75rem;
    }

    .auth-logo-icon {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    .form-group label {
        font-size: 1.05rem;
    }

    .form-input {
        padding: 1.1rem 1rem 1.1rem 3rem;
        font-size: 1.05rem;
    }

    .btn-auth {
        padding: 1.2rem;
        font-size: 1.15rem;
    }

    .social-buttons {
        gap: 0.75rem;
    }

    .btn-social {
        font-size: 1.3rem;
    }

    .back-to-home {
        top: 1rem;
        left: 1rem;
        font-size: 1rem;
        padding: 0.85rem 1.35rem;
    }

    .auth-footer {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 1rem;
    }

    .auth-card {
        padding: 2rem 1.25rem;
    }

    .auth-logo h1 {
        font-size: 1.6rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .social-buttons {
        grid-template-columns: 1fr;
    }

    .particle {
        display: none;
    }
}

/* Accessibility */
.form-input:focus-visible,
.btn-auth:focus-visible,
.btn-social:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .auth-background,
    .particles,
    .back-to-home {
        display: none;
    }
}
