/* =========================================
   1. RESET E GLOBAIS
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background-color: #f8f9fa; color: #1e293b; overflow-x: hidden; }

/* =========================================
   2. NAVBAR
   ========================================= */
.navbar {
    background-color: #0F4D3A; height: 70px; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 40px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    position: sticky; top: 0; z-index: 1000;
}
.logo { height: 48px; width: auto; object-fit: contain; filter: brightness(0) invert(1); display: block; cursor: pointer; }
.nav-links { list-style: none; display: flex; gap: 30px; }
.nav-links a { text-decoration: none; color: #cbd5e1; font-size: 0.9rem; font-weight: 500; transition: 0.3s; }
.nav-links a:hover, .nav-links a.active { color: #ffffff; }
.nav-right { display: flex; align-items: center; gap: 20px; }
.user-profile { display: flex; align-items: center; gap: 12px; text-align: right; border-right: 1px solid rgba(255,255,255,0.2); padding-right: 20px; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); object-fit: cover; }
.user-name { color: white; font-size: 0.85rem; font-weight: 600; display: block; }
.user-email { color: #94a3b8; font-size: 0.75rem; display: block; }
.btn-logout { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; transition: 0.2s; }
.btn-logout:hover { background: rgba(255,255,255,0.1); border-color: white; }

/* =========================================
   3. LAYOUT E FILTROS
   ========================================= */
.dashboard-container { max-width: 1280px; margin: 0 auto; padding: 40px; }

.page-header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.section-title { font-size: 1.5rem; color: #0F4D3A; font-weight: 600; }
.btn-primary {
    background-color: #0F4D3A; color: white; border: none; padding: 10px 24px;
    border-radius: 8px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px;
    box-shadow: 0 4px 6px rgba(15, 77, 58, 0.2); transition: 0.2s;
}
.btn-primary:hover { background-color: #0a3528; }

.filters-container {
    background: white; padding: 20px; border-radius: 10px; border: 1px solid #e2e8f0;
    display: flex; gap: 15px; margin-bottom: 25px;
}

.search-box, .filter-box { position: relative; display: flex; align-items: center; }
.search-box { flex: 1; } 
.filter-box { flex: 0 0 220px; }

.search-box i, .filter-box i { position: absolute; left: 12px; color: #64748b; font-size: 1.1rem; pointer-events: none; }
.search-box input, .filter-box select {
    width: 100%; padding: 10px 10px 10px 40px;
    border: 1px solid #cbd5e1; border-radius: 8px; outline: none; color: #1e293b; font-size: 0.95rem; background: white;
}
.search-box input:focus, .filter-box select:focus {
    border-color: #0F4D3A; box-shadow: 0 0 0 3px rgba(15, 77, 58, 0.1);
}

/* =========================================
   4. TABELA
   ========================================= */
.table-container {
    background: white; border-radius: 10px; border: 1px solid #e2e8f0; overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.stock-table { width: 100%; border-collapse: collapse; text-align: left; }
.stock-table thead { background-color: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.stock-table th { padding: 15px 20px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; color: #64748b; letter-spacing: 0.5px; }
.stock-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background 0.2s; }
.stock-table tbody tr:last-child { border-bottom: none; }
.stock-table tbody tr:hover { background-color: #f8fafc; }
.stock-table td { padding: 15px 20px; vertical-align: middle; font-size: 0.9rem; color: #334155; }

/* Componentes da Tabela */
.code-cell { font-family: monospace; color: #64748b; background: #f1f5f9; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; }
.item-img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid #e2e8f0; display: block; }
.item-name { font-weight: 500; color: #1e293b; }

/* Badges de Estoque */
.stock-badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.stock-badge.good { background: #dcfce7; color: #166534; }
.stock-badge.medium { background: #fef3c7; color: #92400e; }
.stock-badge.low { background: #fee2e2; color: #991b1b; }

.action-btn { background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 1.2rem; }
.action-btn:hover { color: #0F4D3A; }

/* =========================================
   5. PAGINAÇÃO
   ========================================= */
.pagination-container { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; }
.pagination-info { font-size: 0.9rem; color: #64748b; }
.pagination-controls { display: flex; align-items: center; gap: 5px; }
.page-btn {
    width: 32px; height: 32px; border: 1px solid #e2e8f0; background: white;
    border-radius: 6px; cursor: pointer; display: flex; justify-content: center; align-items: center;
    color: #64748b; transition: 0.2s;
}
.page-btn:hover:not(.active) { background: #f1f5f9; color: #0F4D3A; }
.page-btn.active { background: #0F4D3A; color: white; border-color: #0F4D3A; }

/* =========================================
   6. MODAL DE CADASTRO
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 77, 58, 0.2); backdrop-filter: blur(4px);
    z-index: 2000; display: flex; justify-content: center; align-items: center;
    opacity: 1; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }

.modal-box {
    background: white; width: 100%; max-width: 500px; border-radius: 12px; padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1); border: 1px solid #dcfce7;
    transform: scale(1); transition: transform 0.3s;
}
.hidden .modal-box { transform: scale(0.95); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.modal-header h3 { font-size: 1.25rem; color: #0F4D3A; font-weight: 600; }
.btn-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #94a3b8; }

/* Form Elements */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 0.85rem; color: #475569; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select {
    width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 0.95rem; color: #1e293b; outline: none; transition: 0.2s; background: white;
}
.form-group input:focus, .form-group select:focus {
    border-color: #0F4D3A; box-shadow: 0 0 0 3px rgba(15, 77, 58, 0.1);
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* Select Custom */
.select-wrapper { position: relative; }
.select-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: #64748b; font-size: 0.8rem; }
select { appearance: none; }

/* Image Upload */
.image-upload-wrapper {
    border: 2px dashed #cbd5e1; border-radius: 8px; padding: 15px;
    text-align: center; color: #64748b; cursor: pointer; position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    background: #fafafa; transition: 0.2s;
}
.image-upload-wrapper:hover { border-color: #0F4D3A; color: #0F4D3A; background: #f0fdf4; }
.image-upload-wrapper i { font-size: 1.5rem; }
.image-upload-wrapper p { font-size: 0.8rem; }
.image-upload-wrapper input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* Footer Modal */
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.btn-cancel { background: white; border: 1px solid #cbd5e1; color: #64748b; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.btn-confirm { background: #0F4D3A; border: none; color: white; padding: 8px 20px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.btn-confirm:hover { background: #0a3528; }

/* Responsivo */
@media (max-width: 900px) {
    .filters-container { flex-direction: column; }
    .filter-box { flex: auto; }
    .stock-table th:nth-child(4), .stock-table td:nth-child(4),
    .stock-table th:nth-child(6), .stock-table td:nth-child(6) { display: none; }
    .nav-links, .nav-right .user-info { display: none; }
    .form-row-2 { grid-template-columns: 1fr; }
}
/* Botão de Perfil (Destaque) */
.btn-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    
    /* Estilo Diferenciado (Cápsula Translúcida) */
    background-color: rgba(255, 255, 255, 0.15); 
    color: white;
    text-decoration: none;
    
    padding: 8px 16px;
    border-radius: 20px; /* Bordas bem redondas */
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent; /* Para evitar pulo no hover */
}

/* Efeito Hover: Fica branco com texto verde */
.btn-profile:hover {
    background-color: #ffffff;
    color: #0F4D3A; /* Verde da marca */
    transform: translateY(-1px); /* Leve subida */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Ajuste no botão de Sair para ficar harmônico ao lado */
.btn-logout {
    /* Se quiser, pode deixar o botão sair apenas como ícone para economizar espaço */
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}

.btn-logout:hover {
    border-color: #fca5a5; /* Vermelho claro ao passar o mouse */
    color: #fca5a5;
    background: rgba(255, 0, 0, 0.05);
}

/* Responsividade: No mobile, esconde o texto 'Minha Conta' e deixa só o ícone */
@media (max-width: 900px) {
    .btn-profile {
        font-size: 0; /* Esconde o texto */
        padding: 10px; /* Ajusta padding para ficar quadrado/redondo */
        border-radius: 50%;
        width: 38px;
        height: 38px;
        justify-content: center;
    }
    
    .btn-profile i {
        font-size: 1.2rem; /* Aumenta o ícone */
    }
}
/* Container das ações na tabela */
.actions-cell {
    display: flex;
    gap: 8px;
    justify-content: flex-end; /* Alinha os botões à direita da célula */
}

/* Base dos botões de ícone */
.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px; /* Cantos mais suaves */
    cursor: pointer;
    transition: all 0.2s ease; /* Transição suave para cores e escala */
    background-color: #f8fafc; /* Cor de fundo neutra inicial */
    color: #64748b; /* Cor do ícone neutra */
}

/* Estilo específico: Editar */
.btn-edit:hover {
    background-color: #e0f2fe; /* Azul bem claro */
    color: #0284c7; /* Azul destaque */
    transform: translateY(-2px); /* Pequeno pulo para cima */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Estilo específico: Excluir */
.btn-delete:hover {
    background-color: #fee2e2; /* Vermelho bem claro */
    color: #dc2626; /* Vermelho destaque */
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Feedback visual ao clicar (Active) */
.btn-icon:active {
    transform: scale(0.95);
}

/* Estilo para os ícones dentro dos botões */
.btn-icon i {
    font-size: 1.2rem;
}

/* Tooltip simples (usando o atributo title do HTML) */
.btn-icon[title] {
    position: relative;
}
.image-upload-wrapper {
    position: relative;
    cursor: pointer;
    border: 2px dashed #e2e8f0;
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.btn-remove-img {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ef4444;
    color: white;
    border: none;
    padding: 5px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
/* ============================================================
   NAVBAR & MENU RESPONSIVO (COMPLETO)
   ============================================================ */

/* --- Estilos Base (Desktop) --- */
.navbar {
    background-color: #0F4D3A; /* Verde Marca */
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Esconde o controle do menu e o ícone no Desktop */
#menu-check, .menu-hamburguer {
    display: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: white;
}

/* --- Responsividade (Mobile: abaixo de 900px) --- */
@media (max-width: 900px) {
    .navbar {
        padding: 0 20px;
        justify-content: space-between;
    }

    /* Exibe o ícone de hambúrguer */
    .menu-hamburguer {
        display: block;
        color: white;
        font-size: 2rem;
        cursor: pointer;
        order: -1; /* Posiciona à esquerda do logo */
    }

    /* Menu Lateral (Drawer) */
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%; /* Escondido à esquerda */
        width: 280px;
        height: calc(100vh - 70px);
        background-color: #0F4D3A;
        flex-direction: column;
        gap: 5px; /* Espaçamento entre os blocos de link */
        padding-top: 30px;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        box-shadow: 10px 0 25px rgba(0,0,0,0.3);
    }

    /* Itens do Menu Mobile */
    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: flex;
        align-items: center;
        padding: 22px 35px; /* Espaço generoso para o clique */
        font-size: 1.1rem;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.03);
        color: #cbd5e1;
    }

    /* Estado Ativo e Hover no Mobile */
    .nav-links a.active {
        background-color: rgba(255, 255, 255, 0.08);
        color: white;
        border-left: 6px solid #ffffff;
        padding-left: 29px; /* Ajuste para compensar a borda lateral */
    }

    .nav-links a:active {
        background-color: rgba(255, 255, 255, 0.15);
    }

    /* LOGICA DE ABERTURA: Quando o checkbox é marcado */
    #menu-check:checked ~ .nav-center .nav-links {
        left: 0; /* Desliza para dentro da tela */
    }

    /* Ajustes de interface mobile */
    .logo { height: 38px; }
    
    .nav-right {
        gap: 15px;
    }

    .btn-profile span, .user-info {
        display: none !important; /* Esconde textos para não quebrar a barra */
    }

    .btn-profile {
        padding: 10px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
    }
}