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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #dce4ef;
    color: #333333;
    min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
    background: #2c3e50;
    color: #ffffff;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar-usuario {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.topbar-usuario i {
    color: #e67e22;
}

.topbar-menu {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-menu {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-menu:hover {
    background: rgba(255,255,255,0.1);
}

.btn-atualizar {
    background: #3498db;
    border-color: #3498db;
}

.btn-atualizar:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.btn-relatorios {
    background: #e67e22;
    border-color: #e67e22;
}

.btn-relatorios:hover {
    background: #d35400;
    border-color: #d35400;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
}

/* ===== DROPDOWN ===== */
.dropdown {
    position: relative;
}

.dropdown-conteudo {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #34495e;
    border-radius: 8px;
    min-width: 220px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    overflow: hidden;
    z-index: 10;
}

.dropdown-conteudo.aberto {
    display: block;
}

.dropdown-conteudo a {
    display: block;
    padding: 13px 18px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background 0.2s;
}

.dropdown-conteudo a:last-child {
    border-bottom: none;
}

.dropdown-conteudo a:hover {
    background: #e67e22;
}

/* ===== CONTEÚDO ===== */
.conteudo {
    padding: 30px 22px;
}

/* ===== LOGIN / CADASTRO / DASHBOARD ===== */
.login-container {
    background: #ffffff;
    max-width: 420px;
    margin: 40px auto;
    padding: 45px 38px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.08);
    border-top: 4px solid #d35400;
    animation: fadeInUp 0.6s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: -0.3px;
    margin-bottom: 8px;
}

.login-header h1 i {
    color: #d35400;
}

.login-header p {
    color: #7f8c8d;
    font-size: 14px;
}

/* ===== FORMULÁRIOS ===== */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    letter-spacing: 0.2px;
}

