/**
 * Quizzly - Authentication Styles
 * Glassmorphism login/register forms with pub quiz background
 */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(13, 17, 23, 0.85) 0%, rgba(26, 26, 46, 0.9) 100%),
        url('../images/auth-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
}

/* Fallback gradient if image not loaded */
.auth-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(26, 115, 232, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(249, 200, 70, 0.1) 0%, transparent 50%);
    animation: meshFloat 20s ease-in-out infinite;
    pointer-events: none;
}

/* Floating accent */
.auth-body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(249, 200, 70, 0.15) 0%, transparent 70%);
    top: 10%;
    right: 10%;
    filter: blur(40px);
    animation: float 15s infinite ease-in-out;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

@keyframes meshFloat {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.auth-container {
    width: 100%;
    max-width: 450px;
    padding: 1rem;
    z-index: 1;
}

.auth-container-wide {
    max-width: 900px;
}

/* Glassmorphism Card - Smoked Glass Effect */
.auth-card {
    background: rgba(30, 30, 40, 0.35);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border-radius: var(--border-radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: 1.5rem 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 1rem;
}

.auth-logo img {
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.3));
    height: 60px;
}

.auth-logo h1 {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

.auth-logo p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* Form Title */
.auth-card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem !important;
}

/* Form Styling */
.auth-card .form-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.auth-card .mb-3 {
    margin-bottom: 0.75rem !important;
}

.auth-card .mb-4 {
    margin-bottom: 1rem !important;
}

.auth-card .form-control {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: #fff;
    transition: all 0.3s ease;
}

.auth-card .form-control:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(249, 200, 70, 0.2);
    color: #fff;
}

.auth-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Select Fields */
.auth-card .form-select {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: #fff;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='rgba(255,255,255,0.7)' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.auth-card .form-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(249, 200, 70, 0.2);
    color: #fff;
}

.auth-card .form-select option {
    background-color: #1a1a2e;
    color: #fff;
}

.auth-card .input-group .form-select {
    border-left: none;
}

/* Input Groups */
.auth-card .input-group-text {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-right: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.auth-card .input-group .form-control {
    border-left: none;
}

.auth-card .input-group .form-control:not(:last-child) {
    border-right: none;
}

.auth-card .input-group:focus-within .input-group-text {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

/* Password Toggle Button */
.auth-card .password-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-left: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.auth-card .password-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--secondary-color);
}

.auth-card .input-group:focus-within .password-toggle {
    border-color: var(--secondary-color);
}

/* Checkbox */
.auth-card .form-check-label {
    color: rgba(255, 255, 255, 0.9);
}

.auth-card .form-check-input:checked {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Links */
.auth-card a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-card a:hover {
    color: var(--secondary-light);
    text-decoration: underline;
}

/* Submit Button */
.auth-card .btn-primary {
    width: 100%;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--gray-900);
    transition: all 0.3s ease;
}

.auth-card .btn-primary:hover {
    background: var(--secondary-dark);
    border-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 200, 70, 0.4);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    color: rgba(255, 255, 255, 0.6);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.auth-divider span {
    padding: 0 1rem;
    font-size: 0.875rem;
}

/* Social Buttons */
.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-google {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-google:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* Alerts in Auth */
.auth-card .alert {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    font-size: 0.875rem;
    position: relative;
    display: flex;
    align-items: center;
}

.auth-card .alert .btn-close {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem;
}

/* Outline Button (Register/Login secondary action) */
.auth-card .btn-outline-light {
    padding: 0.5rem;
    font-size: 0.9rem;
    border-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.auth-card .btn-outline-light:hover,
.auth-card .btn-outline-light:focus {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--gray-900);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 200, 70, 0.3);
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 1rem;
}

.auth-footer a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: white;
}

/* Password Strength Indicator */
.password-strength {
    height: 3px;
    border-radius: 2px;
    background: var(--gray-300);
    margin-top: 0.25rem;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-bar.weak {
    width: 33%;
    background-color: var(--danger-color);
}

.password-strength-bar.medium {
    width: 66%;
    background-color: var(--warning-color);
}

.password-strength-bar.strong {
    width: 100%;
    background-color: var(--success-color);
}

/* Validation States */
.auth-card .is-invalid {
    border-color: var(--danger-color);
    background-image: none;
}

.auth-card .invalid-feedback {
    color: #ff6b6b;
    font-size: 0.8rem;
    display: block;
}

.auth-card .invalid-feedback:empty {
    display: none;
}

.auth-card .is-valid {
    border-color: var(--success-color);
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .auth-container-wide {
        max-width: 600px;
    }
}

/* Responsive - Mobile */
@media (max-width: 767px) {
    .auth-body {
        background-attachment: scroll;
        padding: 1rem 0;
    }

    .auth-body::after {
        width: 150px;
        height: 150px;
        top: 5%;
        right: 5%;
    }

    .auth-container {
        padding: 0.75rem;
    }

    .auth-container-wide {
        max-width: 100%;
    }

    .auth-card {
        padding: 1.25rem 1rem;
        border-radius: var(--border-radius);
    }

    .auth-logo {
        margin-bottom: 0.75rem;
    }

    .auth-logo img {
        height: 50px;
    }

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

    .auth-logo p {
        font-size: 0.75rem;
    }

    /* Form adjustments */
    .auth-card h2 {
        font-size: 1rem;
    }

    .auth-card .form-label {
        font-size: 0.8rem;
    }

    .auth-card .form-control,
    .auth-card .form-select,
    .auth-card .input-group-text {
        padding: 0.5rem 0.65rem;
        font-size: 0.85rem;
    }

    .auth-card .mb-3 {
        margin-bottom: 0.65rem !important;
    }

    .auth-card .mb-4 {
        margin-bottom: 0.85rem !important;
    }

    /* Stack row columns on mobile */
    .auth-card .row > [class*="col-md-6"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Buttons */
    .auth-card .btn-primary,
    .auth-card .btn-outline-light {
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    /* Divider */
    .auth-divider {
        margin: 0.75rem 0;
    }

    .auth-divider span {
        padding: 0 0.75rem;
        font-size: 0.8rem;
    }

    /* Checkbox text */
    .auth-card .form-check-label {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    /* Password toggle */
    .auth-card .password-toggle {
        padding: 0.5rem 0.6rem;
    }

    /* Alerts */
    .auth-card .alert {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Footer */
    .auth-footer {
        margin-top: 0.75rem;
        font-size: 0.85rem;
    }

    /* Small text helpers */
    .auth-card small,
    .auth-card .text-muted,
    .auth-card .text-white-50 {
        font-size: 0.75rem;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 400px) {
    .auth-container {
        padding: 0.5rem;
    }

    .auth-card {
        padding: 1rem 0.85rem;
    }

    .auth-logo img {
        height: 45px;
    }

    .auth-card .form-control,
    .auth-card .form-select,
    .auth-card .input-group-text {
        padding: 0.45rem 0.5rem;
        font-size: 0.8rem;
    }

    .auth-card .btn-primary,
    .auth-card .btn-outline-light {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    /* Stack remember me and forgot password */
    .auth-card .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start !important;
    }

    .auth-card .d-flex.justify-content-between a {
        align-self: flex-end;
    }
}

/* Fix for iOS zoom on input focus */
@media (max-width: 767px) {
    .auth-card input[type="text"],
    .auth-card input[type="email"],
    .auth-card input[type="password"],
    .auth-card input[type="tel"],
    .auth-card select {
        font-size: 16px !important;
    }
}
