/* ================================================================
   SHOP.CSS — e-commerce (frete, carrinho, checkout, badge)
   Usa os tokens definidos em style.css
================================================================ */

/* garante que [hidden] vença classes com display:flex (botões, badges) */
[hidden] { display: none !important; }

/* ---- Ícone do carrinho no header ---- */
.main-header {
    position: sticky;
}

.header-cart {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 1.1rem;
    text-decoration: none;
    padding: 0.4rem;
}

.cart-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 999px;
    padding: 0 3px;
}

/* ---- Miniaturas de fotos do produto ---- */
.product-thumbs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0.6rem 1.25rem 0;
}

.product-thumbs button {
    width: 56px;
    height: 56px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: #fff;
    padding: 2px;
    cursor: pointer;
}

.product-thumbs button.active {
    border-color: var(--primary-color);
}

.product-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---- Seletor de áreas de personalização (Frente / Verso / partes do kit) ---- */
.product-thumbs.area-tabs button {
    width: auto;
    min-width: 72px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
}

.product-thumbs.area-tabs img {
    width: 52px;
    height: 52px;
}

.product-thumbs.area-tabs span {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-thumbs.area-tabs button.active span {
    color: var(--primary-color);
}

/* ---- Frete ---- */
.frete-section {
    margin: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem;
}

.frete-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.frete-form input {
    flex: 1;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
}

.frete-form .btn-primary {
    width: auto;
    padding: 0.7rem 1.1rem;
}

.frete-results {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.frete-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.65rem 0.8rem;
    font-size: 0.9rem;
}

.frete-option.selectable {
    cursor: pointer;
}

.frete-option.selected {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.18);
}

.frete-name {
    font-weight: 700;
}

.frete-prazo {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex: 1;
}

.frete-price {
    font-weight: 700;
    color: var(--accent-green);
}

.frete-aviso {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.frete-error {
    color: var(--accent-red);
    font-size: 0.85rem;
}

.frete-loading {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.frete-cep-link {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---- Quantidade ---- */
.qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background: #fff;
}

.qty-control button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--background-color);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
}

.qty-control input {
    width: 52px;
    height: 40px;
    border: none;
    text-align: center;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    -moz-appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* ---- Botões do carrinho ---- */
.btn-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.95rem;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 0.6rem;
}

.btn-cart:active {
    transform: scale(0.98);
}

.btn-go-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.95rem;
    background: var(--accent-green);
    color: #fff;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 0.6rem;
}

/* ================================================================
   CARRINHO / CHECKOUT
================================================================ */
.cart-page {
    padding: 1rem 1.25rem 3rem;
}

.cart-page h1 {
    font-size: 1.3rem;
    margin: 0.5rem 0 1rem;
}

.cart-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
}

.cart-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.cart-item {
    display: flex;
    gap: 0.8rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.8rem;
    margin-bottom: 0.8rem;
}

.cart-item-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    background: #fff;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.cart-item-custom {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    overflow-wrap: break-word;
}

.cart-item-custom img {
    max-width: 56px;
    max-height: 56px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: block;
    margin-top: 0.25rem;
}

.cart-item-price {
    font-weight: 700;
    color: var(--accent-green);
    font-size: 0.95rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.cart-item-actions .qty-control button,
.cart-item-actions .qty-control input {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
}

.cart-item-actions .qty-control input {
    width: 40px;
}

.btn-remove-item {
    background: none;
    border: none;
    color: var(--accent-red);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.3rem;
}

/* ---- Resumo ---- */
.cart-summary {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-top: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.3rem 0;
}

.summary-row.total {
    font-size: 1.05rem;
    font-weight: 700;
    border-top: 1px solid var(--border-color);
    margin-top: 0.4rem;
    padding-top: 0.6rem;
}

/* ---- Checkout ---- */
.checkout-section {
    margin-top: 1.25rem;
}

.checkout-section h2 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.form-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: #fff;
}

