/* ============================================================
   1. VARIÁVEIS E PALETA DE CORES
============================================================ */
:root {
    /* Cores da Marca */
    --cor-chumbo: #4B5155;
    --cor-chumbo-escuro: #3A3F42;
    --cor-rosa: #DE9F9E;
    --cor-rosa-hover: #c98c8b;
    --cor-dourado: #DDB174;
    --cor-dourado-hover: #cba065;
    
    /* Cores de Fundo e Texto */
    --cor-fundo: #f4f7f6;
    --cor-texto: #333333;
    --cor-texto-claro: #666666;
    --cor-borda: #e0e0e0;
    
    /* Configurações de Layout */
    --sidebar-width: 250px;
}

/* ============================================================
   2. ESTILOS BASE E TIPOGRAFIA
============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--cor-fundo);
    color: var(--cor-texto);
    height: 100vh;
}

h1, h2, h3, h4 {
    color: var(--cor-chumbo);
}

/* ============================================================
   3. TELA DE LOGIN
============================================================ */
body:not(.dashboard-layout) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(75, 81, 85, 0.15); /* Sombra em tom chumbo */
    width: 100%;
    max-width: 400px;
    text-align: center;
    border-top: 5px solid var(--cor-rosa);
}

.login-container h1 { margin-bottom: 0.5rem; }
.login-container p { color: var(--cor-texto-claro); margin-bottom: 2rem; }

.error-message {
    color: #e74c3c;
    margin-top: 1rem;
    min-height: 1.2rem;
    font-weight: bold;
}

/* ============================================================
   4. COMPONENTES: INPUTS E BOTÕES GERAIS
============================================================ */
.input-group { 
    text-align: left; 
    margin-bottom: 1.2rem; 
}

label { 
    display: block; 
    margin-bottom: 0.5rem; 
    color: var(--cor-chumbo); 
    font-weight: 500;
    font-size: 0.95rem;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cor-borda);
    border-radius: 6px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--cor-rosa);
    box-shadow: 0 0 0 3px rgba(222, 159, 158, 0.2);
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Botão Principal (Usado no Login) */
.login-container button {
    width: 100%;
    background-color: var(--cor-rosa);
    color: white;
    padding: 12px;
    font-weight: 600;
    margin-top: 10px;
}
.login-container button:hover { background-color: var(--cor-rosa-hover); }

/* Botões do Sistema */
.btn-success { background-color: var(--cor-dourado); color: white; }
.btn-success:hover { background-color: var(--cor-dourado-hover); }

.btn-danger { background-color: #e74c3c; color: white; }
.btn-danger:hover { background-color: #c0392b; }

.btn-cancel { background-color: #bdc3c7; color: white; }
.btn-cancel:hover { background-color: #95a5a6; }

/* ============================================================
   5. LAYOUT PRINCIPAL (DASHBOARD E SIDEBAR)
============================================================ */
body.dashboard-layout {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--cor-chumbo);
    color: white;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px 10px;
    display: flex;
    justify-content: center;
    background: var(--cor-chumbo-escuro);
}

.toggle-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 90%;
}
.toggle-btn:hover { background: rgba(255,255,255,0.1); }

.sidebar-nav { flex-grow: 1; padding: 15px 0; }
.nav-section { 
    padding: 15px 20px 5px; 
    font-size: 0.75rem; 
    color: var(--cor-dourado); 
    text-transform: uppercase; 
    letter-spacing: 1px;
}

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.2s, padding-left 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { 
    background: rgba(255,255,255,0.05); 
    border-left-color: var(--cor-rosa);
    padding-left: 25px;
}

.sidebar-footer {
    padding: 15px 20px;
    background: var(--cor-chumbo-escuro);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-logout-mini {
    background: transparent;
    border: 1px solid var(--cor-rosa);
    color: var(--cor-rosa);
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
}
.btn-logout-mini:hover {
    background: var(--cor-rosa);
    color: white;
}

/* Sidebar Recolhida */
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .nav-section, 
.sidebar.collapsed a span,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .toggle-btn { width: 40px; padding: 5px; }
.sidebar.collapsed .sidebar-nav a { text-align: center; font-size: 1.2rem; padding: 15px 0; }
.sidebar.collapsed .btn-logout-mini { display: none; }

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    transition: margin-left 0.3s;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.filters { display: flex; gap: 15px; }
.filters input, .filters select { width: auto; padding: 8px 15px; }

/* ============================================================
   6. MODAIS
============================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(75, 81, 85, 0.6); /* Overlay em tom chumbo translúcido */
    backdrop-filter: blur(3px); /* Efeito de desfoque elegante */
}

.modal-content {
    background: white;
    margin: 5vh auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-content h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--cor-borda);
    color: var(--cor-chumbo);
}

.row { display: flex; gap: 15px; }
.row .input-group { flex: 1; }

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--cor-borda);
}
.group-right { display: flex; gap: 10px; }

/* ============================================================
   7. CARDS DE AGENDAMENTO (Refinados)
============================================================ */
#agendaGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 20px;
    padding-bottom: 30px;
}

.agendamento-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 5px solid var(--cor-rosa);
    display: flex;
    flex-direction: column;
}

.agendamento-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--cor-borda);
}

.card-header h4 { margin: 0; font-size: 1.15rem; }

.card-body p {
    margin: 8px 0;
    font-size: 0.95rem;
    color: var(--cor-texto-claro);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body p strong { color: var(--cor-chumbo); min-width: 75px; display: inline-block; }

.card-body p.obs {
    margin-top: 12px;
    font-style: italic;
    background: var(--cor-fundo);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Badges de Status */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.agendado { background-color: var(--cor-rosa); color: white; }
.badge.cancelado { background-color: var(--cor-texto-claro); color: white; }
.badge.confirmado { background-color: var(--cor-dourado); color: white; }
.badge.finalizado { background-color: #5ac476; color: white; }

/* Ações do Card */
.card-actions {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.card-actions button {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-editar {
    background-color: #fcf4e8;
    color: #b3864c;
}
.btn-editar:hover { background-color: #f8e8d3; }

.btn-cancelar {
    background-color: #fff1f0;
    color: #e74c3c;
}
.btn-cancelar:hover { background-color: #ffe4e1; }

/* ============================================================
   8. TABELA DINÂMICA (SPA)
============================================================ */
.top-bar-lista {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--cor-borda);
}

.table-responsive {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    overflow-x: auto;
}

.tabela-dados {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.tabela-dados th, .tabela-dados td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--cor-borda);
}

.tabela-dados th {
    background-color: var(--cor-fundo);
    color: var(--cor-chumbo);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.tabela-dados tr:hover {
    background-color: #fafbfc;
}

/* Botões de Ação na Tabela */
.td-acoes {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--cor-borda);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-icon.edit:hover { background-color: #fcf4e8; color: #b3864c; border-color: #DDB174; }
.btn-icon.delete:hover { background-color: #fff1f0; color: #e74c3c; border-color: #e74c3c; }

/* ============================================================
   9. BARRA DE PESQUISA DA TABELA
============================================================ */
.actions-lista {
    display: flex;
    gap: 15px;
    align-items: center;
}

#inputBusca {
    padding: 10px 18px;
    border: 1px solid var(--cor-borda);
    border-radius: 20px; /* Bordas bem arredondadas estilo "pílula" */
    width: 250px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

/* O Efeito de foco (brilha em rosa e estica um pouquinho) */
#inputBusca:focus {
    outline: none;
    border-color: var(--cor-rosa);
    box-shadow: 0 0 0 3px rgba(222, 159, 158, 0.2);
    width: 300px; 
}