/**
 * API Cost Monitor - Modern Authentication Pages
 * Design: Split-screen with gradient, glassmorphism effects
 */

/* Root variables for auth pages */
:root {
    --auth-primary: #667eea;
    --auth-secondary: #764ba2;
    --auth-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --auth-gradient-animated: linear-gradient(-45deg, #667eea, #764ba2, #6366f1, #8b5cf6);
    --auth-card-bg: rgba(255, 255, 255, 0.95);
    --auth-card-bg-dark: rgba(30, 41, 59, 0.95);
    --auth-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --auth-border-radius: 24px;
    --auth-input-radius: 12px;
}

/* Main auth container - full viewport */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    background: var(--auth-gradient);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
    overflow: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating decorative elements */
.auth-wrapper::before,
.auth-wrapper::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.auth-wrapper::before {
    width: 300px;
    height: 300px;
    top: -50px;
    right: -50px;
    animation-delay: 0s;
}

.auth-wrapper::after {
    width: 200px;
    height: 200px;
    bottom: -30px;
    left: 10%;
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* Left side - Branding/Illustration */
.auth-brand-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: white;
    position: relative;
    z-index: 1;
}

.auth-brand-side h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-brand-side p {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 400px;
    text-align: center;
    line-height: 1.6;
}

.auth-brand-features {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-brand-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    opacity: 0.9;
}

.auth-brand-feature i {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Right side - Form card */
.auth-form-side {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Auth card - glassmorphism effect */
.auth-card {
    background: var(--auth-card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--auth-border-radius);
    box-shadow: var(--auth-shadow);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

/* Wide card variant (for signup) */
.auth-card.auth-card-wide {
    max-width: 580px;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--auth-gradient);
}

/* Dark mode card */
[data-theme-version="dark"] .auth-card {
    background: var(--auth-card-bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.auth-logo img {
    height: 56px;
    width: auto;
}

/* Auth title */
.auth-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

.auth-title p {
    font-size: 0.9rem;
    color: #718096;
}

[data-theme-version="dark"] .auth-title h2 {
    color: #f7fafc;
}

[data-theme-version="dark"] .auth-title p {
    color: #a0aec0;
}

/* OAuth buttons */
.auth-oauth {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.auth-oauth .btn {
    flex: 1;
    min-width: 100px;
    padding: 0.75rem 1rem;
    border-radius: var(--auth-input-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.auth-oauth .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: #a0aec0;
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

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

[data-theme-version="dark"] .auth-divider::before,
[data-theme-version="dark"] .auth-divider::after {
    background: #4a5568;
}

/* Form groups */
.auth-form-group {
    margin-bottom: 1.25rem;
}

.auth-form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

[data-theme-version="dark"] .auth-form-group label {
    color: #e2e8f0;
}

/* Modern inputs */
.auth-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--auth-input-radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.auth-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.auth-input::placeholder {
    color: #a0aec0;
}

[data-theme-version="dark"] .auth-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #f7fafc;
}

[data-theme-version="dark"] .auth-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.1);
}

/* Input group (password with toggle) */
.auth-input-group {
    position: relative;
}

.auth-input-group .auth-input {
    padding-right: 3rem;
}

.auth-input-group .btn-toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.3s ease;
}

.auth-input-group .btn-toggle-password:hover {
    color: var(--auth-primary);
}

/* Form row for side-by-side fields */
.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Remember me / forgot password row */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4a5568;
}

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

.auth-forgot a {
    color: var(--auth-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Primary auth button */
.btn-auth-primary {
    width: 100%;
    padding: 1rem;
    background: var(--auth-gradient);
    border: none;
    border-radius: var(--auth-input-radius);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-auth-primary::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-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

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

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

/* Secondary button */
.btn-auth-secondary {
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 2px solid #e2e8f0;
    border-radius: var(--auth-input-radius);
    color: #4a5568;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.75rem;
}

.btn-auth-secondary:hover {
    border-color: var(--auth-primary);
    color: var(--auth-primary);
    background: rgba(102, 126, 234, 0.05);
}

[data-theme-version="dark"] .btn-auth-secondary {
    border-color: #4a5568;
    color: #e2e8f0;
}

/* Auth footer links */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.auth-footer p {
    color: #718096;
    font-size: 0.9rem;
}

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

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

[data-theme-version="dark"] .auth-footer {
    border-top-color: #4a5568;
}

[data-theme-version="dark"] .auth-footer p {
    color: #a0aec0;
}

/* Terms checkbox */
.auth-terms {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #4a5568;
}

.auth-terms input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    accent-color: var(--auth-primary);
}

.auth-terms a {
    color: var(--auth-primary);
    text-decoration: none;
}

.auth-terms a:hover {
    text-decoration: underline;
}

/* Captcha container */
.auth-captcha {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Loading spinner */
.auth-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--auth-primary);
    font-size: 0.875rem;
    margin-top: 1rem;
}

.auth-loading.show {
    display: flex;
}

/* Alert message */
.auth-alert {
    padding: 1rem;
    border-radius: var(--auth-input-radius);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-alert.auth-alert-danger {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.auth-alert.auth-alert-success {
    background: #c6f6d5;
    color: #276749;
    border: 1px solid #68d391;
}

/* Mobile responsive */
@media (max-width: 992px) {
    .auth-wrapper {
        flex-direction: column;
    }

    .auth-brand-side {
        padding: 2rem;
        flex: 0;
    }

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

    .auth-brand-side p,
    .auth-brand-features {
        display: none;
    }

    .auth-form-side {
        flex: 1;
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

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

@media (max-width: 768px) {
    .auth-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

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

@media (max-width: 576px) {
    .auth-card {
        border-radius: 16px;
        margin: 0 0.5rem;
    }

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

    .auth-form-group {
        margin-bottom: 1rem;
    }

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

    .auth-input {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .btn-auth-primary,
    .btn-auth-secondary {
        padding: 0.875rem;
        font-size: 0.9rem;
    }

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

    .auth-title p {
        font-size: 0.8rem;
    }

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

/* Phone input styling (intl-tel-input) */
.iti {
    width: 100%;
    display: block;
}

.iti .auth-input,
.iti input[type="tel"] {
    padding-left: 90px !important;
    width: 100% !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

.iti__flag-container {
    border-right: 1px solid #e2e8f0;
    pointer-events: auto;
    z-index: 1;
}

[data-theme-version="dark"] .iti__flag-container {
    border-right-color: #4a5568;
}

.iti__country-list {
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.iti--allow-dropdown input,
.iti--allow-dropdown input[type="tel"] {
    padding-left: 90px !important;
}

/* Terms modal styling */
.auth-modal .modal-content {
    border-radius: 16px;
    overflow: hidden;
}

.auth-modal .modal-header {
    background: var(--auth-gradient);
    color: white;
    border: none;
}

.auth-modal .modal-header .close {
    color: white;
    opacity: 1;
}

.auth-modal .modal-footer {
    border: none;
    padding: 1rem 1.5rem;
}

/* Back to website link (bottom of card) */
.auth-back-to-site {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.auth-back-to-site a {
    color: #718096;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-back-to-site a:hover {
    color: var(--auth-primary);
}

.auth-back-to-site a i {
    font-size: 0.75rem;
}

[data-theme-version="dark"] .auth-back-to-site a {
    color: #a0aec0;
}

[data-theme-version="dark"] .auth-back-to-site a:hover {
    color: #818cf8;
}

/* Back button - Top Left Corner */
.auth-back-btn {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.auth-back-btn:hover {
    background: white;
    color: var(--auth-primary);
    transform: translateX(-4px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.auth-back-btn i {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.auth-back-btn:hover i {
    transform: translateX(-3px);
}

.auth-back-btn span {
    white-space: nowrap;
}

/* Dark mode */
[data-theme-version="dark"] .auth-back-btn {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme-version="dark"] .auth-back-btn:hover {
    background: #2d3748;
    color: #818cf8;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .auth-back-btn {
        top: 16px;
        left: 16px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }

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

    .auth-back-btn {
        padding: 12px;
        border-radius: 50%;
    }
}
