/* ========================================
   AUTH PAGES (Login, Register)
   Premium Casino Style with Glassmorphism
   ======================================== */

/* === PAGE WRAPPER === */
.page-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}

/* === ANIMATED BACKGROUND - Fixed position to avoid scroll issues === */
.page-auth::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(124, 77, 255, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(255, 64, 129, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 230, 118, 0.1) 0%, transparent 40%);
    animation: bgShift 15s ease-in-out infinite alternate;
    z-index: -2;
    pointer-events: none;
}

@keyframes bgShift {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.1) rotate(3deg); }
}

/* Floating particles background - Fixed position */
.auth-particles {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: floatParticle 20s infinite linear;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 25s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; animation-duration: 20s; background: var(--accent); }
.particle:nth-child(3) { left: 30%; animation-delay: 4s; animation-duration: 28s; }
.particle:nth-child(4) { left: 40%; animation-delay: 1s; animation-duration: 22s; background: var(--success); }
.particle:nth-child(5) { left: 50%; animation-delay: 3s; animation-duration: 18s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; animation-duration: 24s; background: var(--gold); }
.particle:nth-child(7) { left: 70%; animation-delay: 2s; animation-duration: 26s; }
.particle:nth-child(8) { left: 80%; animation-delay: 4s; animation-duration: 21s; background: var(--accent); }
.particle:nth-child(9) { left: 90%; animation-delay: 1s; animation-duration: 23s; }
.particle:nth-child(10) { left: 15%; animation-delay: 3s; animation-duration: 27s; background: var(--success); }
.particle:nth-child(11) { left: 25%; animation-delay: 0s; animation-duration: 19s; }
.particle:nth-child(12) { left: 35%; animation-delay: 2s; animation-duration: 25s; background: var(--gold); }
.particle:nth-child(13) { left: 45%; animation-delay: 4s; animation-duration: 22s; }
.particle:nth-child(14) { left: 55%; animation-delay: 1s; animation-duration: 28s; background: var(--primary); }
.particle:nth-child(15) { left: 65%; animation-delay: 3s; animation-duration: 20s; }
.particle:nth-child(16) { left: 75%; animation-delay: 5s; animation-duration: 24s; background: var(--accent); }
.particle:nth-child(17) { left: 85%; animation-delay: 2s; animation-duration: 26s; }
.particle:nth-child(18) { left: 95%; animation-delay: 0s; animation-duration: 21s; background: var(--success); }
.particle:nth-child(19) { left: 5%; animation-delay: 4s; animation-duration: 23s; }
.particle:nth-child(20) { left: 50%; animation-delay: 1s; animation-duration: 27s; background: var(--gold); }

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Grid pattern overlay - Fixed position */
.page-auth::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    pointer-events: none;
}

/* === AUTH WRAPPER === */
.auth-wrapper {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: authFadeIn 0.8s ease-out;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === AUTH CARD (Glassmorphism) === */
.auth-card {
    background: rgba(13, 15, 28, 0.85);
    border-radius: var(--border-radius-lg);
    padding: 48px 40px;
    box-shadow: 
        var(--shadow-lg),
        0 0 60px rgba(124, 77, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
}

/* Glow effect on card edges */
.auth-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    border-radius: 2px;
}

.auth-card::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 30%;
    right: 30%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.5;
}

/* === AUTH HEADER === */
.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 
        0 10px 30px rgba(124, 77, 255, 0.4),
        0 0 50px rgba(124, 77, 255, 0.2);
    position: relative;
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Animated glow ring around logo */
.auth-logo::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: linear-gradient(45deg, var(--primary), var(--accent), var(--primary));
    border-radius: 28px;
    z-index: -1;
    opacity: 0.5;
    animation: logoGlowRotate 3s linear infinite;
}

@keyframes logoGlowRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.auth-logo svg {
    width: 50px;
    height: 50px;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.auth-header h1 {
    font-family: 'Russo One', 'Montserrat', sans-serif;
    font-size: 2rem;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

/* === FORM STYLES === */
.auth-card .form-group {
    margin-bottom: 24px;
    position: relative;
}

.auth-card label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--light);
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.auth-card label svg {
    width: 16px;
    height: 16px;
    fill: var(--primary);
    opacity: 0.7;
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-normal);
}

.auth-card input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(124, 77, 255, 0.1);
    box-shadow: 
        0 0 0 4px rgba(124, 77, 255, 0.15),
        0 0 20px rgba(124, 77, 255, 0.2);
}

.auth-card input::placeholder {
    color: var(--text-muted);
}

/* Form hint text */
.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Password input wrapper with toggle */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 50px;
}

/* Password visibility toggle */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* === PASSWORD STRENGTH INDICATOR === */
.password-strength-container {
    margin-top: 12px;
}

