/* ============================================================
   Longev Nutrição — Estilos Principais
   Design: Clínica de Nutrição — Profissional e Limpo
   ============================================================ */

:root {
    --primary:     #2e7d32;   /* Verde escuro — saúde */
    --primary-light: #4caf50;
    --primary-dark:  #1b5e20;
    --secondary:   #558b2f;
    --accent:      #8bc34a;
    --sidebar-bg:  #1b5e20;
    --sidebar-text:#e8f5e9;
    --sidebar-hover: rgba(255,255,255,0.12);
    --sidebar-active: rgba(255,255,255,0.2);
    --body-bg:     #f4f6f9;
    --card-bg:     #ffffff;
    --text-dark:   #212529;
    --text-muted:  #6c757d;
    --border:      #dee2e6;
    --shadow:      0 2px 12px rgba(0,0,0,0.08);
    --radius:      12px;
    --sidebar-width: 260px;
}

/* ---- Reset e Base ---- */
* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    margin: 0;
    font-size: 0.92rem;
}

/* ============================================================
   PÁGINA DE LOGIN
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-container { width: 100%; max-width: 420px; }
.login-card {
    background: white;
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem; color: white;
    box-shadow: 0 4px 20px rgba(46,125,50,0.4);
}
.login-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 0.25rem; }
.login-header p  { color: var(--text-muted); font-size: 0.9rem; }
.login-footer    { text-align: center; margin-top: 1.5rem; }

/* ============================================================
   LAYOUT PRINCIPAL (Sidebar + Content)
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-brand-icon {
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-text .brand-name { font-weight: 700; font-size: 1rem; }
.sidebar-brand-text .brand-sub  { font-size: 0.72rem; opacity: 0.7; }

.sidebar-nav { padding: 1rem 0; flex: 1; }
.sidebar-section {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.5;
    margin-top: 0.5rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0;
    transition: background 0.2s;
    font-size: 0.9rem;
}
.sidebar-link:hover  { background: var(--sidebar-hover); color: white; }
.sidebar-link.active { background: var(--sidebar-active); color: white; font-weight: 600; border-left: 3px solid var(--accent); }
.sidebar-link i      { width: 20px; text-align: center; opacity: 0.85; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
    display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem;
}
.sidebar-user-avatar {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem;
    flex-shrink: 0;
}
.sidebar-user-info .user-name { font-size: 0.85rem; font-weight: 600; }
.sidebar-user-info .user-role { font-size: 0.72rem; opacity: 0.7; }

/* ---- Conteúdo Principal ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-dark); }
.content-area { padding: 1.5rem; flex: 1; }

/* ============================================================
   COMPONENTES
   ============================================================ */

/* Cards de Estatísticas */
.stat-card {
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    color: white;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card-primary { background: linear-gradient(135deg, #0d6efd, #0a58ca); }
.stat-card-success  { background: linear-gradient(135deg, #198754, #146c43); }
.stat-card-warning  { background: linear-gradient(135deg, #fd7e14, #dc6502); }
.stat-card-info     { background: linear-gradient(135deg, #0dcaf0, #0aa2c0); }
.stat-icon { font-size: 2.2rem; opacity: 0.85; }
.stat-number { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: 0.82rem; opacity: 0.9; margin-top: 0.2rem; }

/* Título de página */
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text-dark); margin-bottom: 0.25rem; }

/* Avatar do paciente */
.patient-avatar {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 1rem;
    flex-shrink: 0;
}
.patient-avatar-lg {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 2rem;
    flex-shrink: 0;
}
.patient-header-card { border-left: 4px solid var(--primary); }

/* IMC Badge */
.bmi-badge {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    min-width: 100px;
}
.bmi-success { background: #d1e7dd; color: #0f5132; }
.bmi-warning { background: #fff3cd; color: #664d03; }
.bmi-danger  { background: #f8d7da; color: #842029; }
.bmi-info    { background: #cff4fc; color: #055160; }
.bmi-secondary { background: #e2e3e5; color: #41464b; }
.bmi-value   { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.bmi-label   { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.bmi-class   { font-size: 0.75rem; font-weight: 600; margin-top: 0.2rem; }

/* Anamnese */
.anamnesis-block .card-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    background: #f8f9fa;
    transition: background 0.2s;
}
.anamnesis-block .card-header:hover { background: #e9ecef; }
.block-number {
    width: 26px; height: 26px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
    flex-shrink: 0;
}
.anamnesis-header .fa-chevron-down { transition: transform 0.2s; }
.anamnesis-header[aria-expanded="false"] .fa-chevron-down { transform: rotate(-90deg); }

/* Fotos */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: #f0f7f0;
}
.photo-card { border-radius: 8px; overflow: hidden; }
.photo-thumb-container { position: relative; overflow: hidden; cursor: pointer; }
.photo-thumb {
    width: 100%; height: 140px;
    object-fit: cover;
    transition: transform 0.3s;
    display: block;
}
.photo-thumb-container:hover .photo-thumb { transform: scale(1.05); }
.photo-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s;
}
.photo-thumb-container:hover .photo-overlay { opacity: 1; }
.timeline-date-header {
    padding: 0.5rem 0;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 0.5rem;
}

/* Cards gerais */
.card { border: none; border-radius: var(--radius); }
.card-header { background: white; border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; }
.card.shadow-sm { box-shadow: var(--shadow) !important; }

/* Tabelas */
.table th { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.table td { vertical-align: middle; }

/* Botão primário com cor verde */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* Badges */
.badge { font-weight: 500; }

/* Alerts */
.alert { border-radius: var(--radius); border: none; }

/* Formulários */
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(76,175,80,0.2);
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .content-area { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-number { font-size: 1.5rem; }
}

/* Overlay para mobile */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   SCROLLBAR PERSONALIZADA
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
