/* Loja — catálogo completo (loja/index.html + loja/peca.html) */

/* Light hero: the md-exhibition-page base styles assume headings sit over dark
   imagery; here they sit on the ivory background. */
.md-loja-page .md-section-heading h1,
.md-loja-page .md-section-heading h2,
.md-peca-page .md-section-heading h2,
.md-carrinho-page .md-section-heading h1,
.md-checkout-page .md-section-heading h1,
.md-pedido-page .md-section-heading h1 {
    color: var(--md-green-deep);
}

.md-loja-page .md-section-heading p,
.md-peca-page .md-section-heading p,
.md-carrinho-page .md-section-heading p,
.md-checkout-page .md-section-heading p {
    color: var(--md-ink-soft);
}

/* Solid primary styling for commerce CTAs — base .md-btn carries no background
   by design (style.css expects a variant class on every solid button). */
#checkoutSubmit,
#carrinhoCheckout,
#pecaBuy,
#mdBuyNow,
.md-add-to-cart {
    background: var(--md-green);
    border: 1px solid var(--md-green);
    color: var(--md-ivory);
}

#checkoutSubmit:hover, #checkoutSubmit:focus,
#carrinhoCheckout:hover, #carrinhoCheckout:focus,
#pecaBuy:hover, #pecaBuy:focus,
#mdBuyNow:hover, #mdBuyNow:focus,
.md-add-to-cart:hover, .md-add-to-cart:focus {
    background: var(--md-green-soft);
    border-color: var(--md-green-soft);
    color: var(--md-ivory);
}

/* Primary CTAs span their column — stronger hierarchy, no hugging text. */
#checkoutSubmit,
#carrinhoCheckout {
    width: 100%;
    margin-top: 4px;
}

.md-checkout-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 0;
    font-size: 0.78rem;
    color: var(--md-ink-muted);
    text-align: center;
}

.md-checkout-trust i {
    color: var(--md-jade);
}

.md-carrinho-continue {
    width: 100%;
    margin-top: 12px;
}

.md-checkout-summary .md-peca-note {
    margin-top: 16px;
}

.md-checkout-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--md-green-soft);
}

.md-checkout-back:hover {
    color: var(--md-green-deep);
    text-decoration: underline;
}

.md-loja-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 26px;
    padding: 14px 16px;
    background: var(--md-paper);
    border: 1px solid var(--md-line);
    border-radius: var(--md-radius);
    box-shadow: var(--md-shadow-sm);
}

.md-loja-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.md-loja-chip {
    border: 1px solid var(--md-line);
    background: var(--md-mist);
    color: var(--md-ink-soft);
    border-radius: 999px;
    padding: 7px 15px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.md-loja-chip:hover {
    border-color: var(--md-gold-deep);
    color: var(--md-ink);
}

.md-loja-chip.is-active {
    background: var(--md-green);
    border-color: var(--md-green);
    color: var(--md-ivory);
}

.md-loja-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.md-loja-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--md-line);
    border-radius: 999px;
    background: var(--md-ivory);
    color: var(--md-ink-muted);
    margin: 0;
}

.md-loja-search input {
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 0.88rem;
    color: var(--md-ink);
    min-width: 170px;
}

.md-loja-tools select {
    border: 1px solid var(--md-line);
    border-radius: 999px;
    background: var(--md-ivory);
    color: var(--md-ink);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 14px;
    cursor: pointer;
}

.md-loja-count {
    margin: 14px 2px 0;
    font-size: 0.85rem;
    color: var(--md-ink-muted);
}

.md-loja-state {
    padding: 34px 26px;
    text-align: center;
    background: var(--md-mist);
    border: 1px dashed var(--md-line-gold);
    border-radius: var(--md-radius);
    color: var(--md-ink-soft);
    margin-bottom: 26px;
}

.md-loja-state a {
    color: var(--md-green-soft);
    font-weight: 700;
    text-decoration: underline;
}

.md-loja-more {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

/* Página de peça genérica */

.md-peca-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 42px;
    align-items: start;
    margin-top: 26px;
}

.md-peca-media {
    position: relative;
    border-radius: var(--md-radius);
    overflow: hidden;
    box-shadow: var(--md-shadow-md);
    background: var(--md-mist);
}

.md-peca-media img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.md-peca-media .md-stock-badge {
    position: absolute;
    top: 14px;
    left: 14px;
}

/* 3D viewer toggle — mirrors .md-product-main-media (produto/ pages) in
   style.css, scoped to the generic catalog template's own class names. */
.md-peca-media.is-3d .md-product-modelviewer {
    display: block;
}

.md-peca-media.is-3d #pecaImage {
    visibility: hidden;
}

.md-peca-media.is-3d .md-3d-note {
    display: inline-flex;
}

.md-peca-panel h1 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--md-green-deep);
    font-size: clamp(1.9rem, 3.4vw, 2.6rem);
    margin: 8px 0 4px;
}

.md-peca-price {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--md-green-soft);
    margin: 10px 0 2px;
}

.md-peca-availability {
    font-size: 0.88rem;
    color: var(--md-ink-muted);
    margin-bottom: 16px;
}

.md-peca-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 22px 0 14px;
}

.md-peca-note {
    font-size: 0.82rem;
    color: var(--md-ink-muted);
    border-left: 3px solid var(--md-line-gold);
    padding-left: 12px;
}

.md-peca-related-section {
    margin-top: 56px;
}

/* Checkout */

.md-checkout-page .md-section-heading h1,
.md-pedido-page h1 {
    color: var(--md-green-deep);
    font-family: 'Cormorant Garamond', serif;
}

.md-checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
    gap: 38px;
    align-items: start;
    margin-top: 26px;
}