.password-strength {
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
    margin-bottom: 8px;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: var(--transition-normal);
    width: 0;
}

.password-strength-bar.strength-0 { width: 0; background: transparent; }
.password-strength-bar.strength-1 { width: 25%; background: var(--error); }
.password-strength-bar.strength-2 { width: 50%; background: var(--warning); }
.password-strength-bar.strength-3 { width: 75%; background: var(--success); }
.password-strength-bar.strength-4 { 
    width: 100%; 
    background: linear-gradient(90deg, var(--success), var(--primary)); 
}

.password-strength-text {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.password-strength-text.strength-0 { color: var(--text-muted); }
.password-strength-text.strength-1 { color: var(--error); }
.password-strength-text.strength-2 { color: var(--warning); }
.password-strength-text.strength-3 { color: var(--success); }
.password-strength-text.strength-4 { color: var(--primary-light); }

/* Password requirements list */
.password-requirements {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-xs);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.password-requirements p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 8px 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.password-requirements li {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.password-requirements li::before {
    content: '○';
    font-size: 0.6rem;
    color: var(--text-disabled);
    transition: var(--transition-fast);
}

.password-requirements li.valid {
    color: var(--success);
}

.password-requirements li.valid::before {
    content: '●';
    color: var(--success);
}

/* === CUSTOM FILE INPUT === */
.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: var(--transition-normal);
}

.file-input-wrapper:hover {
    border-color: var(--primary);
    background: rgba(124, 77, 255, 0.05);
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(124, 77, 255, 0.3);
}

.file-input-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-input-text.has-file {
    color: var(--success);
    font-weight: 500;
}

/* Avatar preview */
.avatar-upload-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.avatar-upload-preview img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.3);
}

.avatar-upload-preview .remove-avatar {
    background: rgba(255, 82, 82, 0.2);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: var(--error);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.avatar-upload-preview .remove-avatar:hover {
    background: rgba(255, 82, 82, 0.3);
}

/* === SUBMIT BUTTON === */
.auth-card .btn {
    width: 100%;
    margin-top: 8px;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.auth-card .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.auth-card .btn:active::after {
    width: 300px;
    height: 300px;
}

/* Loading state for button */
.auth-card .btn.loading {
    color: transparent;
    pointer-events: none;
}

.auth-card .btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spinCentered 0.8s linear infinite;
}

@keyframes spinCentered {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === ERROR MESSAGES === */
.auth-card .text-error {
    margin-top: 16px;
    text-align: center;
    padding: 12px 16px;
    background: rgba(255, 82, 82, 0.1);
    border: 1px solid rgba(255, 82, 82, 0.2);
    border-radius: var(--border-radius-xs);
    font-size: 0.9rem;
    display: none;
}

.auth-card .text-error:not(:empty) {
    display: block;
    animation: shakeError 0.5s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* === AUTH LINK === */
.auth-link {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-link span {
    color: var(--text-muted);
    margin-right: 6px;
}

.auth-link a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
    position: relative;
}

.auth-link a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.auth-link a:hover {
    color: var(--light);
}

.auth-link a:hover::after {
    width: 100%;
}

/* === CHECKBOX / AGREE TERMS === */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 20px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-wrapper label {
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    display: inline;
}

.checkbox-wrapper label a {
    color: var(--primary-light);
    font-weight: 600;
}

/* === TERMS TEXT === */
.terms-text {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 20px;
    line-height: 1.6;
}

.terms-text a {
    color: var(--primary-light);
    font-weight: 500;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .page-auth {
        padding: 20px 15px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-card {
        padding: 32px 24px;
        border-radius: var(--border-radius);
    }

    .auth-logo {
        width: 76px;
        height: 76px;
        border-radius: 20px;
    }

    .auth-logo svg {
        width: 42px;
        height: 42px;
    }

    .auth-header h1 {
        font-size: 1.7rem;
    }

    .auth-header p {
        font-size: 0.9rem;
    }

    .auth-card input[type="text"],
    .auth-card input[type="email"],
    .auth-card input[type="password"] {
        padding: 14px 16px;
    }

    .auth-card .btn {
        padding: 14px 20px;
    }

    .password-requirements ul {
        grid-template-columns: 1fr;
    }
}

/* === FORM TRANSITION FOR LOGIN/REGISTER SWITCH === */
.auth-form-transition {
    animation: formSlide 0.4s ease-out;
}

@keyframes formSlide {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === LOADING OVERLAY === */
.auth-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 15, 28, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-radius: var(--border-radius-lg);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.auth-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.auth-loading-overlay > * {
    transform: translateZ(0);
}

.auth-loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
    margin: 0;
    flex-shrink: 0;
}

.auth-loading-overlay p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    white-space: nowrap;
}