.form-group input {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid #c8d1dc;
    border-radius: 10px;
    font-size: 16px;
    color: #2c3e50;
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.form-group input:focus {
    outline: none;
    border-color: #d35400;
    background: #fffaf5;
    box-shadow: 0 0 0 4px rgba(211,84,0,0.2), inset 0 1px 2px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

/* ===== BOTÕES ===== */
.btn {
    width: 100%;
    padding: 17px;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    margin-bottom: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-primary {
    background: linear-gradient(135deg, #d35400, #e67e22);
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(211, 84, 0, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #c0392b, #d35400);
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(211, 84, 0, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.25);
    text-decoration: none;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #2980b9, #1f639e);
    transform: translateY(-4px);
}

.btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(211, 84, 0, 0.25);
}

/* ===== ALERTAS ===== */
.alerta {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDownFade 0.4s ease;
}

.alerta-erro {
    background: #fef5f0;
    border-left: 4px solid #d35400;
    color: #a04000;
}

.alerta-sucesso {
    background: #eafaf1;
    border-left: 4px solid #28a745;
    color: #155724;
}

.alerta-info {
    background: #e8f0fe;
    border-left: 4px solid #3498db;
    color: #1f618d;
}

/* ===== LINK DE RODAPÉ ===== */
.texto-rodape {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #7f8c8d;
}

.texto-rodape a {
    color: #a04000;
    font-weight: 600;
    text-decoration: none;
}

.texto-rodape a:hover {
    color: #d35400;
    text-decoration: underline;
}

/* ===== PÁGINAS INTERNAS ===== */
.pagina-container {
    background: #ffffff;
    max-width: 720px;
    margin: 40px auto;
    padding: 40px 35px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.08);
    border-top: 4px solid #d35400;
    animation: fadeInUp 0.6s ease-out;
}

.pagina-header {
    text-align: center;
    margin-bottom: 30px;
}

.pagina-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}

.pagina-header h1 i { color: #d35400; }

.pagina-header p {
    color: #7f8c8d;
    font-size: 14px;
}

/* ===== LISTA DE USUÁRIOS ===== */
.lista-usuarios {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.usuario-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #f8f9fa;
    border: 2px solid #e8edf4;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.usuario-item:hover {
    border-color: #d35400;
    background: #fffaf5;
    transform: translateY(-2px);
}

.usuario-info { flex: 1; min-width: 0; }

.usuario-nome {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 2px;
    font-size: 15px;
}

.usuario-email {
    font-size: 13px;
    color: #7f8c8d;
}

.usuario-relatorios {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

.tag-rel {
    background: #e67e22;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.tag-vazia {
    background: #c8d1dc;
}

.usuario-seta {
    color: #c8d1dc;
    font-size: 14px;
}

.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    margin-left: 6px;
    letter-spacing: 0.5px;
}

.badge-admin { background: #3498db; color: #fff; }
.badge-inativo { background: #c0392b; color: #fff; }

/* ===== FORMULÁRIO DE PERMISSÕES ===== */
.permissoes-box {
    background: #f8f9fa;
    border: 2px solid #e8edf4;
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 20px;
}

.permissoes-box h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 14px;
    font-weight: 700;
}

.checkbox-linha {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    border-bottom: 1px solid #e8edf4;
}

.checkbox-linha:last-child { border-bottom: none; }

.checkbox-linha input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #d35400;
    cursor: pointer;
    flex-shrink: 0;
}

.texto-pequeno {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 8px;
    font-style: italic;
}

/* ===== BOTÕES LADO A LADO ===== */
.botoes-duplos {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.botoes-duplos .btn {
    flex: 1;
    margin-bottom: 0;
}

/* ===== RELATÓRIO ===== */
.relatorio-container {
    background: #ffffff;
    max-width: 1100px;
    margin: 20px auto;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.relatorio-botoes {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.relatorio-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #d35400;
    padding-bottom: 10px;
}

.relatorio-header h1 { font-size: 18px; color: #2c3e50; margin-bottom: 5px; }
.relatorio-header h2 { font-size: 14px; color: #333; font-weight: normal; margin-bottom: 5px; }
.relatorio-header p { font-size: 12px; color: #7f8c8d; }

.filtros-relatorio {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e8edf4;
}

.filtros-linha {
    display: flex;
    gap: 15px;
    align-items: center;
}

.filtros-linha .form-group { margin-bottom: 0; }
.filtros-linha label { margin-bottom: 5px; display: block; font-size: 13px; font-weight: 600; }
.filtros-linha input, .filtros-linha select { padding: 10px; border: 1px solid #c8d1dc; border-radius: 6px; width: 100%; }

.tabela-scroll { overflow-x: auto; }

.tabela-matriz {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-family: Arial, sans-serif;
}

.tabela-matriz th, .tabela-matriz td {
    border: 1px solid #333;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
}

.tabela-matriz th { background: #eee; font-weight: bold; }
.celula-cliente { text-align: left; font-size: 10px; }
.celula-mes { width: 60px; }

/* Linha mais grossa separando os clientes */
.tabela-matriz tr.linha-novo-cliente td {
    border-top: 3px solid #333 !important;
}

/* Tabela falsa usada apenas para fixar o cabeçalho na impressão */
.tabela-cabecalho-impressao {
    width: 100%;
    border-collapse: collapse;
    border: none;
}
.tabela-cabecalho-impressao td {
    border: none;
    padding: 0;
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .topbar-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 8px;
        padding-top: 12px;
    }

    .topbar-menu.aberto { display: flex; }

    .btn-menu {
        width: 100%;
        justify-content: flex-start;
    }

    .dropdown { width: 100%; }

    .dropdown-conteudo {
        position: static;
        width: 100%;
        margin-top: 6px;
        box-shadow: none;
    }
}

@media (max-width: 480px) {
    body { background: #d1dbe8; }

    .login-container {
        padding: 35px 25px;
        border-radius: 14px;
        margin: 20px auto;
    }

    .login-header h1 { font-size: 26px; }

    .conteudo { padding: 20px 16px; }
    
    .pagina-container { padding: 28px 20px; margin: 20px auto; }
    .pagina-header h1 { font-size: 22px; }
    .usuario-item { flex-wrap: wrap; }
    .usuario-relatorios { width: 100%; justify-content: flex-start; }
    .botoes-duplos { flex-direction: column; }
}

/* ===== REGRAS DE IMPRESSÃO (PDF) ===== */
@media print {
    /* Esconde menus, botões e filtros da tela */
    .no-print, .topbar { 
        display: none !important; 
    }
    
    body { background: #fff !important; margin: 0; padding: 0; }
    .conteudo { padding: 0 !important; }
    
    .relatorio-container { 
        box-shadow: none !important; 
        max-width: 100% !important; 
        margin: 0 !important; 
        padding: 0 !important; 
        border: none !important;
    }

    /* MÁGICA: Obriga o navegador a repetir a "tabela falsa" do cabeçalho no topo de cada folha */
    .tabela-cabecalho-impressao thead {
        display: table-header-group !important;
    }

    /* Deixa o cabeçalho bonitinho para a impressão */
    .relatorio-header {
        border-bottom: 2px solid #d35400;
        margin-bottom: 15px;
        padding-bottom: 10px;
        text-align: center;
    }

    /* Repete o cabeçalho da tabela (Jan, Fev, Mar...) */
    .tabela-matriz thead {
        display: table-header-group !important;
    }
    
    /* Evita cortar o cliente no meio entre as páginas */
    tr {
        page-break-inside: avoid !important;
    }
    
    .tabela-matriz th, .tabela-matriz td { 
        border: 1px solid #000 !important; 
    }
    
    .tabela-scroll { 
        overflow: visible !important; 
    }
}
