/* Importa a fonte divertida Shantell Sans diretamente no CSS */
@import url('https://googleapis.com');

/* ==========================================================================
   1. VARIÁVEIS E RESET (DESIGN SYSTEM - TULIM 3D / INSPIRADO NA PUKET)
   ========================================================================== */
:root {
    --primary: #2b211e;
    --secondary: #ffffff;
    --accent: #ff7300;
    --accent-hover: #e55e00;
    --pink-fun: #ec1e79;
    --cyan-fun: #00b2e3;
    --yellow-fun: #ffdd00;
    --green-fun: #8ce02c;
    --green-pastel: #d8efd8;
    --purple-fun: #B069DB;

    --btn-buy: #ff7300;
    --btn-buy-hover: #e55e00;
    --bg-body: #fffaf5;
    --bg-white: #ffffff;
    --text-dark: #2b211e;
    --text-muted: #7a6f6a;
    --border-color: #f0e6df;
    --success: #16a34a;
    --danger: #e11d48;

    --radius: 16px;
    --radius-pill: 9999px;
    --shadow: 0 6px 16px rgba(43, 33, 30, 0.06);
    --shadow-hover: 0 10px 24px rgba(255, 115, 0, 0.14);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Shantell Sans", cursive, sans-serif;
    background-color: var(--green-pastel);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: var(--pink-fun);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

a:hover {
    color: var(--accent);
}

.container {
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 24px;
}

main.container {
    flex: 1;
    padding-top: 28px;
    padding-bottom: 56px;
}

/* ==========================================================================
   2. CABEÇALHO E BARRA DE NAVEGAÇÃO (NAVBAR)
   ========================================================================== */
.navbar {
    background-color: var(--purple-fun);
    color: var(--bg-white);
    padding-top: 10px;
    padding-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 10px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none !important;
    flex-shrink: 0;
}

/* Barra de Busca (.search-bar-mini) em formato pílula */
.search-bar-mini {
    display: flex;
    align-items: center;
    background-color: var(--bg-white);
    border-radius: var(--radius-pill);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    gap: 8px;
}

.search-bar-mini input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-dark);
    outline: none;
}

.search-bar-mini button {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-pill);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, background-color 0.2s;
}

.search-bar-mini button:hover {
    background-color: var(--accent-hover);
    transform: scale(1.06);
}

/* Conta e Carrinho (.nav-actions) */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-links a {
    color: var(--bg-white);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
}

.nav-links a:hover {
    color: var(--yellow-fun);
}

.user-greeting strong {
    color: var(--yellow-fun);
}

.link-muted {
    color: #cbbeb9 !important;
}

.link-muted:hover {
    color: var(--pink-fun) !important;
}

.nav-admin-badge {
    background-color: var(--yellow-fun);
    border: 2px solid var(--yellow-fun);
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    color: var(--primary) !important;
    font-weight: 700 !important;
}

/* Botão do Carrinho (.cart-icon-btn) */
.cart-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--pink-fun);
    color: #ffffff !important;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, background-color 0.2s;
}

.cart-icon-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background-color: #d6166b;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--yellow-fun);
    color: var(--text-dark);
    font-size: 0.75rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary);
}

/* ==========================================================================
   3. SUB-NAVBAR (PÍLULAS COLORIDAS ESTILO PUKET)
   ========================================================================== */
.sub-navbar {
    background-color: var(--secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 10px 0;
}

.sub-nav-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    /* Evita cortes e adapta perfeitamente sem barra de rolagem cortando bordas */
    gap: 12px;
    padding: 6px 4px;
    /* Dá respiro em cima, embaixo e nas laterais para o outline e sombra */
}

/* Botão "Todas Categorias" (.drawer-trigger-btn) */
.drawer-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    background-color: var(--accent);
    color: #ffffff;
    border: 2px solid rgba(0, 0, 0, 0.08);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.drawer-trigger-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

/* Links de categorias como pílulas coloridas alternadas */
.sub-nav-content a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    background-color: var(--cyan-fun);
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.sub-nav-content a:nth-of-type(4n+2) {
    background-color: var(--yellow-fun);
    color: var(--text-dark);
}

.sub-nav-content a:nth-of-type(4n+3) {
    background-color: var(--green-fun);
    color: var(--text-dark);
}

.sub-nav-content a:nth-of-type(4n+4) {
    background-color: var(--pink-fun);
    color: #ffffff;
}

.sub-nav-content a:hover {
    transform: translateY(-2px) scale(1.03);
    filter: brightness(1.05);
}

.sub-nav-content a.active {
    box-shadow: 0 0 0 3px var(--primary);
    /* Substitui o outline por box-shadow, que nunca é cortado */
}

