/* RAIKEN.io Shared Authentication Styles */

/* Reset and base styles for auth pages */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.auth-fullscreen {
    /* Adopt design token typography */
    font-family: var(--type-family-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
    height: 100vh;
    overflow: hidden;
    /* Use token surface/background */
    background: var(--color-bg, var(--shade-000));
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;


html.dark body.auth-fullscreen {
    background: var(--color-bg, #121212);
}
    main {
        margin: 0 !important;
        /* padding: 0 !important; */
    }

}


/* Main auth layout patterns */
.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100vh;
    padding: 2rem;
    gap: 2rem;
}

.auth-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 2rem;
}

/* Visual section with gradient (shared) */
.auth-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.1) 0%,
        rgba(147, 51, 234, 0.1) 25%,
        rgba(236, 72, 153, 0.1) 50%,
        rgba(251, 191, 36, 0.1) 75%,
        rgba(34, 197, 94, 0.1) 100%);
    overflow: hidden;
    border-radius: 1rem;
}

.auth-visual-gradient {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(147, 51, 234, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 60% 80%, rgba(236, 72, 153, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 30% 70%, rgba(251, 191, 36, 0.15) 0%, transparent 50%);
    filter: blur(60px);
    animation: gradient-shift 8s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(2deg); }
}

.auth-visual-content {
    position: relative;
    text-align: center;
    z-index: 2;
    max-width: 420px;
    padding: 1rem;
}

/* brand logo inherits standard typography */