.checkout-error {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin: 0.75rem 0;
    min-height: 1em;
}

/* ---- Conta do cliente ---- */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.auth-tab {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: #fff;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}

.auth-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.my-order {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.8rem 1rem;
    margin-bottom: 0.7rem;
}

.my-order-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.my-order-total {
    margin-left: auto;
    font-weight: 700;
    color: var(--accent-green);
}

.my-order-items {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.my-order-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.status-tag {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #eee;
}

.status-novo { background: #FFF3CD; color: #7a5c00; }
.status-aguardando_pagamento { background: #FDE2C8; color: #8a4b00; }
.status-pago { background: #D3E5FF; color: #0b4c9c; }
.status-em_producao { background: #E6D9FF; color: #5b2ea6; }
.status-enviado { background: #D1F2D6; color: #1d6b2a; }
.status-entregue { background: #C8F7DC; color: #0d5c33; }
.status-cancelado { background: #F8D7DA; color: #8b1e28; }

.save-ok-msg {
    color: var(--accent-green);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ---- Overlay de detalhes do pedido ---- */
.my-order.clickable {
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.my-order.clickable:hover,
.my-order.clickable:focus-visible {
    box-shadow: var(--shadow-md);
}

.my-order-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.order-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

@media (min-width: 520px) {
    .order-overlay { align-items: center; }
}

.order-overlay-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 440px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: overlay-in 0.22s ease;
}

@keyframes overlay-in {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.order-overlay-head {
    position: sticky;
    top: 0;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.order-overlay-head h2 { font-size: 1.05rem; }

.order-overlay-close {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-main);
}

.order-overlay-body { padding: 1rem 1.25rem 1.5rem; }

.ov-section { margin-bottom: 1rem; }

.ov-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.ov-item {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.85rem;
}

.ov-item:last-child { border-bottom: none; }

.ov-item img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    flex-shrink: 0;
}

.ov-item-custom { font-size: 0.74rem; color: var(--text-muted); }

.ov-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 0.2rem 0;
}

.ov-row.total {
    font-weight: 700;
    font-size: 0.95rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.3rem;
    padding-top: 0.5rem;
}

.ov-tracking {
    background: var(--background-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.7rem 0.9rem;
    text-align: center;
}

.ov-tracking .code {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
}

.btn-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.7rem;
    background: var(--primary-color);
    color: #fff;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
}

.ov-timeline { list-style: none; }

.ov-timeline li {
    position: relative;
    padding: 0 0 0.7rem 1.2rem;
    font-size: 0.8rem;
    border-left: 2px solid var(--border-color);
    margin-left: 0.35rem;
}

.ov-timeline li::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
}

.ov-timeline li:first-child { border-left-color: var(--accent-green); }
.ov-timeline li:first-child::before { background: var(--accent-green); }

.ov-timeline .when {
    color: var(--text-muted);
    font-size: 0.72rem;
    display: block;
}

/* foco visível em toda a loja (acessibilidade) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* ---- Pagamento (checkout transparente) ---- */
.payment-section {
    margin-top: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem;
}

.payment-section h2 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

.card-element-box {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.8rem;
    background: #fff;
    margin-bottom: 0.75rem;
}

.secure-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* ---- Cupom ---- */
.coupon-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.coupon-row input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    text-transform: uppercase;
}

.coupon-row button {
    padding: 0.6rem 1rem;
}

.coupon-ok {
    color: var(--accent-green);
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

/* ---- Confirmação ---- */
.order-success {
    text-align: center;
    padding: 2.5rem 1.25rem;
}

.order-success i {
    font-size: 3rem;
    color: var(--accent-green);
    margin-bottom: 1rem;
}

.order-success .order-code {
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--background-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 1rem;
    display: inline-block;
    margin: 0.75rem 0;
}

.order-success p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.order-success .btn-whatsapp-order {
    margin-top: 1rem;
}