/* ==========================================================================
   4. MENU LATERAL RETRÁTIL (SIDE DRAWER)
   ========================================================================== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(43, 33, 30, 0.55);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.side-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 310px;
    max-width: 85vw;
    height: 100vh;
    background-color: var(--bg-white);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.side-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    background-color: var(--purple-fun);
    color: var(--bg-white);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1rem;
}

.drawer-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.drawer-close-btn:hover {
    background-color: var(--pink-fun);
}

.drawer-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-section h4 {
    color: var(--accent);
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 2px dashed var(--border-color);
}

.drawer-section a {
    color: var(--text-dark);
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.92rem;
    transition: background-color 0.15s, color 0.15s, transform 0.15s;
}

.drawer-section a:hover,
.drawer-section a.active {
    background-color: #fff3e8;
    color: var(--accent);
    transform: translateX(4px);
}

/* ==========================================================================
   5. VITRINE E CARDS DE PRODUTOS
   ========================================================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
}

.product-grid {
    display: grid;
    /* Cria quantas colunas couberem na tela (mínimo 250px por card) e cresce para baixo automaticamente */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    width: 100%;
    align-items: stretch;
    /* Garante que todos os cards da mesma linha tenham a mesma altura */
}

.product-card {
    background-color: var(--bg-white);
    border-radius: 22px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.product-image-box {
    width: 100%;
    height: 210px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    overflow: hidden;
    background-color: #fffcf9;
    border-radius: 14px;
    padding: 10px;
}

.product-image-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
}

.product-card:hover .product-image-box img {
    transform: scale(1.05);
}

.product-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: -webkit-box;
    --webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    --webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 4px;
}

.stock {
    font-size: 0.82rem;
    color: var(--success);
    font-weight: 700;
    margin-bottom: 14px;
}

.out-of-stock {
    color: var(--danger);
}

/* ==========================================================================
6. BOTÕES E ALERTAS
========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 12px 22px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, background-color 0.2s, box-shadow 0.15s ease;
    text-decoration: none !important;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background-color: var(--btn-buy);
    color: #ffffff;
    box-shadow: 0 4px 0 #c94e00;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--btn-buy-hover);
    color: #ffffff;
}

.btn-primary:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #c94e00;
}

.btn-primary:disabled {
    background-color: #e7e9ec;
    color: #8d9096;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #f3ece7;
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: #e6dcd5;
}

.btn-danger {
    background-color: var(--bg-white);
    border-color: var(--danger);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
}

.btn-danger:hover {
    background-color: #fff1f2;
}

.alert-error {
    background-color: #fff1f2;
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ==========================================================================
7. FORMULÁRIOS, CARRINHO, CHECKOUT E ADMIN
========================================================================== */
.form-card {
    background-color: var(--bg-white);
    max-width: 520px;
    margin: 20px auto;
    padding: 32px;
    border-radius: 24px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}

.form-card.wide {
    max-width: 760px;
}

.form-card h2 {
    margin-bottom: 20px;
    font-size: 1.45rem;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(255, 115, 0, 0.15);
}

.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.box-panel {
    background-color: var(--bg-white);
    padding: 24px;
    border-radius: 22px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}

.cart-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 2px dashed var(--border-color);
    align-items: center;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 12px;
    background-color: #fffcf9;
    padding: 6px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-details h4 {
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.address-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.address-option:hover {
    background-color: #fff8f2;
    border-color: var(--accent);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: var(--primary);
    color: var(--bg-white);
    font-size: 0.9rem;
}

.admin-table img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
}

/* ==========================================================================
8. PÁGINA DE DETALHES DO PRODUTO
========================================================================== */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr 320px;
    gap: 24px;
    align-items: start;
}

.product-detail-gallery {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    background-color: var(--bg-white);
    border-radius: 24px;
    border: 2px solid var(--border-color);
    padding: 20px;
}

.product-detail-gallery img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.detail-category-badge {
    display: inline-block;
    background-color: var(--pink-fun);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    margin-bottom: 12px;
}

.product-detail-info h1 {
    font-size: 1.65rem;
    line-height: 1.3;
    margin-bottom: 16px;
}

.detail-price-box {
    border-top: 2px dashed var(--border-color);
    border-bottom: 2px dashed var(--border-color);
    padding: 16px 0;
}

.shipping-calculator {
    background-color: #fff8f2;
    padding: 14px;
    border-radius: 16px;
    border: 2px solid var(--border-color);
}

/* ==========================================================================
   BANNER HERO (TAMANHO PROPORCIONAL E ESTILO PUKET)
   ========================================================================== */
.hero-banner {
    width: 100%;
    max-width: 100%;
    /* Limita a largura máxima para não ficar gigante em telas largas */
    margin: 0 auto 32px auto;
    /* Centraliza e dá espaço antes dos produtos */
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 3px solid var(--bg-white);
    background-color: var(--bg-white);
}

.hero-banner img {
    width: 100%;
    max-height: 260px;
    /* Controla a altura para os produtos já aparecerem na tela */
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ==========================================================================
9. RODAPÉ INSTITUCIONAL (.footer)
========================================================================== */
.footer {
    background-color: var(--cyan-fun);
    color: var(--bg-white);
    text-align: center;
    padding: 28px 0;
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

.footer-links a {
    color: var(--yellow-fun);
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: 0.5px;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-credit {
    color: #d6ccc8;
    font-size: 0.85rem;
}

/* ==========================================================================
10. RESPONSIVIDADE
========================================================================== */
@media (max-width: 992px) {
    .product-detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-content {
        flex-wrap: wrap;
    }

    .search-bar-mini {
        order: 3;
        max-width: 100% !important;
        width: 100%;
    }

    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-banner {
        border-radius: 18px;
        margin-bottom: 24px;
    }

    .hero-banner img {
        max-height: 220px;
    }
}