/**
 * Authentication Pages - Modern Split-Screen Design
 * Used by: login.html, register.html, forgot_password.html, profile.html, edit_profile.html
 * Design: Split-screen with branding panel + form panel
 */

/* ============================================
   BASE STYLES
   ============================================ */

body.auth-page {
    font-family: var(--font-body, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 50%, var(--dark) 100%);
    min-height: 100vh;
    color: var(--white);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Animated Background Mesh */
.auth-bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.auth-bg-mesh::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
    animation: meshMove 25s ease-in-out infinite;
}

@keyframes meshMove {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
}

/* ============================================
   SPLIT-SCREEN CONTAINER
   ============================================ */

.auth-split-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ============================================
   LEFT PANEL - BRANDING
   ============================================ */

.auth-brand-panel {
    flex: 0 0 45%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-brand-content {
    position: relative;
    z-index: 2;
    max-width: 480px;
}

/* Logo */
.auth-brand-header {
    margin-bottom: 48px;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
}

.logo-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.logo-text {
    font-family: var(--font-display, 'Clash Display', sans-serif);
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--white) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-logo-img {
    height: 48px;
    width: auto;
    filter: brightness(0) invert(1);
}

/* Hero Message */
.auth-brand-hero {
    margin-bottom: 48px;
}

.brand-headline {
    font-family: var(--font-display, 'Clash Display', sans-serif);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--white);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.brand-subheadline {
    font-size: 1.125rem;
    color: var(--gray);
    line-height: 1.6;
}

/* Features List */
.auth-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 48px;
}

.auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    animation: fadeInUp 0.6s ease-out both;
}

.auth-feature:nth-child(1) { animation-delay: 0.1s; }
.auth-feature:nth-child(2) { animation-delay: 0.2s; }
.auth-feature:nth-child(3) { animation-delay: 0.3s; }
.auth-feature:nth-child(4) { animation-delay: 0.4s; }

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

.feature-icon-wrapper {
    width: 44px;
    height: 44px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-icon-wrapper svg {
    width: 20px;
    height: 20px;
    color: var(--primary-light);
}

.feature-icon-wrapper.success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.feature-icon-wrapper.success svg {
    color: var(--success);
}

.feature-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feature-text strong {
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
}

.feature-text span {
    color: var(--gray);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Trust Badge */
.auth-trust {
    margin-top: auto;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    font-size: 0.9rem;
    color: var(--gray);
}

.trust-badge svg {
    width: 18px;
    height: 18px;
    color: var(--success);
}

/* Decorative Circles */
.brand-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    opacity: 0.1;
    filter: blur(60px);
}

.circle-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.circle-2 {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: -50px;
    animation: float 10s ease-in-out infinite reverse;
}

.circle-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    animation: float 12s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

/* ============================================
   RIGHT PANEL - FORM
   ============================================ */

.auth-form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    position: relative;
}

/* Back Link */
.back-link {
    position: absolute;
    top: 32px;
    left: 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 8px;
}

.back-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

.back-link svg {
    width: 18px;
    height: 18px;
}

/* Auth Card */
.auth-card {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

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

/* Auth Header */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

/* Auth Icon Circle (for forgot/reset password pages) */
.auth-icon-circle {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.auth-icon-circle svg {
    width: 28px;
    height: 28px;
}

.auth-icon-circle.auth-icon-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: var(--success);
}

.auth-title {
    font-family: var(--font-display, 'Clash Display', sans-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--gray);
    font-size: 1rem;
}

/* ============================================
   FORM STYLES
   ============================================ */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--light);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.form-label-link {
    color: var(--primary-light);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.3s;
}

.form-label-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.form-label-optional {
    color: var(--gray);
    font-weight: 400;
    font-size: 0.85rem;
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper.focused {
    --focus-glow: rgba(99, 102, 241, 0.2);
}

.input-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--gray);
    pointer-events: none;
    transition: color 0.3s;
    z-index: 2;
}

.input-wrapper.focused .input-icon {
    color: var(--primary-light);
}

