/* =========================================
   1. IMPORTAÇÃO DE FONTES E VARIÁVEIS
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Roboto:wght@300;400;500&display=swap');

:root {
    --primary: #e0c600;       /* Amarelo Ouro */
    --primary-hover: #e6c200; /* Hover */
    --dark: #121212;          /* Fundo Body */
    --gray-dark: #1E1E1E;     /* Cards/Sidebar */
    --gray-light: #2C2C2C;    /* Inputs */
    --text-main: #E0E0E0;     /* Texto Principal */
    --text-muted: #A0A0A0;    /* Texto Secundário */
    --border: #333333;        /* Bordas */
    --danger: #ff4d4d;        /* Erro/Excluir */
    --success: #00c853;       /* Sucesso */
}

/* =========================================
   2. RESET E ESTILOS GERAIS
   ========================================= */
* { box-sizing: border-box; }

body {
    background-color: var(--dark);
    color: var(--text-main);
    font-family: 'Roboto', sans-serif;
    margin: 0; padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Evita rolagem lateral indesejada */
}

h1, h2, h3, h4, th, .btn, .price, .logo {
    font-family: 'Rajdhani', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

h1, h2, h3 { color: #fff; margin: 0 0 15px 0; }
a { text-decoration: none; color: var(--primary); transition: 0.3s; }
a:hover { color: #fff; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* =========================================
   3. CABEÇALHO (HEADER)
   ========================================= */
header {
    background-color: #000;
    padding: 15px 30px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    flex-wrap: wrap; /* Permite quebrar linha no mobile */
}

.logo-container { display: flex; align-items: center; }
.site-logo { height: 45px; width: auto; display: block; transition: transform 0.3s ease; }
.logo-container a:hover .site-logo { transform: scale(1.05); }

/* Navegação */
nav { display: flex; align-items: center; gap: 20px; }
nav a { font-weight: 500; color: var(--text-main); font-size: 0.95rem; }
nav a:hover { color: var(--primary); }

/* =========================================
   4. COMPONENTES (BOTÕES E INPUTS)
   ========================================= */
.btn {
    background-color: var(--primary);
    color: #000;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex; /* Melhor alinhamento com ícones */
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(224, 198, 0, 0.2);
    color: #000;
}

/* Inputs */
input, textarea, select {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--gray-light);
    border: 1px solid var(--border);
    color: #fff;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    margin-bottom: 10px;
    transition: 0.3s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #333;
}

label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.9rem; }

/* =========================================
   5. LAYOUT E SIDEBAR (NOVO)
   ========================================= */
.main-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    margin-top: 30px;
}

.sidebar {
    background: var(--gray-dark);
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
}

.sidebar h3 { font-size: 1.1rem; border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 15px; color: var(--primary); }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin-bottom: 8px; }
.sidebar a { color: #ccc; display: block; padding: 8px; border-radius: 4px; }
.sidebar a:hover, .sidebar a.active { background: #333; color: var(--primary); padding-left: 12px; }

/* Sub-menu da Sidebar */
.sub-cat-list {
    display: none;
    margin-top: 5px; margin-left: 10px;
    border-left: 2px solid #333; padding-left: 5px;
    animation: fadeIn 0.3s;
}
.sidebar li:hover .sub-cat-list { display: block; }
.sub-cat-list li a { font-size: 0.9rem; color: #888; padding: 5px; }
.sub-cat-list li a:hover { color: #fff; background: transparent; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* Botão de Filtro Mobile (Escondido no Desktop) */
.mobile-filter-btn { display: none; width: 100%; margin-bottom: 15px; text-align: center; background: #333; color: #fff; padding: 12px; border-radius: 5px; cursor: pointer; border: 1px solid #444; font-weight: bold; }

/* =========================================
   6. GRID DE PRODUTOS E CARDS
   ========================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 Colunas no Desktop */
    gap: 20px;
}

.card {
    background-color: var(--gray-dark);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #333;
    transition: transform 0.3s, border-color 0.3s;
    display: flex; flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.card-body { padding: 15px; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-size: 1.1rem; margin-bottom: 5px; }
.card h3 a { color: #fff; }
.price { font-size: 1.2rem; color: var(--primary); font-weight: bold; }

/* =========================================
   7. SLIDER
   ========================================= */
.slider-container {
    width: 100%; height: 400px; overflow: hidden; position: relative;
    margin-bottom: 30px; border-radius: 8px; border: 1px solid #333; background: #000;
}
.slider-track { display: flex; height: 100%; transition: transform 0.8s ease-in-out; }
.slide { min-width: 100%; height: 100%; position: relative; }
.slide img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.8); }
.slide-caption {
    position: absolute; bottom: 0; left: 0; width: 100%; padding: 30px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}
.slider-dots {
    position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 10px;
}
.dot { width: 10px; height: 10px; background: rgba(255,255,255,0.5); border-radius: 50%; cursor: pointer; }
.dot.active { background: var(--primary); }

/* =========================================
   8. TABELAS E ADMIN (RESPONSIVO)
   ========================================= */
/* Wrapper para permitir rolagem horizontal no mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--gray-dark);
    min-width: 600px; /* Garante largura mínima para não quebrar layout */
}

th, td { padding: 15px; text-align: left; border-bottom: 1px solid #333; }
th { background-color: #000; color: var(--primary); white-space: nowrap; }
tr:hover { background-color: #252525; }

.table-thumb { width: 50px; height: 40px; object-fit: cover; border-radius: 4px; }

/* =========================================
   9. LOGIN E OUTROS
   ========================================= */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.auth-box {
    background-color: var(--gray-dark); padding: 40px;
    border-radius: 8px; width: 100%; max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid #333;
}

/* =========================================
   10. MOBILE / RESPONSIVIDADE
   ========================================= */
@media (max-width: 768px) {
    
    /* Header e Navegação */
    header { flex-direction: column; gap: 15px; padding: 15px; text-align: center; }
    
    nav { 
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 10px; 
    }
    
    /* Transforma links em "botões" no mobile para facilitar o toque */
    nav a { 
        padding: 8px 12px; 
        background: #222; 
        border-radius: 4px; 
        font-size: 0.85rem;
    }

    /* Layout Principal */
    .main-layout { grid-template-columns: 1fr; gap: 15px; margin-top: 15px; }

    /* Slider */
    .slider-container { height: 220px; margin-bottom: 15px; }
    .slide-caption h2 { font-size: 1.2rem; }
    .slide-caption { padding: 15px; }

    /* Sidebar (Menu Sanfona) */
    .sidebar { display: none; width: 100%; margin-bottom: 15px; }
    .sidebar.active { display: block; animation: fadeIn 0.3s; }
    .mobile-filter-btn { display: block; } /* Mostra botão filtro */

    /* Grid de Produtos (2 Colunas) */
    .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    
    /* Ajustes Cards */
    .card-body { padding: 10px; }
    .card h3 { font-size: 0.95rem; line-height: 1.3; }
    .price { font-size: 1rem; }
    .btn { padding: 8px 12px; font-size: 0.8rem; }

    /* Container Geral */
    .container { padding: 10px; }
    
    /* Detalhes do Produto */
    .product-detail-container { flex-direction: column; }
    .gallery-thumbs img { width: 60px; height: 50px; }
}