/* =========================================================================
   Magah Ofertas Interativas — CSS Completo
   ========================================================================= */

/* ----- Reset & Base ----- */
.magah-ofertas-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

.magah-ofertas-wrapper *,
.magah-ofertas-wrapper *::before,
.magah-ofertas-wrapper *::after {
    box-sizing: border-box;
}

/* =========================================================================
   1. SELETOR (Step 1)
   ========================================================================= */
.magah-ofertas-selector {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.magah-ofertas-selector-inner {
    text-align: center;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.06);
    padding: 48px 32px;
}

.magah-ofertas-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
    line-height: 1.2;
}

.magah-ofertas-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0 0 36px;
    line-height: 1.4;
    font-weight: 400;
}

/* Gender buttons — horizontal rectangles */
.magah-ofertas-gender {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 36px;
}

.magah-gender-btn {
    min-width: 200px;
    flex: 1;
    max-width: 260px;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    transition: all 0.3s ease;
    outline: none;
}

.magah-gender-btn:hover {
    border-color: #e67e22;
    box-shadow: 0 4px 20px rgba(230, 126, 34, 0.12);
    transform: translateY(-2px);
}

.magah-gender-btn.selected {
    border-color: #e67e22;
    background: rgba(230, 126, 34, 0.08);
    box-shadow: 0 4px 20px rgba(230, 126, 34, 0.18);
}

.magah-gender-label {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    letter-spacing: -0.01em;
}

.magah-gender-btn.selected .magah-gender-label {
    color: #e67e22;
}

/* Age selector */
.magah-ofertas-age {
    animation: magahFadeInUp 0.35s ease both;
}

.magah-ofertas-age-label {
    font-size: 17px;
    font-weight: 600;
    color: #444;
    margin: 0 0 18px;
}

.magah-age-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.magah-age-btn {
    padding: 10px 22px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    background: #f5f5f5;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    outline: none;
}

.magah-age-btn:hover {
    background: #eaeaea;
    border-color: #ccc;
    color: #333;
}

.magah-age-btn.selected {
    background: #e67e22;
    border-color: #e67e22;
    color: #fff;
}

.magah-age-btn small {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.65;
    line-height: 1;
}

/* =========================================================================
   2. RESULTADOS (Step 2)
   ========================================================================= */
.magah-ofertas-results {
    animation: magahFadeIn 0.35s ease both;
}

.magah-ofertas-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.magah-ofertas-selection-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#magah-selection-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.magah-change-btn {
    padding: 6px 16px;
    border: 1px solid #e67e22;
    border-radius: 100px;
    background: transparent;
    color: #e67e22;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.magah-change-btn:hover {
    background: #e67e22;
    color: #fff;
}

/* Pills */
.magah-ofertas-pills {
    display: flex;
    gap: 8px;
    padding: 0 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.magah-ofertas-pills::-webkit-scrollbar {
    display: none;
}

.magah-pill {
    flex-shrink: 0;
    padding: 8px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 100px;
    background: #f5f5f5;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    white-space: nowrap;
}

.magah-pill:hover {
    border-color: #e67e22;
    color: #e67e22;
}

.magah-pill.active {
    background: #e67e22;
    border-color: #e67e22;
    color: #fff;
}

.magah-pill-count {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 100px;
    padding: 1px 6px;
    min-width: 20px;
    text-align: center;
}

.magah-pill.active .magah-pill-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Grid */
.magah-ofertas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Product card */
.magah-product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: magahFadeInUp 0.4s ease both;
}

.magah-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.magah-product-image-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f9f9f9;
}

.magah-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.magah-product-card:hover .magah-product-image {
    transform: scale(1.04);
}

.magah-discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #e67e22;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
    z-index: 1;
    line-height: 1.2;
}

.magah-product-info {
    padding: 12px;
}

.magah-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

.magah-product-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.magah-price-regular {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.magah-price-sale {
    font-size: 17px;
    font-weight: 700;
    color: #e67e22;
}

.magah-product-btn {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: #e67e22;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    outline: none;
    text-align: center;
}

.magah-product-btn:hover {
    background: #d35400;
}

/* =========================================================================
   3. MODAL
   ========================================================================= */
.magah-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: magahFadeIn 0.2s ease both;
}

.magah-modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: magahSlideUp 0.3s ease both;
}

.magah-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    outline: none;
    padding: 0;
}

.magah-modal-close:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* ========================================
   MODAL — Quick View (Server-Side)
   ======================================== */

.magah-modal-body {
    display: flex;
    flex-direction: column;
}

/* Layout 2 colunas dentro do modal */
#magah-qv-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
}

@media (min-width: 640px) {
    #magah-qv-content {
        flex-direction: row;
        gap: 30px;
    }
}

/* Imagem */
.magah-qv-image {
    flex: 0 0 auto;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .magah-qv-image {
        flex: 0 0 45%;
        max-width: none;
        margin: 0;
    }
}

.magah-qv-main-img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
}

/* Gallery thumbnails */
.magah-qv-gallery {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.magah-qv-gallery-thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.magah-qv-gallery-thumb.active,
.magah-qv-gallery-thumb:hover {
    border-color: #e67e22;
    opacity: 1;
}

.magah-qv-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Info */
.magah-qv-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.magah-qv-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
}

/* Preço — herda estilo do WooCommerce */
.magah-qv-price .price {
    font-size: 20px;
}