.auth-visual-content h1 {
    color: var(--color-text-primary, #1e293b);
    margin-bottom: 16px;
    line-height: 1.2;
}

.auth-visual-content p {
    font-size: 1.125rem;
    color: var(--color-text-secondary, #64748b);
    line-height: 1.6;
}

.auth-visual-content a {
    color: var(--color-primary, #3b82f6);
    text-decoration: none;
    font-weight: 600;
}

.auth-visual-content a:hover { text-decoration: underline; }

/* Form section (shared) */
.auth-form-section {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Use semantic elevated surface so light/dark modes stay consistent */
    background: var(--color-bg-elevated, #ffffff);
    border: 1px solid var(--color-border, rgba(0,0,0,0.08));
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--elevation-1, 0 4px 20px rgba(0,0,0,0.04));
}

html.dark .auth-form-section {
    background: var(--color-bg-elevated, #1a1a1a);
    border-color: var(--color-border, rgba(255,255,255,0.1));
    box-shadow: var(--elevation-1, 0 4px 8px rgba(0,0,0,0.4));
}

.auth-form-container {
    width: 100%;
    max-width: 360px;
}

.auth-form-container.wide {
    max-width: 480px;
}

/* Headers */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1,
.auth-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--color-text-primary, #1e293b);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--color-text-secondary, #64748b);
    font-size: 1rem;
    line-height: 1.5;
}

/* Alerts (shared) */
.auth-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.auth-alert.success {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.auth-alert.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.auth-alert.info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

/* OAuth buttons (shared) */
.auth-oauth-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-oauth-section.single {
    grid-template-columns: 1fr;
    margin-bottom: 16px;
}

.auth-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-surface-alt, #f8fafc);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text-primary, #374151);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.auth-oauth-btn.secondary {
    background: var(--color-bg-elevated, #ffffff);
    border: 1px solid var(--color-border-muted, #d1d5db);
    color: var(--color-text-secondary, #6b7280);
    font-weight: 400;
    font-size: 0.8rem;
}

.auth-oauth-btn:hover {
    background: var(--color-bg-hover, #f1f5f9);
    border-color: var(--color-border-strong, #cbd5e1);
    transform: translateY(-1px);
}

.auth-oauth-btn.secondary:hover {
    background: var(--color-bg, #f9fafb);
    border-color: var(--color-border-muted, #9ca3af);
}

.auth-oauth-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Divider (shared) */
.auth-divider-section {
    display: flex;
    align-items: center;
    margin: 16px 0 20px 0;
    gap: 12px;
}

.auth-divider-line { flex: 1; height: 1px; background: var(--color-border, #e2e8f0); }

.auth-divider-text { color: var(--color-text-secondary, #64748b); font-size: 0.875rem; font-weight: 500; }

/* Form inputs (shared) */
.auth-input-group {
    position: relative;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.auth-field-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #6b7280;
}

.auth-input-group.ghost-out {
    opacity: 0.3;
    transform: translateY(-2px);
}

.auth-input-group.ghost-in {
    opacity: 1;
    transform: translateY(0);
}

.auth-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.4;
}

.auth-checkbox-label input[type="checkbox"] {
    margin-top: 2px;
}

.auth-checkbox-text { color: var(--color-text-primary, #374151); }

.auth-checkbox-text a { color: var(--color-primary, #3b82f6); text-decoration: none; }

.auth-checkbox-text a:hover { text-decoration: underline; }

.auth-form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--color-bg-elevated, #ffffff);
    transition: all 0.2s ease;
    color: var(--color-text-primary, #1e293b);
}

.auth-form-input:focus {
    outline: none;
    border-color: var(--color-primary, #3b82f6);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary, #3b82f6) 30%, transparent);
}

.auth-form-input::placeholder { color: var(--color-text-secondary, #9ca3af); }

/* Autofill (Chrome / Safari) */
.auth-form-input:-webkit-autofill,
.auth-form-input:-webkit-autofill:hover,
.auth-form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--color-text-primary, #1e293b);
    caret-color: var(--color-text-primary, #1e293b);
    transition: background-color 9999s ease-in-out 0s, color 0.2s ease;
    box-shadow: 0 0 0 1000px var(--color-bg-elevated, #ffffff) inset;
    border-color: var(--color-border, #e2e8f0);
}

html.dark .auth-form-input:-webkit-autofill,
html.dark .auth-form-input:-webkit-autofill:hover,
html.dark .auth-form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--color-text-primary, #f9f9f9);
    caret-color: var(--color-text-primary, #f9f9f9);
    box-shadow: 0 0 0 1000px var(--color-bg-elevated, #1a1a1a) inset;
    border-color: var(--color-border, rgba(255,255,255,0.1));
}

/* Firefox autofill */
input.auth-form-input:-moz-autofill {
    box-shadow: 0 0 0 1000px var(--color-bg-elevated, #ffffff) inset;
    -moz-text-fill-color: var(--color-text-primary, #1e293b);
}
html.dark input.auth-form-input:-moz-autofill {
    box-shadow: 0 0 0 1000px var(--color-bg-elevated, #1a1a1a) inset;
    -moz-text-fill-color: var(--color-text-primary, #f9f9f9);
}

.auth-password-group {
    position: relative;
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary, #6b7280);
    font-size: 1.125rem;
    box-shadow: none;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.auth-password-toggle:hover { color: var(--color-text-primary, #374151); }

/* Buttons (shared) */
.auth-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--color-text-primary, #1e293b);
    color: var(--color-bg-elevated, #ffffff);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 1.25rem 0 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-btn:hover { background: var(--color-text-secondary, #0f172a); transform: translateY(-1px); }

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-btn.loading {
    opacity: 0.85;
    transform: scale(0.995);
}

.auth-btn.secondary { background: var(--color-surface-alt, #f8fafc); color: var(--color-text-primary, #374151); border: 1px solid var(--color-border, #e2e8f0); }

.auth-btn.secondary:hover { background: var(--color-bg-hover, #f1f5f9); border-color: var(--color-border-strong, #cbd5e1); }

/* Form footer (shared) */
.auth-form-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #64748b;
    flex-wrap: wrap;
}

.auth-link { color: var(--color-primary, #3b82f6); text-decoration: none; font-weight: 500; }

.auth-link:hover { text-decoration: underline; }

.auth-footer-separator {
    color: #cbd5e1;
}

/* Info sections */
.auth-info-section {
    background: var(--color-surface-alt, #f8fafc);
    border-radius: 6px;
    padding: 12px 16px;
    margin: 1rem 0 0;
    border: 1px solid var(--color-border, #e2e8f0);
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateY(-2px);
    display: none;
}

.auth-info-section.show {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

.auth-info-section h4 { color: var(--color-text-primary, #374151); font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; }

.auth-info-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.auth-info-section li { color: var(--color-text-secondary, #64748b); font-size: 0.75rem; line-height: 1.3; margin-bottom: 3px; padding-left: 12px; position: relative; }

.auth-info-section li::before { content: '•'; color: var(--color-text-secondary, #94a3b8); position: absolute; left: 0; }

/* Status indicators */
.auth-status-success {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #059669;
    font-size: 0.875rem;
    font-weight: 500;
    background: #f0fdf4;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
    margin: 16px 0;
}

.auth-status-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
    background: #fef2f2;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    margin: 16px 0;
}

/* Loading states */
.auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #64748b;
    font-size: 0.875rem;
    margin: 16px 0;
}

.auth-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .mobile-hidden { display: none !important; }
    .auth-split {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    /* .auth-visual kept visible on mobile for brand presence; previously hidden */
    
    .auth-form-section {
        padding: 2rem;
    }
    
    .auth-oauth-section {
        grid-template-columns: 1fr;
    }
    
    .auth-form-footer {
        flex-direction: column;
        gap: 12px;
    }
    
    .auth-footer-separator {
        display: none;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .auth-visual-gradient {
        animation: none;
    }
    
    .auth-oauth-btn:hover,
    .auth-btn:hover {
        transform: none;
    }
}
