:root {
    --navy: #1B3B63;
    --navy-dark: #122A48;
    --gold: #F5B324;
    --gold-dark: #D99A0C;
    --red: #D6362E;
    --cream: #FDFBF4;
    --ink: #22262B;
    --paper: #FFFFFF;
    --border: #EAE4D6;
    --font-display: 'Baloo 2', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    margin: 0;
    color: var(--ink);
    background: var(--cream);
    line-height: 1.5;
}

a {
    color: inherit;
}

/* Header */
.site-header {
    background: var(--navy);
    border-bottom: 4px solid var(--gold);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand img {
    height: 56px;
    display: block;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.site-header nav a {
    text-decoration: none;
    color: #EFF3F8;
    transition: color 0.15s ease;
}

.site-header nav a:hover {
    color: var(--gold);
}

.nav-greeting {
    color: #B9C6D6;
    font-weight: 500;
}

.nav-logout-form {
    display: inline-flex;
    margin: 0;
}

.nav-logout {
    background: none;
    border: none;
    padding: 0;
    color: #EFF3F8;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s ease;
}

.nav-logout:hover {
    color: var(--gold);
    opacity: 1;
}

.nav-cart {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.cart-count {
    background: var(--red);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}

.nav-signup {
    background: var(--gold);
    color: var(--navy-dark);
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
}

.nav-signup:hover {
    color: var(--navy-dark);
    opacity: 0.9;
}

/* Main */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* Hero */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: white;
    border-radius: 16px;
    padding: 2.5rem 2.5rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.hero-text h2 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    margin: 0 0 0.5rem;
    color: var(--gold);
}

.hero-text p {
    max-width: 34rem;
    color: #DCE4EE;
    margin: 0;
    font-size: 1.05rem;
}

.hero-dice {
    font-size: 3.5rem;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.die-red { color: var(--red); }
.die-gold { color: var(--gold); }

/* Categories */
.categories {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.categories a {
    text-decoration: none;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    border: 2px solid var(--border);
    background: var(--paper);
    color: var(--navy);
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.categories a:hover {
    border-color: var(--gold);
}

.categories a.active {
    background: var(--navy);
    color: white;
    border-color: var(--navy);
}

/* Busca e filtro de produtos */
.search-form {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.search-form input[type="text"] {
    flex: 1;
    min-width: 200px;
}

/* Só o max-width (sem width:auto — ver comentário mais abaixo, no bloco de
   forms, sobre por que width:auto quebra isso). */
.search-form select {
    max-width: 220px;
}

.search-form button {
    flex-shrink: 0;
}

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-top: 4px solid var(--gold);
}

.product-card--board_game {
    border-top-color: var(--red);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(27, 59, 99, 0.12);
}

.product-card-image {
    height: 160px;
    background: #F5F2E9;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.product-card-body {
    padding: 1rem 1.1rem 1.25rem;
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: #FCEFC7;
    color: var(--gold-dark);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.badge--board_game {
    background: #FBE1DF;
    color: var(--red);
}

.product-card h3 {
    margin: 0 0 0.3rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
}

.product-card h3 a {
    text-decoration: none;
}

.product-card .price,
.product-detail .price {
    font-weight: 700;
    color: var(--navy);
    margin: 0;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: #8A8578;
    padding: 3rem 0;
}

/* Paginação */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2rem;
}

.pagination a {
    text-decoration: none;
    color: var(--navy);
    font-weight: 600;
    font-size: 0.9rem;
}

.pagination a:hover {
    color: var(--gold-dark);
}

.pagination-current {
    color: #8A8578;
    font-size: 0.9rem;
}

/* Painel do staff */
.dashboard-cards {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: var(--paper);
    border: 1px solid var(--border);
    border-top: 4px solid var(--gold);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 220px;
}

.dashboard-card-label {
    font-size: 0.85rem;
    color: #8A8578;
    font-weight: 600;
}

.dashboard-card-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--navy);
}

/* Product detail */
.product-detail {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
}

.product-detail img {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.product-detail .product-thumb {
    max-width: 220px;
    max-height: 220px;
    object-fit: cover;
}

.product-image-trigger {
    background: none;
    border: none;
    padding: 0;
    display: block;
    cursor: zoom-in;
}

.product-gallery {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.gallery-thumb-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: zoom-in;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}

.gallery-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    margin: 0;
    border: 1px solid var(--border);
}

/* Galeria no formulário de cadastro/edição de produto (staff) */
.gallery-thumbs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.gallery-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #8A8578;
}

.gallery-thumb img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 0;
}

.lightbox-overlay[hidden] {
    display: none;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 42, 72, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 100;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    margin: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--paper);
    border: none;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--navy);
    z-index: 101;
}

.lightbox-close:hover {
    color: var(--red);
}

.product-detail h2 {
    font-family: var(--font-display);
    color: var(--navy);
    margin-top: 0;
}

.specs {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0;
    background: var(--cream);
    border-radius: 10px;
    padding: 0.5rem 1.25rem;
}

.specs li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.specs li:last-child {
    border-bottom: none;
}

.product-detail .price {
    font-size: 1.5rem;
    margin: 1rem 0;
}