.magah-qv-price .price del {
    opacity: 0.5;
    font-size: 16px;
}

.magah-qv-price .price ins {
    text-decoration: none;
    font-weight: 700;
    color: #e67e22;
}

/* Formulário de variações — ajustes para caber no modal */
.magah-qv-add-to-cart .variations {
    margin-bottom: 16px;
    width: 100%;
}

.magah-qv-add-to-cart .variations td.value {
    padding-bottom: 12px;
}

/* Esconder tabela de labels — os swatches são auto-explicativos */
.magah-qv-add-to-cart .variations th.label {
    display: none;
}

/* Swatches: ajustar tamanho dentro do modal */
.magah-qv-add-to-cart .variable-items-wrapper .variable-item {
    min-width: 36px;
    min-height: 36px;
}

.magah-qv-add-to-cart .variable-items-wrapper .variable-item-span-button {
    font-size: 14px;
}

/* Botão add-to-cart no modal */
.magah-qv-add-to-cart .single_add_to_cart_button {
    width: 100%;
    background-color: #e67e22;
    color: #fff;
    border: none;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-transform: none;
    letter-spacing: 0;
}

.magah-qv-add-to-cart .single_add_to_cart_button:hover {
    background-color: #d35400;
}

.magah-qv-add-to-cart .single_add_to_cart_button.disabled,
.magah-qv-add-to-cart .single_add_to_cart_button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.magah-qv-add-to-cart .single_add_to_cart_button.loading {
    position: relative;
    color: transparent;
}

.magah-qv-add-to-cart .single_add_to_cart_button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: magahSpin 0.6s linear infinite;
}

/* Quantity dentro do modal */
.magah-qv-add-to-cart .quantity {
    margin-bottom: 12px;
}

/* Variação selecionada — preço dinâmico */
.magah-qv-add-to-cart .woocommerce-variation-price .price {
    font-size: 22px;
    color: #e67e22;
    font-weight: 700;
}

/* Loading dentro do modal */
.magah-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
}

/* Reset link styling */
.magah-qv-add-to-cart .reset_variations {
    font-size: 13px;
    color: #999;
}

/* Esconder o select nativo (o Swatches já faz isso, mas por segurança) */
.magah-qv-add-to-cart select.woo-variation-raw-select {
    display: none !important;
}

/* Confirmation */
.magah-modal-confirmation {
    text-align: center;
    padding: 40px 20px;
    animation: magahFadeIn 0.3s ease both;
}

.magah-confirmation-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #27ae60;
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    line-height: 1;
}

.magah-confirmation-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 24px;
}

.magah-confirmation-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.magah-btn-checkout {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: #e67e22;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s ease;
}

.magah-btn-checkout:hover {
    background: #d35400;
    color: #fff;
    text-decoration: none;
}

.magah-btn-continue {
    display: block;
    width: 100%;
    padding: 14px;
    border: 2px solid #e67e22;
    border-radius: 10px;
    background: transparent;
    color: #e67e22;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    text-align: center;
}

.magah-btn-continue:hover {
    background: rgba(230, 126, 34, 0.06);
}

/* =========================================================================
   4. LOADING & EMPTY
   ========================================================================= */
.magah-ofertas-loading {
    text-align: center;
    padding: 60px 20px;
}

.magah-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: #e67e22;
    border-radius: 50%;
    animation: magahSpin 0.7s linear infinite;
    margin: 0 auto 16px;
}

.magah-ofertas-loading p {
    font-size: 15px;
    color: #888;
    margin: 0;
}

.magah-ofertas-empty {
    text-align: center;
    padding: 60px 20px;
}

.magah-ofertas-empty p {
    font-size: 16px;
    color: #888;
    margin: 0;
}

/* =========================================================================
   5. ANIMATIONS
   ========================================================================= */
@keyframes magahFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes magahFadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes magahSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes magahSpin {
    to { transform: rotate(360deg); }
}

/* =========================================================================
   6. RESPONSIVE
   ========================================================================= */

/* Tablet 768px+ */
@media (min-width: 768px) {
    .magah-ofertas-wrapper {
        padding: 24px;
    }

    .magah-ofertas-title {
        font-size: 34px;
    }

    .magah-ofertas-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .magah-ofertas-selector-inner {
        padding: 56px 48px;
    }

    .magah-gender-label {
        font-size: 24px;
    }

    .magah-product-name {
        font-size: 15px;
    }
}

/* Desktop 1024px+ */
@media (min-width: 1024px) {
    .magah-ofertas-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .magah-ofertas-title {
        font-size: 38px;
    }

    .magah-product-info {
        padding: 14px;
    }

    .magah-modal-content {
        max-width: 720px;
    }
}

/* Modal — mobile */
@media (max-width: 639px) {
    .magah-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 2.5vh auto;
    }

    .magah-qv-image {
        max-width: 240px;
    }

    .magah-qv-title {
        font-size: 18px;
    }
}

/* Small mobile */
@media (max-width: 374px) {
    .magah-ofertas-selector-inner {
        padding: 32px 16px;
    }

    .magah-ofertas-gender {
        flex-direction: column;
        align-items: center;
    }

    .magah-gender-btn {
        min-width: 0;
        width: 100%;
        max-width: 280px;
    }

    .magah-gender-label {
        font-size: 18px;
    }

    .magah-ofertas-title {
        font-size: 24px;
    }

    .magah-age-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}
