/* ============================================================
   1. VARIÁVEIS E RESET
============================================================ */
:root {
    --primary: #e67e22;    
    --secondary: #27ae60;  
    --dark: #2c3e50;       
    --light-bg: #f4f7f6;   
    --white: #ffffff;
    --danger: #e74c3c;     
    --info: #3498db;       
    --warning: #f1c40f;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-bg);
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================================
   2. HEADER & NAVEGAÇÃO (Estrutura Principal)
============================================================ */
.admin-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 70px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.header-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    text-decoration: none;
    font-size: 1.1rem; /* Ajustado para caber melhor em telas menores */
    font-weight: 800;
    color: var(--dark);
}
.logo span { color: var(--primary); }

/* ============================================================
   3. MENU SANDWICH (Mobile Toggle)
============================================================ */
.menu-toggle {
    display: none; /* Escondido no Desktop */
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
    z-index: 10001;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--dark);
    border-radius: 3px;
    transition: var(--transition);
}

/* Animação para o "X" quando ativo */
.menu-toggle.is-active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.is-active span:nth-child(2) { opacity: 0; }
.menu-toggle.is-active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ============================================================
   4. MENU DE NAVEGAÇÃO (Lógica Mobile-First Interna)
============================================================ */
.admin-menu ul { 
    list-style: none; 
    display: flex;
    align-items: center;
}

.admin-menu li a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    transition: var(--transition);
}

/* Configurações específicas para Mobile (Até 991px) */
@media (max-width: 991px) {
    .menu-toggle { display: flex; }

    .admin-menu {
        display: none; /* Redundância removida: agora controlado apenas aqui */
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        padding: 10px 0;
        border-top: 1px solid #eee;
    }

    .admin-menu.active { display: flex; animation: fadeIn 0.3s ease; }

    .admin-menu ul { 
        flex-direction: column; 
        width: 100%; 
    }

    .admin-menu li { width: 100%; }

    .admin-menu li a {
        padding: 15px 25px;
        display: block;
        border-bottom: 1px solid #f8f9fa;
    }

    /* Ajuste Dropdown no Mobile */
    .dropdown-content {
        display: none; /* Esconde por padrão no mobile */
        background: #fdfdfd;
        position: static !important;
        box-shadow: none !important;
        padding-left: 20px;
    }
    
    .dropdown.active .dropdown-content { display: block; }
}

/* Configurações para Desktop (A partir de 992px) */
@media (min-width: 992px) {
    .admin-menu { display: flex !important; }
    .admin-menu ul { gap: 10px; }
    .admin-menu li a {
        padding: 8px 16px;
        border-radius: 8px;
    }
    .admin-menu li a:hover {
        background: rgba(230, 126, 34, 0.1);
        color: var(--primary);
    }

    /* Dropdown Desktop */
    .dropdown { position: relative; }
    .dropdown-content {
        visibility: hidden;
        opacity: 0;
        position: absolute;
        top: 100%;
        right: 0;
        min-width: 180px;
        background: var(--white);
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        transform: translateY(10px);
        transition: var(--transition);
        overflow: hidden;
        border: 1px solid #eee;
    }

    .dropdown:hover .dropdown-content {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }

    .dropdown-content a {
        padding: 12px 20px;
        display: block;
        font-size: 0.9rem;
    }
    
    .dropdown-content a:hover { background: #f8f9fa; }
}

/* ============================================================
   5. COMPONENTES E LAYOUT (Resumo das demais sessões)
============================================================ */
.container { width: 100%; max-width: 1200px; margin: 30px auto; padding: 0 20px; }

/* Botão Sair Especial */
.btn-sair {
    color: var(--danger) !important;
}
.btn-sair:hover {
    background: #fff1f0 !important;
}

/* ... (Suas demais sessões 6 a 12 de cards, tabelas e relatórios permanecem iguais) ... */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ============================================================
   6. ANIMAÇÕES GLOBAIS
============================================================ 
*/
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   7. DASHBOARD & CARDS DE PEDIDO
============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border-bottom: 4px solid #eee;
    transition: var(--transition);
}