.product-detail form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.product-detail input[type="number"] {
    width: 4.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* Buttons */
button,
.btn-checkout,
.btn-whatsapp {
    background: var(--red);
    color: white;
    border: none;
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.15s ease;
}

button:hover,
.btn-checkout:hover,
.btn-whatsapp:hover {
    opacity: 0.9;
}

.btn-whatsapp {
    background: #25D366;
}

.checkout-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-secondary {
    background: var(--paper);
    color: var(--navy);
    border: 1px solid var(--border);
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s ease;
}

.btn-secondary:hover {
    background: var(--cream);
}

/* Cart table */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

th, td {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    background: var(--navy);
    color: white;
    font-size: 0.85rem;
}

.total {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
    text-align: right;
}

.btn-in-cart,
.btn-in-cart:hover {
    background: #E8E4D8;
    color: #8A8578;
    cursor: default;
    opacity: 1;
}

.product-card-body .btn-in-cart {
    width: 100%;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--red);
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    opacity: 0.8;
}

.quick-add-form button {
    width: 100%;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.out-of-stock {
    color: #8A8578;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Linhas de produto+quantidade em "Lançar pedido"/"Editar pedido" (staff) */
.order-item-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.order-item-row select {
    flex: 1;
}

.order-item-row input[type="number"] {
    max-width: 6rem;
}

.order-item-row .remove-item-row {
    flex-shrink: 0;
    white-space: nowrap;
}

.form-hint {
    font-size: 0.85rem;
    color: #8A8578;
    margin: -0.5rem 0 1.5rem;
}

option[hidden] {
    display: none;
}

.status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    vertical-align: middle;
}

.status-pending { background: #FCEFC7; color: var(--gold-dark); }
.status-paid { background: #DFF0D8; color: #3C763D; }
.status-shipped { background: #D9EDF7; color: #31708F; }
.status-delivered { background: #DFF0D8; color: #3C763D; }
.status-cancelled { background: #FBE1DF; color: var(--red); }

.order-status-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    max-width: 320px;
}

.actions-cell {
    display: flex;
    gap: 0.9rem;
    align-items: center;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: #EFF3F8;
    font-weight: 600;
    transition: color 0.15s ease;
}

.nav-dropdown summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown summary::after {
    content: '▾';
    font-size: 0.65rem;
}

.nav-dropdown summary:hover,
.nav-dropdown[open] summary {
    color: var(--gold);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.85rem);
    right: 0;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(27, 59, 99, 0.18);
    min-width: 190px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.site-header .nav-dropdown-menu a {
    color: var(--navy);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.site-header .nav-dropdown-menu a:hover {
    background: var(--cream);
    color: var(--navy);
}

/* Forms (login, signup, checkout) */
form p {
    margin-bottom: 1rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
}

/* Campos com tamanho fixo de conteúdo não precisam ocupar a largura toda.
   IMPORTANTE: não usar "width: auto" aqui — isso faz o campo voltar pro
   tamanho padrão do navegador (~227px) e ignora o max-width quando ele é
   maior que isso. Só o max-width já reduz a partir do width:100% herdado. */
#id_cpf {
    max-width: 12rem;
}

#id_postal_code {
    max-width: 8rem;
}

#id_whatsapp {
    max-width: 12rem;
}

#id_number {
    max-width: 6rem;
}

#id_state {
    /* Mostra o nome completo do estado (ex: "Rio Grande do Norte"), não só a sigla */
    max-width: 15rem;
}

#id_complement,
#id_neighborhood,
#id_city {
    max-width: 18rem;
}

#id_first_name,
#id_last_name {
    max-width: 14rem;
}

#id_street {
    /* Bem maior que os outros campos de endereço */
    max-width: 32rem;
}

.input-prefix-group[hidden] {
    display: none;
}

.input-prefix-group {
    display: flex;
    align-items: stretch;
    max-width: 20rem;
}

.instagram-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.instagram-display a {
    color: var(--navy);
    font-weight: 600;
    text-decoration: underline;
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: var(--cream);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #8A8578;
    font-size: 0.9rem;
    white-space: nowrap;
}

.input-prefix-group input {
    border-radius: 0 8px 8px 0;
}

label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--navy);
}

.errorlist {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: #FBE1DF;
    border: 1px solid var(--red);
    border-radius: 8px;
    color: var(--red);
    font-size: 0.9rem;
    font-weight: 600;
}

.errorlist li + li {
    margin-top: 0.3rem;
}

.helptext {
    display: block;
    color: #8A8578;
    font-size: 0.8rem;
    font-weight: 400;
    margin-top: 0.2rem;
}

/* Flash messages */
.messages {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
}

.messages li {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.messages .success {
    background: #DFF0D8;
    border: 1px solid #3C763D;
    color: #3C763D;
}

.messages .error {
    background: #FBE1DF;
    border: 1px solid var(--red);
    color: var(--red);
}

h2 {
    font-family: var(--font-display);
    color: var(--navy);
}

/* Footer */
.profile-alert {
    background: var(--gold);
    color: var(--navy-dark);
    text-align: center;
    padding: 0.65rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.profile-alert a {
    color: var(--navy-dark);
    text-decoration: underline;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: #8A8578;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