/* Form Inputs */
.form-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--white);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-input.has-icon {
    padding-left: 48px;
}

.form-input.has-toggle {
    padding-right: 48px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: var(--gray);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gray);
    transition: color 0.3s;
    z-index: 2;
}

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

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.password-toggle .eye-closed {
    display: none;
}

.password-toggle.showing .eye-open {
    display: none;
}

.password-toggle.showing .eye-closed {
    display: block;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-label {
    color: var(--gray);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

/* ============================================
   PASSWORD STRENGTH METER
   ============================================ */

.password-strength {
    margin-top: 12px;
}

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

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: var(--gray);
}

.strength-fill.weak {
    background: var(--danger);
}

.strength-fill.fair {
    background: var(--warning);
}

.strength-fill.good {
    background: var(--primary);
}

.strength-fill.strong {
    background: var(--success);
}

.strength-text {
    font-size: 0.8rem;
    color: var(--gray);
    transition: color 0.3s;
}

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

/* Password Match Indicator */
.password-match {
    margin-top: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.password-match svg {
    width: 16px;
    height: 16px;
}

.password-match.match {
    color: var(--success);
}

.password-match.no-match {
    color: var(--danger);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-with-icon {
    gap: 10px;
}

.btn-with-icon svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* ============================================
   DIVIDER
   ============================================ */

.divider {
    text-align: center;
    margin: 28px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider-text {
    position: relative;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    padding: 0 16px;
    color: var(--gray);
    font-size: 0.85rem;
}

/* ============================================
   FOOTER & MISC
   ============================================ */

.auth-footer {
    text-align: center;
}

.terms-text {
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 20px;
    line-height: 1.6;
}

.terms-link {
    color: var(--primary-light);
    text-decoration: none;
}

.terms-link:hover {
    text-decoration: underline;
}

/* Mobile Trust Badge */
.mobile-trust {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--gray);
}

.mobile-trust svg {
    width: 16px;
    height: 16px;
    color: var(--success);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    animation: alertSlideIn 0.3s ease-out;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.alert.alert-dismissing {
    animation: alertSlideOut 0.3s ease-out forwards;
}

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

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

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
    font-size: 1.25rem;
}

.alert-close:hover {
    opacity: 1;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-info {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* Form Errors */
.form-error {
    color: #fca5a5;
    font-size: 0.85rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-error svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   PROFILE PAGE STYLES (Legacy Support)
   ============================================ */

.auth-container {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* For non-split-screen pages (profile, etc.) */
body.auth-page .auth-container .auth-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: var(--shadow-soft);
}

.auth-logo {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

/* Info Card (Profile) */
.info-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.info-card-title {
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--gray);
    font-size: 0.9rem;
}

.info-value {
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Lucide Icon Sizing */
.lucide-xl {
    width: 40px;
    height: 40px;
    display: inline-block;
    vertical-align: middle;
    color: var(--primary-light);
}

.lucide-sm {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .auth-brand-panel {
        flex: 0 0 40%;
        padding: 48px;
    }

    .brand-headline {
        font-size: 2rem;
    }

    .auth-form-panel {
        padding: 48px;
    }
}

@media (max-width: 768px) {
    .auth-split-container {
        flex-direction: column;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        padding: 80px 24px 40px;
        min-height: 100vh;
    }

    .back-link {
        top: 20px;
        left: 20px;
    }

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

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

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .mobile-trust {
        display: flex;
    }

    /* Show simplified branding on mobile */
    .auth-header::before {
        content: '';
        display: block;
        width: 48px;
        height: 48px;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        border-radius: 12px;
        margin: 0 auto 20px;
    }
}

@media (max-width: 480px) {
    .auth-form-panel {
        padding: 70px 16px 32px;
    }

    .auth-card {
        padding: 0;
    }

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

    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .form-input {
        padding: 12px 14px;
    }

    .form-input.has-icon {
        padding-left: 44px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-muted {
    color: var(--gray);
    font-size: 0.85rem;
}

.text-center {
    text-align: center;
}

.text-small {
    font-size: 0.85rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