.stat-card h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-card.border-success { border-bottom-color: var(--secondary); }
.text-operator { color: var(--primary) !important; }

/* Lista de Pedidos */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.pedido-card {
    background: var(--white);
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border-left: 8px solid #ccc;
    transition: var(--transition);
}

@media (min-width: 768px) {
    .pedido-card {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.pedido-card:hover { transform: scale(1.01); box-shadow: 0 8px 15px rgba(0,0,0,0.05); }

/* Cores por Status */
.border-pendente { border-left-color: var(--warning); }
.border-preparando { border-left-color: var(--info); }
.border-entrega { border-left-color: var(--primary); }
.border-finalizado { border-left-color: var(--secondary); }

/* Badges de Status */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.bg-pendente { background: #fff9db; color: #f08c00; }
.bg-preparando { background: #e7f5ff; color: #1c7ed6; }
.bg-entrega { background: #fff4e6; color: #d9480f; }
.bg-finalizado { background: #ebfbee; color: #37b24d; }

/* Detalhes do Pedido */
.pedido-titulo { font-size: 1.2rem; color: var(--dark); }
.pedido-valor-total {
    font-weight: 700;
    color: var(--secondary);
    font-size: 1.1rem;
    margin-top: 10px;
}

.acoes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-dark { background: var(--dark); color: white; padding: 10px 20px; }
.btn-warning { background: var(--warning); color: #000; padding: 10px 20px; }
.btn-info { background: var(--info); color: white; padding: 10px 20px; }
.btn-success { background: var(--secondary); color: white; padding: 10px 20px; }

.empty-state {
    text-align: center;
    padding: 60px;
    background: #fff;
    border-radius: 15px;
    color: #888;
    border: 2px dashed #ddd;
}

/* ============================================================
   8. TABELAS E LISTAGENS (Histórico de Pedidos)
============================================================ */

/* Cabeçalho da página com contador */
.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
}

.count-badge {
    background: var(--dark);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Card que envolve a tabela */
.table-card {
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    overflow: hidden; /* Garante que o border-radius apareça */
}

/* Container para scroll mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Estilo da Tabela */
.table-custom {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px; /* Garante que no mobile ela não "esprema" */
}

.table-custom th {
    background: #f8fafc;
    padding: 15px 20px;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 2px solid #edf2f7;
}

.table-custom td {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-custom tr:last-child td { border-bottom: none; }
.table-custom tr:hover { background-color: #fbfcfe; }

/* Elementos internos da tabela */
.id-tag {
    background: #eee;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: bold;
    color: var(--dark);
}

.td-date { display: flex; flex-direction: column; }
.td-date small { color: #999; }

.text-bold { font-weight: 700; }
.text-primary-color { color: var(--primary); }

/* Botão de ação minimalista */
.btn-action {
    text-decoration: none;
    background: #f1f5f9;
    color: var(--dark);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--dark);
    color: white;
}

/* Ajuste mobile-first para o cabeçalho */
@media (max-width: 600px) {
    .page-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
/* ============================================================
   9. FORMULÁRIOS DE CADASTRO (cadastrar_produto.php)
============================================================ */

/* Container que limita a largura para não esticar demais no PC */
.container-form {
    width: 100%;
    max-width: 800px; /* Largura ideal para leitura de formulários */
    margin: 20px auto;
    padding: 0 15px;
}

/* Card Branco Elevado */
.card-cadastro {
    background: var(--white);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
}

/* Cabeçalho Interno do Card */
.card-header-form {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.card-header-form h3 {
    color: var(--dark);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.card-header-form p {
    color: #64748b;
    font-size: 0.9rem;
}

/* Estrutura de Grupos */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
    margin-bottom: 8px;
}

/* Inputs e Selects */
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--dark);
    transition: var(--transition);
    background-color: #f8fafc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.1);
}

/* Textarea específica */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Texto de ajuda */
.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Grid de duas colunas (Mobile First: Empilhado -> Desktop: Lado a Lado) */
@media (min-width: 768px) {
    .form-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

/* Ações e Botões */
.form-acoes {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.btn-lg {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    justify-content: center;
}

.btn-cancelar {
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-cancelar:hover {
    color: var(--danger);
    text-decoration: underline;
}

/* Ajuste das ações para Desktop */
@media (min-width: 768px) {
    .form-acoes {
        flex-direction: row-reverse; /* Botão salvar na direita */
        justify-content: space-between;
    }
    
    .btn-lg {
        width: auto;
        min-width: 250px;
    }
}
/* ============================================================
   10. GERENCIAMENTO DE BAIRROS (bairros.php)
============================================================ */

/* Formulário em linha para o cadastro de bairro */
@media (min-width: 768px) {
    .form-row {
        display: flex;
        align-items: flex-end;
        gap: 15px;
    }
    
    .form-row .form-group {
        flex: 1; /* Faz os inputs crescerem por igual */
        margin-bottom: 0;
    }
    
    .btn-block {
        width: auto;
        height: 48px; /* Alinha com a altura dos inputs */
    }
}

/* Lista de Itens (Cards menores) */
.lista-itens {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.item-lista-card {
    background: var(--white);
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #f1f5f9;
    transition: var(--transition);
}

.item-lista-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.item-info {
    display: flex;
    flex-direction: column;
}

.item-info strong {
    font-size: 1.1rem;
    color: var(--dark);
}

.item-info .text-primary {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

/* Botão de Deletar Minimalista */
.btn-delete {
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-delete:hover {
    background: #fff1f0;
    color: var(--danger);
}

/* Estilo para o cabeçalho secundário na mesma página */
.container-form h4 {
    margin-bottom: 5px;
    color: var(--dark);

}

/* ============================================================
   11. RELATÓRIOS E DASHBOARD AVANÇADA
============================================================ */

/* Card de Destaque (Faturamento 30 dias) */
.stat-card-main {
    background: linear-gradient(135deg, var(--dark) 0%, #34495e 100%);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 20px rgba(44, 62, 80, 0.2);
}

.stat-card-main p {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.stat-card-main h2 {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
}

/* Grid de Relatórios */
.grid-reports {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.card-report {
    background: var(--white);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid #edf2f7;
}

.card-report h3 {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Gráfico de Barras CSS */
.chart-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chart-item {
    width: 100%;
}

.chart-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.tag-count {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--primary);
}

.bar-container {
    width: 100%;
    height: 10px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Tabela Minimalista de Faturamento */
.table-minimal {
    width: 100%;
    border-collapse: collapse;
}

.table-minimal tr {
    border-bottom: 1px solid #f1f5f9;
}

.table-minimal tr:last-child { border: none; }

.table-minimal td {
    padding: 12px 0;
}

.text-date {
    color: #64748b;
    font-size: 0.9rem;
}

.text-price {
    text-align: right;
    color: var(--secondary);
    font-size: 1rem;
}

/* Footer e Logout */
.report-footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.btn-logout-clean {
    background: none;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    padding: 10px 25px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout-clean:hover {
    background: #fff1f0;
    color: var(--danger);
    border-color: var(--danger);
}

/* ==========================================================================
   12. GERENCIAMENTO DE USUÁRIOS (Estilo Card Elevado)
   ========================================================================== */

.main-content {
    padding: 20px;
    background-color: #f8fafc; /* Fundo levemente cinza para destacar o card */
    min-height: 100vh;
}

/* O Container que você pediu, estilo Cadastro de Produtos */
.container-usuarios {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.card-usuarios {
    background: #ffffff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
}

/* Estilização da Tabela dentro do Card */
.user-table-container table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.user-table-container th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #f1f5f9;
    color: #64748b;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.user-table-container td {
    padding: 15px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.user-table-container tr:hover {
    background-color: #f8fafc;
}

/* Botão de Ação Estilizado */
.btn-delete {
    background-color: #fee2e2;
    color: #ef4444;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-delete:hover {
    background-color: #ef4444;
    color: white;
}

.wp-link {
    color: #22c55e;
    text-decoration: none;
    font-weight: 600;
}