/**
 * =========================================================
 * StudyMart — Authentication Page Styles
 * =========================================================
 * 
 * Styles for login, forgot-password, and reset-password pages.
 * Features: glassmorphism cards, gradient backgrounds, floating
 * labels, micro-animations, and responsive design.
 * =========================================================
 */

/* ─── Auth Page Layout ──────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(67, 97, 238, 0.15) 0%, transparent 70%);
    animation: authPulse 8s ease-in-out infinite;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(114, 9, 183, 0.12) 0%, transparent 70%);
    animation: authPulse 8s ease-in-out infinite 4s;
}

@keyframes authPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* ─── Floating Shapes ───────────────────────────────────── */
.auth-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.auth-shapes .shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
}

.auth-shapes .shape-1 {
    width: 400px;
    height: 400px;
    background: var(--clr-primary);
    top: -100px;
    right: -100px;
    animation: floatShape 12s ease-in-out infinite;
}

.auth-shapes .shape-2 {
    width: 250px;
    height: 250px;
    background: var(--clr-secondary);
    bottom: -50px;
    left: -50px;
    animation: floatShape 10s ease-in-out infinite 2s;
}

.auth-shapes .shape-3 {
    width: 150px;
    height: 150px;
    background: var(--clr-accent);
    top: 50%;
    left: 10%;
    animation: floatShape 8s ease-in-out infinite 4s;
}

.auth-shapes .shape-4 {
    width: 100px;
    height: 100px;
    background: var(--clr-success);
    top: 20%;
    right: 15%;
    animation: floatShape 9s ease-in-out infinite 1s;
}

@keyframes floatShape {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -20px) rotate(5deg); }
    50% { transform: translate(-10px, 15px) rotate(-3deg); }
    75% { transform: translate(15px, 10px) rotate(3deg); }
}

/* ─── Auth Container ────────────────────────────────────── */
.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    animation: authSlideUp 0.6s ease-out;
}

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

/* ─── Auth Card (Glassmorphism) ─────────────────────────── */
.auth-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ─── Auth Header ───────────────────────────────────────── */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.auth-logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.4);
}

.auth-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.auth-logo-text span {
    color: var(--clr-accent);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* ─── Role Toggle ───────────────────────────────────────── */
.role-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.role-toggle-btn {
    flex: 1;
    padding: 0.625rem 1rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.role-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

.role-toggle-btn.active {
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.35);
}

/* ─── Form Groups ───────────────────────────────────────── */
.auth-form-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.auth-form-group .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.1rem;
    transition: color 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.auth-form-group .input-icon-right {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 0;
}

.auth-form-group .input-icon-right:hover {
    color: rgba(255, 255, 255, 0.7);
}

.auth-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 0.9375rem;
    font-family: var(--font-primary, 'Inter', sans-serif);
    transition: all 0.3s ease;
    outline: none;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.auth-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.auth-input:focus ~ .input-icon {
    color: var(--clr-primary);
}

/* Input with right icon (password toggle) */
.auth-input.has-right-icon {
    padding-right: 2.75rem;
}

/* Validation states */
.auth-form-group.is-valid .auth-input {
    border-color: var(--clr-success);
}

.auth-form-group.is-valid .input-icon {
    color: var(--clr-success);
}

.auth-form-group.is-invalid .auth-input {
    border-color: var(--clr-danger);
}

.auth-form-group.is-invalid .input-icon {
    color: var(--clr-danger);
}

.auth-error-text {
    display: block;
    color: var(--clr-danger);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    padding-left: 0.25rem;
    animation: shakeError 0.3s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ─── Checkbox / Remember Me ────────────────────────────── */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

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

.auth-checkbox label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}

.auth-forgot-link {
    color: var(--clr-accent);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-forgot-link:hover {
    color: #7DD8F5;
    text-decoration: underline;
}

/* ─── Auth Button ───────────────────────────────────────── */
.auth-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark));
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-primary, 'Inter', sans-serif);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.auth-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--clr-primary-dark), var(--clr-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.4);
}

.auth-btn:hover::before {
    opacity: 1;
}

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

.auth-btn span,
.auth-btn i {
    position: relative;
    z-index: 1;
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading state */
.auth-btn.loading {
    pointer-events: none;
}

.auth-btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.6s linear infinite;
}

.auth-btn.loading .spinner {
    display: block;
}

.auth-btn.loading .btn-text {
    display: none;
}

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

/* ─── Divider ───────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8125rem;
}

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

/* ─── Auth Footer ───────────────────────────────────────── */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--clr-accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: #7DD8F5;
}

/* ─── Alert Messages ────────────────────────────────────── */
.auth-alert {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: authSlideDown 0.3s ease-out;
}

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

.auth-alert i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.auth-alert-error {
    background: rgba(239, 71, 111, 0.15);
    border: 1px solid rgba(239, 71, 111, 0.25);
    color: #FF8FA3;
}

.auth-alert-success {
    background: rgba(6, 214, 160, 0.15);
    border: 1px solid rgba(6, 214, 160, 0.25);
    color: #5AEDC1;
}

.auth-alert-warning {
    background: rgba(255, 183, 3, 0.15);
    border: 1px solid rgba(255, 183, 3, 0.25);
    color: #FFCF56;
}

.auth-alert-info {
    background: rgba(76, 201, 240, 0.15);
    border: 1px solid rgba(76, 201, 240, 0.25);
    color: #7DD8F5;
}

/* ─── Back to Home Link ─────────────────────────────────── */
.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
}

.auth-back-link:hover {
    color: #fff;
}

/* ─── Password Strength Meter ───────────────────────────── */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.375rem;
}

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

.strength-bar-fill.weak { width: 25%; background: var(--clr-danger); }
.strength-bar-fill.fair { width: 50%; background: var(--clr-warning); }
.strength-bar-fill.good { width: 75%; background: var(--clr-accent); }
.strength-bar-fill.strong { width: 100%; background: var(--clr-success); }

.strength-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

.strength-text.weak { color: var(--clr-danger); }
.strength-text.fair { color: var(--clr-warning); }
.strength-text.good { color: var(--clr-accent); }
.strength-text.strong { color: var(--clr-success); }

/* ─── Success Check Animation ───────────────────────────── */
.auth-success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(6, 214, 160, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: successPop 0.5s ease-out;
}

.auth-success-icon i {
    font-size: 2.5rem;
    color: var(--clr-success);
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 576px) {
    .auth-page {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.75rem 1.5rem;
        border-radius: 16px;
    }

    .auth-logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        border-radius: 12px;
    }

    .auth-logo-text {
        font-size: 1.25rem;
    }

    .auth-title {
        font-size: 1.25rem;
    }

    .role-toggle-btn {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }

    .auth-options {
        flex-direction: column;
        align-items: flex-start;
    }
}