.md-checkout-form fieldset {
    border: 1px solid var(--md-line);
    border-radius: var(--md-radius);
    background: var(--md-paper);
    padding: 18px 20px 20px;
    margin: 0 0 20px;
    box-shadow: var(--md-shadow-sm);
}

.md-checkout-form legend {
    font-weight: 800;
    color: var(--md-green-deep);
    padding: 0 6px;
    font-size: 0.95rem;
}

.md-checkout-form label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--md-ink-soft);
    margin-bottom: 12px;
}

.md-checkout-form input {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 10px 12px;
    border: 1px solid var(--md-line);
    border-radius: var(--md-radius);
    background: var(--md-ivory);
    color: var(--md-ink);
    font-size: 0.92rem;
}

.md-checkout-form input:focus {
    outline: 2px solid var(--md-gold);
    outline-offset: 1px;
}

.md-checkout-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.md-checkout-choices {
    display: grid;
    gap: 10px;
}

.md-checkout-choice {
    display: flex !important;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--md-line);
    border-radius: var(--md-radius);
    padding: 12px 14px;
    cursor: pointer;
    background: var(--md-ivory);
    transition: border-color 0.15s ease;
}

.md-checkout-choice:hover {
    border-color: var(--md-gold-deep);
}

.md-checkout-choice input {
    width: auto !important;
    margin: 0 !important;
    accent-color: var(--md-green);
}

.md-checkout-choice span strong {
    display: block;
    color: var(--md-ink);
    font-size: 0.9rem;
}

.md-checkout-choice span small {
    color: var(--md-ink-muted);
    font-size: 0.78rem;
}

.md-checkout-summary {
    position: sticky;
    top: 110px;
    border: 1px solid var(--md-line-gold);
    border-radius: var(--md-radius);
    background: var(--md-paper);
    padding: 20px 22px;
    box-shadow: var(--md-shadow-md);
}

.md-checkout-summary h2 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--md-green-deep);
    margin-bottom: 14px;
}

.md-checkout-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--md-line);
    margin-bottom: 12px;
}

.md-checkout-product img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--md-radius);
}

.md-checkout-product strong {
    display: block;
    color: var(--md-ink);
    font-size: 0.92rem;
}

.md-checkout-product span {
    color: var(--md-ink-muted);
    font-size: 0.85rem;
}

.md-checkout-summary dl {
    margin: 0;
}

.md-checkout-summary dl div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--md-ink-soft);
    margin-bottom: 8px;
}

.md-checkout-summary dd {
    margin: 0;
    font-weight: 700;
    color: var(--md-ink);
}

.md-checkout-total {
    border-top: 1px solid var(--md-line);
    padding-top: 10px;
    font-size: 1rem !important;
}

.md-checkout-total dd {
    color: var(--md-green-soft) !important;
    font-size: 1.2rem;
    font-weight: 800;
}

/* Pedido (confirmação) */

.md-pedido-card {
    max-width: 560px;
    margin: 30px auto 10px;
    text-align: center;
    background: var(--md-paper);
    border: 1px solid var(--md-line-gold);
    border-radius: var(--md-radius);
    box-shadow: var(--md-shadow-md);
    padding: 40px 34px;
}

.md-pedido-card .md-peca-actions {
    justify-content: center;
}

.md-pedido-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.md-pedido-icon.is-success { background: var(--md-jade); }
.md-pedido-icon.is-pending { background: var(--md-gold-deep); }
.md-pedido-icon.is-failure { background: var(--md-coral); }

.md-pedido-ref {
    font-weight: 800;
    color: var(--md-green-deep);
    letter-spacing: 0.04em;
}

@media (max-width: 860px) {
    .md-peca-layout,
    .md-checkout-layout {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    .md-checkout-summary {
        position: static;
        order: -1;
    }

    .md-loja-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .md-loja-search input {
        min-width: 0;
        width: 100%;
    }
}

/* ------------------------------------------------------------------ */
/* Carrinho de compras (cart.js + loja/carrinho.html)                  */
/* ------------------------------------------------------------------ */

.md-cart-nav {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-cart-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--md-saffron);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 17px;
    text-align: center;
}

.md-cart-badge.is-empty {
    display: none;
}

.md-carrinho-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
    gap: 34px;
    align-items: start;
    margin-top: 26px;
}

.md-carrinho-items {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.md-carrinho-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: var(--md-paper);
    border: 1px solid var(--md-line);
    border-radius: var(--md-radius);
    box-shadow: var(--md-shadow-sm);
}

.md-carrinho-item img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: var(--md-radius);
    flex-shrink: 0;
}

.md-carrinho-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.md-carrinho-unit {
    font-size: 0.82rem;
    color: var(--md-ink-muted);
}

.md-carrinho-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.md-carrinho-stepper {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--md-line);
    border-radius: 999px;
    overflow: hidden;
}

.md-qty-btn {
    width: 30px;
    height: 30px;
    border: 0;
    background: var(--md-mist);
    color: var(--md-ink);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.md-qty-btn:hover:not(:disabled) {
    background: var(--md-gold);
}

.md-qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.md-carrinho-remove {
    border: 0;
    background: none;
    color: var(--md-coral);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
}

.md-carrinho-line-total {
    color: var(--md-green-soft);
    font-size: 1rem;
    white-space: nowrap;
}

.md-checkout-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.md-checkout-line img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--md-radius);
    flex-shrink: 0;
}

.md-checkout-line span {
    font-size: 0.85rem;
    color: var(--md-ink-muted);
}

@media (max-width: 860px) {
    .md-carrinho-layout {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .md-carrinho-item {
        flex-wrap: wrap;
    }

    .md-carrinho-line-total {
        width: 100%;
        text-align: right;
    }
}