/* ===== AUTH PAGE STYLES ===== */

.auth-page {
    min-height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
}

.auth-page .header {
    background: transparent;
    border-bottom: 1px solid rgba(79, 172, 254, 0.1);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-back:hover {
    color: var(--primary);
}

/* ===== AUTH CONTAINER ===== */
.auth-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    padding-top: 120px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ===== AUTH CARD ===== */
.auth-card {
    width: 100%;
    max-width: 450px;
    max-height: none;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(79, 172, 254, 0.1);
    box-shadow: var(--shadow-card);
    overflow: visible;
    position: relative;
    z-index: 1;
    margin-bottom: 40px;
}

/* ===== TABS ===== */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(79, 172, 254, 0.1);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

.auth-tab {
    flex: 1;
    padding: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: var(--transition);
}

.auth-tab:hover {
    color: var(--text-secondary);
}

.auth-tab.active {
    color: var(--text-primary);
}

.auth-tab.active::after {
    transform: scaleX(1);
}

/* ===== FORMS ===== */
.auth-form {
    display: none;
    padding: 40px 30px;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.form-header {
    text-align: center;
    margin-bottom: 30px;
}

.form-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== FORM GROUPS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group label i {
    color: var(--primary);
    font-size: 0.85rem;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 2px solid rgba(79, 172, 254, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Password Input */
.password-input {
    position: relative;
}

.password-input input {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

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

.password-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== FORM OPTIONS ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(79, 172, 254, 0.3);
    border-radius: 4px;
    position: relative;
    transition: var(--transition);
}

.checkbox-label input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid var(--bg-dark);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label a {
    color: var(--primary);
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.forgot-password {
    color: var(--primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.forgot-password:hover {
    text-decoration: underline;
}

/* ===== AUTH BUTTON ===== */
.btn-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-dark);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--glow-primary);
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(79, 172, 254, 0.5);
}

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

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

.btn-auth.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-top-color: var(--bg-dark);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Back to login button */
.btn-back-to-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    margin-top: 15px;
    background: transparent;
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-back-to-login:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== FORM MESSAGES ===== */
.form-message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.form-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-message.success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
}

.form-message.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

/* ===== DECORATIONS ===== */
.auth-decoration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.1) 0%, transparent 70%);
}

.circle-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    right: -200px;
}

.circle-2 {
    width: 400px;
    height: 400px;
    bottom: -100px;
    left: -100px;
}

.circle-3 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.5;
}

/* ===== USER BALANCE (for logged in state) ===== */
.user-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 152, 0, 0.15));
    border: 2px solid #ffc107;
    border-radius: 25px;
    color: #ffd54f;
    font-weight: 600;
    font-size: 0.95rem;
    margin-right: 12px;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.3), inset 0 0 10px rgba(255, 193, 7, 0.1);
}

.user-balance i {
    font-size: 1.1rem;
    color: #ffd54f;
    text-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
}

#balance-amount {
    font-weight: 700;
    color: #ffd54f;
    text-shadow: 0 0 5px rgba(255, 193, 7, 0.3);
}

/* ===== USER MENU (for logged in state) ===== */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.user-btn:hover {
    border-color: var(--primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--bg-dark);
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 100;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(79, 172, 254, 0.1);
    color: var(--text-primary);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: rgba(79, 172, 254, 0.1);
    margin: 5px 0;
}

.dropdown-item.logout {
    color: #ff4444;
}

.dropdown-item.logout:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* ===== LOGIN BUTTON (Header) ===== */
.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-login:hover {
    background: var(--primary);
    color: var(--bg-dark);
}

/* ===== AUTH LOADING STATE ===== */
/* Hide auth elements until JS determines the auth state */
.btn-login,
.user-menu,
.user-balance {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Show auth elements once auth state is determined */
body.auth-ready .btn-login,
body.auth-ready .user-menu,
body.auth-ready .user-balance {
    opacity: 1;
    visibility: visible;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .auth-form {
        padding: 30px 20px;
    }

    .form-header h2 {
        font-size: 1.5rem;
    }

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