@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --error: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body.light-theme {
    --bg-dark: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: rgba(0, 0, 0, 0.1);
    background: radial-gradient(circle at top right, #e0e7ff, #f1f5f9);
}
body.light-theme .form-control {
    background: #fff;
    color: #0f172a;
}
body.light-theme .sidebar-logo,
body.light-theme .config-card h3,
body.light-theme .stat-card .value,
body.light-theme .header h2,
body.light-theme .grid-2 h4,
body.light-theme .auth-card h2 {
    color: #0f172a !important;
}

body.light-theme .auth-card h2 {
    background: none !important;
    -webkit-background-clip: border-box !important;
    -webkit-text-fill-color: #0f172a !important;
    color: #0f172a !important;
}

body.light-theme .auth-glow { opacity: 0.1; }

.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--primary);
    color: #fff;
}
.theme-toggle svg { width: 22px; height: 22px; fill: currentColor; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Adicionando um gradient sutil no fundo para dar ar premium */
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-dark));
}

/* =========================================
   Auth Layout (Login / Registro)
========================================= */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Efeito de luz ao fundo */
.auth-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--primary);
    filter: blur(150px);
    border-radius: 50%;
    opacity: 0.3;
    z-index: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 36px;
    width: 95%;
    max-width: 420px;
    max-height: 92vh;
    overflow-y: auto;
    z-index: 1;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-card-large {
    max-width: 680px;
    padding: 40px 44px;
}

/* Responsividade de grid no cadastro */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 480px) {
    .form-grid.g-2 { grid-template-columns: 1fr 1fr; }
    .form-grid.g-3 { grid-template-columns: 1fr 1fr 1fr; }
    .form-grid.g-cep { grid-template-columns: 1fr 2fr; }
}

/* Estilo da barra de rolagem interna do auth-card */
.auth-card::-webkit-scrollbar {
    width: 6px;
}
.auth-card::-webkit-scrollbar-track {
    background: transparent; 
}
.auth-card::-webkit-scrollbar-thumb {
    background: var(--border-color); 
    border-radius: 10px;
}

.auth-card h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-card p.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--primary);
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: #fff;
}

/* =========================================
   Loading Screen Overlay
========================================= */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-overlay p {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 1px;
}

/* Msg de Erro */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: none;
}
.alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: #fca5a5;
}
.alert.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: #6ee7b7;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Profile Button */
.header-profile-btn {
    display: flex; align-items: center; background: var(--card-bg);
    border: 1px solid var(--border-color); padding: 5px 15px 5px 5px;
    border-radius: 30px; color: var(--text-main); text-decoration: none;
    font-weight: 600; transition: all 0.3s; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.header-profile-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.header-profile-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1.1rem; margin-right: 12px;
}
body.light-theme .header-profile-btn { color: var(--text-main); }

/* Botao Sair Sidebar */
.nav-logout {
    margin-top: auto;
    color: var(--error) !important;
    display: flex;
    align-items: center;
}
.nav-logout:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    transform: translateX(4px);
    border-left: 3px solid var(--error);
}
