/**
 * Custom Login/Registration Page Styles
 * Branded, modern authentication experience
 */

/* ========================================
   CSS Variables - Authentication Pages
   ======================================== */
:root {
    --auth-primary: #3B82F6;
    --auth-primary-hover: #2563EB;
    --auth-primary-light: #EFF6FF;
    --auth-accent: #6366F1;
    --auth-success: #10B981;
    --auth-success-light: #D1FAE5;
    --auth-error: #EF4444;
    --auth-error-light: #FEE2E2;
    --auth-warning: #F59E0B;
    --auth-text: #1F2937;
    --auth-text-secondary: #6B7280;
    --auth-text-muted: #9CA3AF;
    --auth-border: #E5E7EB;
    --auth-border-light: #F3F4F6;
    --auth-bg: #FFFFFF;
    --auth-bg-subtle: #F9FAFB;
    --auth-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --auth-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --auth-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --auth-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --auth-radius-sm: 6px;
    --auth-radius-md: 12px;
    --auth-radius-lg: 16px;
    --auth-radius-xl: 24px;
    --auth-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --auth-transition: 200ms ease;
}

/* Import DM Sans from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

/* ========================================
   Base Reset for Auth Pages
   ======================================== */
body.auth-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--auth-font);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6B8DD6 100%);
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.auth-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ========================================
   Auth Container
   ======================================== */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    animation: authFadeIn 0.5s ease;
}

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

/* ========================================
   Auth Card
   ======================================== */
.auth-card {
    background: var(--auth-bg);
    border-radius: var(--auth-radius-xl);
    box-shadow: var(--auth-shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* ========================================
   Auth Header
   ======================================== */
.auth-header {
    padding: 40px 40px 32px;
    text-align: center;
    background: linear-gradient(180deg, var(--auth-bg-subtle) 0%, var(--auth-bg) 100%);
    border-bottom: 1px solid var(--auth-border-light);
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-logo-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--auth-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Only show background when no image (text fallback) */
.auth-logo-icon:has(span) {
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-accent) 100%);
    box-shadow: var(--auth-shadow-md);
}

.auth-logo-icon img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: var(--auth-radius-md);
}

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

.auth-logo-icon span {
    font-size: 24px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
}

.auth-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 15px;
    color: var(--auth-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   Auth Body
   ======================================== */
.auth-body {
    padding: 32px 40px 40px;
}

/* ========================================
   Alert Messages
   ======================================== */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--auth-radius-md);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}

.auth-alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.auth-alert-content {
    flex: 1;
}

.auth-alert-content strong {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
}

.auth-alert-error {
    background: var(--auth-error-light);
    color: #B91C1C;
    border: 1px solid #FECACA;
}

.auth-alert-error .auth-alert-icon {
    color: var(--auth-error);
}

.auth-alert-success {
    background: var(--auth-success-light);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.auth-alert-success .auth-alert-icon {
    color: var(--auth-success);
}

.auth-alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.auth-alert-warning .auth-alert-icon {
    color: var(--auth-warning);
}

.auth-alert-info {
    background: var(--auth-primary-light);
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.auth-alert-info .auth-alert-icon {
    color: var(--auth-primary);
}

/* ========================================
   Form Styles
   ======================================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--auth-text);
}

.auth-label-optional {
    font-weight: 400;
    color: var(--auth-text-muted);
    margin-left: 4px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-family: var(--auth-font);
    color: var(--auth-text);
    background: var(--auth-bg);
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    outline: none;
    transition: all var(--auth-transition);
    box-sizing: border-box;
}

.auth-input:hover {
    border-color: var(--auth-text-muted);
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-primary-light);
}

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

.auth-input-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--auth-text-muted);
    pointer-events: none;
}

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

.auth-input-error {
    border-color: var(--auth-error);
}

.auth-input-error:focus {
    box-shadow: 0 0 0 3px var(--auth-error-light);
}

.auth-field-error {
    font-size: 13px;
    color: var(--auth-error);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Password Toggle */
.auth-password-toggle {
    position: absolute;
    right: 12px;
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--auth-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--auth-transition);
}

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

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

/* ========================================
   Form Options Row
   ======================================== */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: -4px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input {
    display: none;
}

.auth-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--auth-border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--auth-transition);
    flex-shrink: 0;
}

.auth-checkbox:hover .auth-checkbox-custom {
    border-color: var(--auth-primary);
}

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

.auth-checkbox input:checked + .auth-checkbox-custom::after {
    content: '';
    width: 10px;
    height: 6px;
    border: 2px solid white;
    border-top: none;
    border-right: none;
    transform: rotate(-45deg) translateY(-1px);
}

.auth-checkbox-label {
    font-size: 14px;
    color: var(--auth-text-secondary);
}

.auth-forgot-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--auth-primary);
    text-decoration: none;
    transition: color var(--auth-transition);
    white-space: nowrap;
}

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

/* ========================================
   Submit Button
   ======================================== */
.auth-submit {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--auth-font);
    color: white;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-accent) 100%);
    border: none;
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    transition: all var(--auth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    box-shadow: var(--auth-shadow-md);
    position: relative;
    overflow: hidden;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: var(--auth-shadow-lg);
}

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

.auth-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-submit-icon {
    width: 20px;
    height: 20px;
}

/* Loading Spinner */
.auth-submit.is-loading {
    pointer-events: none;
}

.auth-submit.is-loading .auth-submit-text {
    opacity: 0;
}

.auth-submit.is-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: authSpinner 0.6s linear infinite;
}

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

/* ========================================
   Divider
   ======================================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider-line {
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-divider-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   Social Buttons
   ======================================== */
