/* ==================== RESET E VARIÁVEIS ==================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== TEMA CLARO (PADRÃO) ==================== */
:root, [data-theme="light"] {
    /* Cores Principais */
    --primary: #DC2626;
    --primary-hover: #B91C1C;
    --primary-light: #FEE2E2;

    --secondary: #F59E0B;
    --secondary-hover: #D97706;

    /* Tons Neutros - CLARO */
    --bg-body: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-container: #FFFFFF;
    --bg-brand: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
    --bg-input: #FFFFFF;
    --bg-test-info: #F9FAFB;

    --text-primary: #111827;
    --text-secondary: #2D3748;
    --text-brand: #FFFFFF;

    --border-color: #E5E7EB;
    --border-focus: #DC2626;

    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-500: #2D3748;
    --gray-700: #374151;
    --gray-900: #111827;

    /* Feedbacks */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ==================== TEMA ESCURO ==================== */
[data-theme="dark"] {
    /* Background */
    --bg-body: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-container: #1f2937;
    --bg-brand: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
    --bg-input: #374151;
    --bg-test-info: #111827;

    /* Texto */
    --text-primary: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-brand: #FFFFFF;

    /* Bordas */
    --border-color: #4B5563;
    --border-focus: #DC2626;

    /* Tons Neutros Escuros */
    --gray-50: #374151;
    --gray-100: #4B5563;
    --gray-200: #6B7280;
    --gray-300: #9CA3AF;
    --gray-500: #D1D5DB;
    --gray-700: #E5E7EB;
    --gray-900: #F9FAFB;

    /* Sombras mais suaves no escuro */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Transição suave entre temas */
.theme-transition,
.theme-transition *,
.theme-transition *:before,
.theme-transition *:after {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

/* ==================== CONTAINER PRINCIPAL ==================== */

.login-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    min-height: 650px;
    margin: 20px;
    background: var(--bg-container);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* ==================== LADO ESQUERDO - BRANDING ==================== */

.login-brand {
    flex: 1;
    background: var(--bg-brand);
    color: var(--text-brand);
    padding: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -200px;
    right: -200px;
}

.brand-content {
    position: relative;
    z-index: 1;
}

.logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.login-brand h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 10px;
}

.tagline {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 40px;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
}

.feature .icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ==================== LADO DIREITO - FORMULÁRIO ==================== */

.login-form-container {
    flex: 1;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--bg-container);
}

.login-form-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    margin-bottom: 40px;
}

.login-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ==================== ALERTAS ==================== */

#alert-container {
    margin-bottom: 20px;
}

.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

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

/* ==================== FORMULÁRIO ==================== */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.form-group input {
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.password-input {
    position: relative;
}

.password-input input {
    width: 100%;
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 1;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.forgot-password {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.forgot-password:hover {
    color: var(--primary-hover);
}

/* ==================== BOTÃO DE LOGIN ==================== */

.btn-login {
    padding: 16px 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(220, 38, 38, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Spinner de Loading */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==================== FOOTER DO FORMULÁRIO ==================== */

.login-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-secondary);
    font-size: 14px;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

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

/* ==================== INFORMAÇÕES DE TESTE ==================== */

.test-info {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-test-info);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.test-info strong {
    color: var(--text-primary);
}

.test-info code {
    background: var(--bg-container);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--primary);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.test-info small {
    display: block;
    margin-top: 8px;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* ==================== FOOTER INFO ==================== */

.login-footer-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 30px;
}

.login-footer-info strong {
    color: var(--text-primary);
}

/* ==================== THEME TOGGLE BUTTON ==================== */

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--bg-container);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: var(--shadow-lg);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ==================== RESPONSIVO ==================== */

@media (max-width: 968px) {
    .login-container {
        flex-direction: column;
        max-width: 500px;
    }

    .login-brand {
        padding: 40px;
        min-height: 300px;
    }

    .logo {
        font-size: 60px;
    }

    .login-brand h1 {
        font-size: 36px;
    }

    .login-form-container {
        padding: 40px;
    }

    .login-header h2 {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .login-container {
        margin: 10px;
        border-radius: 15px;
    }

    .login-brand,
    .login-form-container {
        padding: 30px 20px;
    }

    .login-header h2 {
        font-size: 24px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
