/* TRAE Auth Styles with Light/Dark Mode */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* CSS Variables for Theming */
:root {
    /* Default to Dark Mode (Trae Style) */
    --bg-page: #050505;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --text-placeholder: #525252;
    
    --input-bg: #1a1a1a;
    --input-border: #333333;
    --input-focus: #555555;
    --input-bg-focus: #222;
    
    --social-btn-bg: #ffffff;
    --social-btn-text: #000000;
    --social-btn-hover: #e5e5e5;
    
    --btn-primary-bg: #00e599;
    --btn-primary-text: #000000;
    
    --logo-filter: none;
    
    --legal-text: #525252;
    --legal-link: #a1a1aa;
    --legal-link-hover: #ffffff;
}

/* Light Mode Override - Class Based */
body.light-theme {
    --bg-page: #f3f4f6;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-placeholder: #94a3b8;
    
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-focus: #2563eb;
    --input-bg-focus: #ffffff;
    
    --social-btn-bg: #f8fafc;
    --social-btn-text: #334155;
    --social-btn-hover: #f1f5f9;
    
    --btn-primary-bg: #2563eb;
    --btn-primary-text: #ffffff;
    
    --logo-filter: none;
    
    --legal-text: #94a3b8;
    --legal-link: #64748b;
    --legal-link-hover: #0f172a;
}

/* Dark Mode Override - Class Based (Force Dark) */
body.dark-theme {
    --bg-page: #050505;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --text-placeholder: #525252;
    
    --input-bg: #1a1a1a;
    --input-border: #333333;
    --input-focus: #555555;
    --input-bg-focus: #222;
    
    --social-btn-bg: #ffffff;
    --social-btn-text: #000000;
    --social-btn-hover: #e5e5e5;
    
    --btn-primary-bg: #00e599;
    --btn-primary-text: #000000;
    
    --logo-filter: none;
    
    --legal-text: #525252;
    --legal-link: #a1a1aa;
    --legal-link-hover: #ffffff;
}

/* System Preference (Default) */
@media (prefers-color-scheme: light) {
    :root {
        --bg-page: #f3f4f6;
        --text-main: #0f172a;
        --text-muted: #64748b;
        --text-placeholder: #94a3b8;
        
        --input-bg: #ffffff;
        --input-border: #e2e8f0;
        --input-focus: #2563eb;
        --input-bg-focus: #ffffff;
        
        --social-btn-bg: #f8fafc;
        --social-btn-text: #334155;
        --social-btn-hover: #f1f5f9;
        
        --btn-primary-bg: #2563eb;
        --btn-primary-text: #ffffff;
        
        --logo-filter: none;
        
        --legal-text: #94a3b8;
        --legal-link: #64748b;
        --legal-link-hover: #0f172a;
    }
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

.auth-page-trae {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    position: relative;
    transition: background-color 0.3s, color 0.3s;
}

/* Corner Logo */
.trae-logo-corner {
    position: absolute;
    top: 2.5rem;
    left: 2.5rem;
    width: 90px;
    display: block;
    z-index: 10;
}

.trae-logo-corner img {
    width: 100%;
    height: auto;
    filter: var(--logo-filter); 
    display: block;
    transition: filter 0.3s;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 100;
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
    background-color: var(--input-bg-focus);
}

/* Auth Container */
.trae-auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Typography */
.trae-title {
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Social Buttons */
.trae-social-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.trae-social-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--social-btn-bg);
    color: var(--social-btn-text);
    border: 1px solid transparent; /* Prepare for light mode border if needed */
    border-radius: 4px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
}

@media (prefers-color-scheme: light) {
    .trae-social-btn {
        border: 1px solid #e2e8f0;
    }
}

.trae-social-btn:hover {
    background: var(--social-btn-hover);
}

.trae-social-btn:active {
    transform: scale(0.98);
}

.trae-social-btn i {
    font-size: 1.1rem;
}

/* Brand Colors */
.trae-social-btn.github {
    background: #24292e !important;
    color: #ffffff !important;
    border: 1px solid #24292e !important;
}
.trae-social-btn.github:hover {
    background: #1b1f23 !important;
}

.trae-social-btn.google {
    background: #ffffff !important;
    color: #3c4043 !important;
    border: 1px solid #dadce0 !important;
}
.trae-social-btn.google i, .trae-social-btn.google svg {
    color: #4285F4 !important;
}
.trae-social-btn.google svg {
    width: 20px;
    height: 20px;
    margin-right: 8px; /* Slightly adjust spacing for SVG */
}
.trae-social-btn.google:hover {
    background: #f8f9fa !important;
    border-color: #d2e3fc !important;
}

/* Form Styles */
.trae-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.trae-input-group {
    position: relative;
}

.trae-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 0.85rem 1rem;
    color: var(--text-main);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
}

.trae-input:focus {
    outline: none;
    border-color: var(--input-focus);
    background: var(--input-bg-focus);
}

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

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-placeholder);
    cursor: pointer;
    font-size: 0.9rem;
}

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

.trae-form-options {
    display: flex;
    justify-content: flex-start; 
}

.trae-forgot {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.trae-forgot:hover {
    color: var(--text-main);
}

/* Primary Button */
.trae-btn-primary {
    width: 100%;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-weight: 700;
    padding: 0.85rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    margin-top: 1rem;
    font-family: 'Inter', sans-serif;
    transition: opacity 0.2s;
}

.trae-btn-primary:hover {
    opacity: 0.9;
}

.trae-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Sub Links */
.trae-sub-links {
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
}

.trae-sub-links span {
    color: var(--text-muted);
}

.trae-sub-links a {
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    margin-left: 0.25rem;
}

.trae-sub-links a:hover {
    text-decoration: underline;
}

/* Auth Message */
.auth-msg {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: none;
}

.auth-msg.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-msg.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Legal Footer */
.trae-footer-legal {
    margin-top: 4rem;
    font-size: 0.75rem;
    color: var(--legal-text);
    line-height: 1.5;
    text-align: left;
}

.trae-footer-legal a {
    color: var(--legal-link);
    text-decoration: none;
    font-weight: 500;
}

.trae-footer-legal a:hover {
    color: var(--legal-link-hover);
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .trae-logo-corner {
        top: 1.5rem;
        left: 1.5rem;
        width: 70px;
    }
    
    .trae-auth-container {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    .trae-title {
        font-size: 1.5rem;
    }
}
