/* CSS Variables & Design System */
@import url('local_fonts.css');

:root {
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;

    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.4);

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --success: #10b981;
    --warning: #f59e0b;

    --border-color: #e5e7eb;
    --input-bg: #f9fafb;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 4px 14px 0 var(--accent-glow);

    --transition-fast: 0.2s ease;
}

/* Dark Mode Support Placeholder (can be toggled via JS class on body) */
body.dark-mode {
    --bg-main: #111827;
    --bg-card: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    --input-bg: #111827;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.hidden {
    display: none !important;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-center {
    text-align: center;
}

/* Auth Layout */
.auth-container {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
    position: relative;
    overflow: hidden;
}

/* Decorational Shapes */
.auth-container::before,
.auth-container::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.05));
    z-index: 0;
}

.auth-container::before {
    top: -200px;
    left: -200px;
}

.auth-container::after {
    bottom: -200px;
    right: -200px;
}

.auth-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    z-index: 1;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
}

.auth-card.wide {
    max-width: 500px;
}

.brand-header {
    text-align: center;
    margin-bottom: 2rem;
}

.brand-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.5rem;
    letter-spacing: -0.5px;
}

.brand-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Form Elements */
.field-invalid-highlight,
.is-modified.field-invalid-highlight,
.field-updated-highlight.field-invalid-highlight {
    border-color: var(--danger) !important;
    background-color: var(--danger-bg) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    animation: invalid-pulse 1.5s ease-out;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

@keyframes invalid-pulse {
    0% { box-shadow: 0 0 0 0px rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.3); }
    100% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
}

.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.forgot-password-link,
.auth-links a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.forgot-password-link:visited,
.auth-links a:visited {
    color: var(--accent-primary);
}

.forgot-password-link:hover,
.auth-links a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background-color: var(--bg-card);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Captcha Block */
.captcha-block {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.captcha-question {
    background: var(--bg-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: 1px;
    border: 1px solid var(--border-color);
    user-select: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-links p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Alerts / Messages */
.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.alert-error {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Loader Animation */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius-lg);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

.loader-text {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
        margin: 1rem;
        border-radius: var(--radius-md);
    }
}