.auth-social-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-social-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--auth-font);
    color: var(--auth-text);
    background: var(--auth-bg);
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    transition: all var(--auth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-social-btn:hover {
    background: var(--auth-bg-subtle);
    border-color: var(--auth-text-muted);
}

.auth-social-btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Auth Footer
   ======================================== */
.auth-footer {
    padding: 20px 40px 28px;
    text-align: center;
    background: var(--auth-bg-subtle);
    border-top: 1px solid var(--auth-border-light);
}

.auth-footer-text {
    font-size: 14px;
    color: var(--auth-text-secondary);
    margin: 0;
}

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

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

/* ========================================
   Tab Navigation (Login/Register Toggle)
   ======================================== */
.auth-tabs {
    display: flex;
    background: var(--auth-bg-subtle);
    padding: 4px;
    border-radius: var(--auth-radius-md);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--auth-font);
    color: var(--auth-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--auth-radius-sm);
    cursor: pointer;
    transition: all var(--auth-transition);
}

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

.auth-tab.active {
    background: var(--auth-bg);
    color: var(--auth-text);
    box-shadow: var(--auth-shadow-sm);
}

/* ========================================
   Terms & Privacy
   ======================================== */
.auth-terms {
    font-size: 13px;
    color: var(--auth-text-muted);
    line-height: 1.6;
    text-align: center;
    margin-top: 16px;
}

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

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

/* ========================================
   Branding Footer
   ======================================== */
.auth-branding {
    text-align: center;
    margin-top: 32px;
}

.auth-branding-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-branding-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Only show background when no image (text fallback) */
.auth-branding-logo:has(span) {
    background: rgba(255, 255, 255, 0.2);
}

.auth-branding-logo img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 6px;
}

.auth-branding-logo span {
    font-size: 12px;
    font-weight: 700;
    color: white;
}

/* ========================================
   Password Strength Indicator
   ======================================== */
.auth-password-strength {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.auth-password-bars {
    display: flex;
    gap: 4px;
}

.auth-password-bar {
    flex: 1;
    height: 4px;
    background: var(--auth-border);
    border-radius: 2px;
    transition: background var(--auth-transition);
}

.auth-password-bar.weak {
    background: var(--auth-error);
}

.auth-password-bar.medium {
    background: var(--auth-warning);
}

.auth-password-bar.strong {
    background: var(--auth-success);
}

.auth-password-hint {
    font-size: 12px;
    color: var(--auth-text-muted);
}

.auth-password-hint.weak {
    color: var(--auth-error);
}

.auth-password-hint.medium {
    color: var(--auth-warning);
}

.auth-password-hint.strong {
    color: var(--auth-success);
}

/* ========================================
   Domain Info Box
   ======================================== */
.auth-domain-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--auth-primary-light);
    border-radius: var(--auth-radius-md);
    border: 1px solid #BFDBFE;
    margin-bottom: 24px;
}

.auth-domain-info-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--auth-primary);
}

.auth-domain-info-content {
    flex: 1;
}

.auth-domain-info-title {
    font-size: 14px;
    font-weight: 600;
    color: #1E40AF;
    margin: 0 0 4px;
}

.auth-domain-info-text {
    font-size: 13px;
    color: #1E40AF;
    line-height: 1.5;
    margin: 0;
    opacity: 0.9;
}

.auth-domain-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.auth-domain-tag {
    display: inline-flex;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--auth-primary);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 520px) {
    .auth-wrapper {
        padding: 24px 16px;
    }
    
    .auth-header {
        padding: 32px 24px 24px;
    }
    
    .auth-body {
        padding: 24px;
    }
    
    .auth-footer {
        padding: 16px 24px 20px;
    }
    
    .auth-title {
        font-size: 24px;
    }
    
    .auth-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .auth-logo-icon {
        width: 48px;
        height: 48px;
    }
    
    .auth-logo-icon span {
        font-size: 20px;
    }
}

/* ========================================
   Protected Content Gate Styles
   ======================================== */
.content-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6B8DD6 100%);
    padding: 24px;
}

.content-gate-card {
    background: var(--auth-bg);
    border-radius: var(--auth-radius-xl);
    box-shadow: var(--auth-shadow-xl);
    max-width: 440px;
    width: 100%;
    text-align: center;
    padding: 48px 40px;
    animation: authFadeIn 0.5s ease;
}

.content-gate-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-accent) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--auth-shadow-md);
}

.content-gate-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.content-gate-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.content-gate-text {
    font-size: 16px;
    color: var(--auth-text-secondary);
    line-height: 1.6;
    margin: 0 0 32px;
}

.content-gate-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.content-gate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--auth-font);
    text-decoration: none;
    border-radius: var(--auth-radius-md);
    transition: all var(--auth-transition);
    cursor: pointer;
    border: none;
}

.content-gate-btn-primary {
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-accent) 100%);
    color: white;
    box-shadow: var(--auth-shadow-md);
}

.content-gate-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--auth-shadow-lg);
}

.content-gate-btn-secondary {
    background: var(--auth-bg-subtle);
    color: var(--auth-text);
    border: 1.5px solid var(--auth-border);
}

.content-gate-btn-secondary:hover {
    background: var(--auth-bg);
    border-color: var(--auth-text-muted);
}

@media (max-width: 520px) {
    .content-gate-card {
        padding: 40px 24px;
    }
    
    .content-gate-title {
        font-size: 24px;
    }
    
    .content-gate-icon {
        width: 64px;
        height: 64px;
    }
    
    .content-gate-icon svg {
        width: 32px;
        height: 32px;
    }
}
