/**
 * Theme CSS Variables for Stormpath
 * Supports light and dark modes with CSS custom properties
 */

/* Light Theme (default variables) */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8fafc;
    --bg-input: #ffffff;
    --text-primary: #333333;
    --text-secondary: #5f6368;
    --text-muted: #8899a6;
    --border-primary: #dfe1e5;
    --border-secondary: #e2e8f0;
    --accent-primary: #1a73e8;
    --accent-hover: #1557b0;
    --accent-active: #0d47a1;
    --accent-secondary: #1976d2;
    --accent-success: #388e3c;
    --accent-warning: #ff9800;
    --accent-cyan: #00bcd4;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --topbar-bg: #222e3c;
    --topbar-text: #ffffff;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-input: #0f3460;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #8899a6;
    --border-primary: #3d5a80;
    --border-secondary: #2d4a70;
    --accent-primary: #4fc3f7;
    --accent-hover: #29b6f6;
    --accent-active: #03a9f4;
    --accent-secondary: #1976d2;
    --accent-success: #4caf50;
    --accent-warning: #ff9800;
    --accent-cyan: #00bcd4;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.5);
    --topbar-bg: #0f1923;
    --topbar-text: #ffffff;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    margin-right: 0.75rem;
}

.theme-toggle:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Base body styles using theme variables */
body.themed {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Common themed elements */
.themed-container {
    background: var(--bg-secondary);
    box-shadow: 0 2px 10px var(--shadow-light);
}

.themed-input {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.themed-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.3);
}

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

.themed-button {
    background-color: var(--accent-primary);
    color: white;
}

.themed-button:hover {
    background-color: var(--accent-hover);
}

.themed-heading {
    color: var(--accent-primary);
}

.themed-text-muted {
    color: var(--text-muted);
}

/* Dropdown menus in dark mode */
[data-theme="dark"] .game-dropdown,
[data-theme="dark"] .suggestions-dropdown {
    background: var(--bg-secondary);
    border-color: var(--border-primary);
}

[data-theme="dark"] .game-option:hover,
[data-theme="dark"] .suggestion-item:hover {
    background: var(--bg-tertiary);
}

/* Google Login Button */
.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 0.5rem 1.25rem;
    color: #444;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(60,64,67,.15);
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
}

.google-login-btn:hover {
    box-shadow: 0 2px 8px rgba(60,64,67,.25);
}

.google-login-btn img {
    height: 24px;
    margin-right: 12px;
    vertical-align: middle;
}

/* Dark mode Google Login Button */
[data-theme="dark"] .google-login-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

[data-theme="dark"] .google-login-btn:hover {
    background: #3d4a5c;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* Login Modal Styles */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-modal {
    background: var(--bg-secondary, #fff);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    position: relative;
}

.login-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted, #888);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.login-modal-close:hover {
    color: var(--text-primary, #333);
}

.login-modal-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: var(--text-primary, #333);
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.login-form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary, #666);
}

.login-form-group input {
    padding: 0.75rem;
    border: 1px solid var(--border-primary, #dfe1e5);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #333);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form-group input:focus {
    outline: none;
    border-color: var(--accent-primary, #1a73e8);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.password-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #888);
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.login-submit-btn {
    background: var(--accent-primary, #1a73e8);
    color: #fff;
    border: none;
    padding: 0.85rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.login-submit-btn:hover {
    background: var(--accent-hover, #1557b0);
}

.login-submit-btn:disabled {
    background: var(--text-muted, #888);
    cursor: not-allowed;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--text-muted, #888);
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-primary, #dfe1e5);
}

.login-divider span {
    padding: 0 1rem;
    font-size: 0.85rem;
}

.google-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    padding: 0.75rem;
    color: #444;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
}

.google-oauth-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.google-oauth-btn img {
    height: 20px;
    width: 20px;
}

.login-register-link {
    margin: 1.25rem 0 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
}

.login-register-link a {
    color: var(--accent-primary, #1a73e8);
    text-decoration: none;
    font-weight: 500;
}

.login-register-link a:hover {
    text-decoration: underline;
}

/* Dark mode Login Modal */
[data-theme="dark"] .login-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
}

[data-theme="dark"] .login-error {
    background: #4a1515;
    color: #ff8a80;
}

[data-theme="dark"] .google-oauth-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] .google-oauth-btn:hover {
    background: #3d4a5c;
}
