﻿/* ==========================================================================
   CSS RESPONSIVO - MOBILE FIRST (Hora Meu RemÃ©dio)
   ========================================================================== */

:root {
    --primary-color: #1565C0;
    --primary-hover: #0D47A1;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --text-color: #333;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    
    /* Cores Premium / Novas â€” baseadas no logo */
    --brand-navy: #132444;
    --brand-blue: #1565C0;
    --brand-cyan: #00BCD4;
    --border-color: #D0E4F5;
    --text-secondary: #546E8A;
    
    /* Tipografia responsiva usando clamp */
    /* font-size min: 14px, preferido: calc, max: 16px */
    --fs-body: clamp(0.875rem, 0.8rem + 0.375vw, 1rem); 
    --fs-h1: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
    --fs-h2: clamp(1.25rem, 1.1rem + 1vw, 2rem);
    --fs-h3: clamp(1.1rem, 1rem + 0.5vw, 1.5rem);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: var(--fs-body);
    line-height: 1.6;
    overflow-x: hidden; /* Evita barra de rolagem horizontal */
}

/* ==========================================================================
   LAYOUT GERAL (Grid/Flex)
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem; /* Margem segura no mobile */
}

/* ==========================================================================
   IMAGENS
   ========================================================================== */
img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   BOTÃ•ES (Min 44x44px para toque seguro)
   ========================================================================== */
.btn, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    min-height: 44px; /* Acessibilidade Touch */
    min-width: 44px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--fs-body);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.2;
}

.btn-primary {
    background-color: var(--brand-blue);
    color: #fff;
    border: none;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}
.btn-success {
    background-color: var(--success-color);
    color: #fff;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    width: 100%; /* Ocupa tudo no mobile por padrÃ£o */
}

@media (min-width: 768px) {
    .btn-large {
        width: auto; /* Volta ao tamanho normal em telas maiores */
    }
}

/* ==========================================================================
   HEADER & MENU (Mobile First)
   ========================================================================== */
.main-header {
    background-color: var(--brand-navy);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.main-header h1 {
    font-size: var(--fs-h2);
    color: white;
    margin: 0;
}

/* Menu no celular fica oculto por padrÃ£o e Ã© ativado via classe CSS (HambÃºrguer) */
.main-header nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.main-header nav.active {
    display: flex;
}

.main-header a.btn {
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    width: 100%;
    justify-content: flex-start;
}

.main-header a.btn-danger {
    border: none;
}

/* BotÃ£o HambÃºrguer (Injetado via JS) */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: 0.3s;
}

@media (min-width: 768px) {
    .menu-toggle {
        display: none; /* Esconde no desktop */
    }
    .main-header nav {
        display: flex;
        width: auto;
        flex-direction: row;
        margin-top: 0;
        gap: 1rem;
    }
    .main-header a.btn {
        width: auto;
        justify-content: center;
    }
}

/* ==========================================================================
   FORMULÃRIOS
   ========================================================================== */
.form-container {
    background: #fff;
    padding: 2rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 500px;
    margin: 2rem auto;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--brand-navy);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px; /* Evita zoom no mobile */

    font-family: inherit;
    min-height: 44px; /* Touch target */
    transition: 0.3s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* FormulÃ¡rios em Grid para telas maiores */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
}

/* ==========================================================================
   DASHBOARD & CARDS
   ========================================================================== */
.dashboard-header {
    margin: 2rem 0;
    text-align: center;
}

@media (min-width: 768px) {
    .dashboard-header {
        text-align: left;
    }
}

/* Quebra fluÃ­da automÃ¡tica de colunas */
.stats-grid {
    display: grid;
    /* ComeÃ§a com 1 coluna no mobile, vai quebrando pra 2, 3, etc. */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    text-align: center;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.highlight-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 5px solid var(--brand-blue);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

/* ==========================================================================
   TABELAS RESPONSIVAS
   ========================================================================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* ForÃ§a scroll no mobile se os dados forem grandes */
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
}

tr:hover td {
    background: #f1f5f9;
}

/* SoluÃ§Ã£o Tabela em Cards (AvanÃ§ada) se quiser sem scroll */
@media (max-width: 600px) {
    /* Exemplo genÃ©rico para transformar tabelas em cards (requer classes especÃ­ficas, 
       usando scroll por padrÃ£o que Ã© mais seguro) */
}

/* ==========================================================================
   ALERTS E BADGES
   ========================================================================== */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-weight: 500;
    width: 100%;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ==========================================================================
   MODAIS (Quase full-screen no mobile)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 500px;
    padding: 2rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
    max-height: 95vh;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    flex-direction: column; /* BotÃµes empilhados no mobile */
    gap: 1rem;
    margin-top: 2rem;
}

.modal-actions form {
    width: 100%;
}

@media (min-width: 480px) {
    .modal-actions {
        flex-direction: row; /* Lado a lado em telas maiores */
        flex-wrap: wrap;
        justify-content: center;
    }
}

.main-header .logo-wrapper img { filter: brightness(0) invert(1); }



/* Espaamento base para o fim da pǭgina (mobile) */
main.container { padding-bottom: 3rem; }

