/* ------------------------------------------- */
/* 1. VARIÁVEIS E GLOBAIS (Meubeme.care)       */
/* ------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary: #004458;
    --secondary: #32b7bb;
    --accent: #9cdbd6;
    --text: #333333;
    --titles: #000000;
    --bg: #f4f7f6;
    --white: #ffffff;
    --sidebar-width: 260px;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    transition: background 0.3s, color 0.3s;
}

h1, h2, h3, h4, h5, h6 { color: var(--titles); }

/* ------------------------------------------- */
/* 2. BOTÕES GLOBAIS                           */
/* ------------------------------------------- */
.btn {
    font-family: 'Poppins', sans-serif;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background: var(--secondary); color: white; }
.btn-primary:hover { background: var(--primary); }
.btn-prev { background: #eee; color: #555; }
.btn-prev:hover { background: #ddd; }
.btn-outline { border: 1px solid var(--secondary); color: var(--secondary); background: transparent; }
.btn-outline:hover { background: var(--secondary); color: #fff; }
.btn-danger { background: #ff4d4d; color: #fff; border: none; }
.btn-danger:hover { background: #cc0000; }

/* Botões de Ícones Redondos/Sutis nas Tabelas */
.btn-ico { padding: 8px; border-radius: 6px; width: 36px; height: 36px; box-sizing: border-box; }

/* ------------------------------------------- */
/* 3. LAYOUT DO FORMULÁRIO (FRONTEND)          */
/* ------------------------------------------- */
.site-header { background: var(--white); padding: 20px; text-align: center; border-bottom: 1px solid #eee; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.site-footer { background: var(--primary); color: #fff; padding: 30px 20px; text-align: center; margin-top: 50px; font-size: 14px; }

.saas-form-container { 
    background: var(--white); max-width: 800px; width: 100%; 
    border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.08); 
    padding: 40px; margin: 40px auto; position: relative; box-sizing: border-box;
}

.steps-indicator { display: flex; justify-content: space-between; margin-bottom: 40px; position: relative; }
.steps-indicator::before { content: ''; position: absolute; top: 15px; left: 0; right: 0; height: 2px; background: #eee; z-index: 1; }
.step-dot { width: 32px; height: 32px; background: #eee; color: #aaa; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: bold; position: relative; z-index: 2; transition: 0.3s; }
.step-dot.active { background: var(--primary); color: #fff; box-shadow: 0 0 0 5px var(--accent); }
.step-dot.completed { background: var(--secondary); color: #fff; }

.form-step { display: none; animation: fadeIn 0.4s; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.form-step h2 { color: var(--primary); margin-top: 0; border-bottom: 2px solid var(--accent); padding-bottom: 10px; display: inline-block; font-size: 20px;}
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: #555; }
input, select { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; transition: 0.3s; font-family: 'Poppins', sans-serif; }
input:focus, select:focus { border-color: var(--secondary); outline: none; box-shadow: 0 0 5px rgba(50, 183, 187, 0.3); }
.btn-group { display: flex; justify-content: space-between; margin-top: 30px; }

/* ------------------------------------------- */
/* 4. LAYOUT DO PAINEL ADMIN                   */
/* ------------------------------------------- */
.admin-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    position: fixed;
    height: 100vh;
    padding: 30px 20px;
    box-sizing: border-box;
    z-index: 100;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 40px; 
    box-sizing: border-box;
    width: calc(100% - var(--sidebar-width));
}

/* Classes de Cards Semânticos (Eliminando inline styles de fundo) */
.card, .welcome-banner, .edit-form-card, .filter-bar {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    margin-bottom: 25px;
    box-sizing: border-box;
}
.welcome-banner { display: flex; justify-content: space-between; align-items: center; padding: 20px 30px; }

/* ------------------------------------------- */
/* 5. TABELAS E COMPONENTES DO ADMIN           */
/* ------------------------------------------- */
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th { text-align: left; background: #fafafa; padding: 15px; border-bottom: 2px solid #eee; color: var(--primary); font-weight: 600; font-size: 14px; }
td { padding: 15px; border-bottom: 1px solid #eee; font-size: 14px; vertical-align: middle; }
tr:hover { background: #f9f9f9; }

.badge { padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: bold; text-transform: uppercase; display: inline-block; }
.bg-pendente { background: #ffeeba; color: #856404; }
.bg-criado { background: #b8daff; color: #004085; }
.bg-assinado { background: #c3e6cb; color: #155724; }

#loader { display: none; position: fixed; top: 50%; left: calc(50% + 130px); transform: translate(-50%, -50%); z-index: 1000; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--accent); border-top: 4px solid var(--secondary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ------------------------------------------- */
/* 6. MODO NOTURNO ATUALIZADO (100% COBERTO)   */
/* ------------------------------------------- */
body.dark-mode {
    --bg: #121212;
    --white: #1e1e1e;
    --text: #b3b3b3;
    --titles: #ffffff;
}

/* Força títulos a brilharem no escuro mesmo se houver cor inline legada */
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode h5, body.dark-mode h6 { 
    color: #ffffff !important; 
}
body.dark-mode p { color: #aaaaaa !important; }
body.dark-mode small { color: #777777 !important; }

/* Vincula todos os containers ao fundo escuro */
body.dark-mode .card, 
body.dark-mode .welcome-banner, 
body.dark-mode .edit-form-card, 
body.dark-mode .filter-bar {
    background: #1e1e1e !important;
    border: 1px solid #2d2d2d !important;
    box-shadow: 0 4px 25px rgba(0,0,0,0.25) !important;
}

/* Tabelas e Sub-linhas expansíveis */
body.dark-mode table th { background: #252525 !important; border-bottom: 2px solid #333 !important; color: var(--secondary) !important; }
body.dark-mode table td { border-bottom: 1px solid #333 !important; color: #d0d0d0 !important; }
body.dark-mode table tr:hover { background: #252525 !important; }
body.dark-mode table tr[style*="display: table-row"] { background: #161d1d !important; } /* Fundo da tr de gerenciar sutil */

/* Inputs e Dropdowns */
body.dark-mode input, body.dark-mode select { background: #2a2a2a !important; color: #ffffff !important; border-color: #444444 !important; }
body.dark-mode input:focus, body.dark-mode select:focus { border-color: var(--secondary) !important; }
body.dark-mode input[readonly] { background: #1a1a1a !important; color: #555555 !important; }

/* Blocos internos decorativos */
body.dark-mode .row[style*="background: #f4f7f6"],
body.dark-mode .row[style*="background-color: #f4f7f6"] { background: #252525 !important; }
body.dark-mode [style*="background:#f0f4f4"] { background: #2a2a2a !important; color: var(--secondary) !important; }
body.dark-mode [style*="background:#eee"] { background: #333333 !important; color: #bbbbbb !important; }
body.dark-mode .btn-prev { background: #2a2a2a; color: #aaa; }
body.dark-mode .btn-prev:hover { background: #333; }

/* ------------------------------------------- */
/* 7. AJUSTES DE GRID E FILTROS (DASHBOARD)    */
/* ------------------------------------------- */
/* Novas Grids Proporcionais */
.grid-3-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 24px; }
.grid-2-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-bottom: 24px; }
.grid-1-col { margin-bottom: 24px; }

/* Responsividade para Tablets e Celulares */
@media (max-width: 1100px) {
    .grid-3-cols { grid-template-columns: 1fr 1fr; } /* Joga o 3º card pra baixo no tablet */
}
@media (max-width: 800px) {
    .grid-3-cols, .grid-2-cols { grid-template-columns: 1fr; } /* Tudo em 1 coluna no celular */
}

/* Trava a barra de filtros */
.filter-bar { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; }
.filter-bar > div { flex: 0 1 auto; display: flex; flex-direction: column; }
.filter-bar input, .filter-bar select { width: auto !important; min-width: 220px; max-width: 300px; }
select#filtroEvolucao { width: max-content !important; min-width: 0 !important; }

/* ------------------------------------------- */
/* 8. REFINAMENTOS DO MODO NOTURNO             */
/* ------------------------------------------- */
body.dark-mode .sidebar {
    background-color: #0a0a0a !important; /* Preto profundo, mais escuro que o fundo */
    border-right: 1px solid #1e1e1e;
}
body.dark-mode .site-header {
    background-color: #0a0a0a !important;
    border-bottom: 1px solid #1e1e1e !important;
}