/* ═══ HGC CONFIGURATOR — Post-ATC Stepped Wizard ═══ */
/* Brand: #538a53 (sage green), #82d682 (light green), #3bb54a (CTA green) */

/* ─── BACKDROP ─── */
.hgc-wizard-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.hgc-wizard-backdrop.visible { opacity: 1; }

/* ─── WIZARD CONTAINER ─── */
.hgc-wizard {
    position: fixed;
    z-index: 99999;
    background: #fff;
    color: #222;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18);
    font-family: inherit;
}

/* Mobile: bottom sheet */
@media (max-width: 768px) {
    .hgc-wizard {
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 88vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .hgc-wizard.visible { transform: translateY(0); }
}

/* Desktop: centered modal */
@media (min-width: 769px) {
    .hgc-wizard {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
        width: 460px;
        max-height: 80vh;
        border-radius: 16px;
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease;
    }
    .hgc-wizard.visible {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ─── HANDLE (mobile drag indicator) ─── */
.hgc-wizard__handle {
    width: 36px;
    height: 4px;
    background: #d4d4d4;
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}
@media (min-width: 769px) {
    .hgc-wizard__handle { display: none; }
}

/* ─── HEADER ─── */
.hgc-wizard__header {
    display: flex;
    align-items: center;
    padding: 14px 16px 8px;
    flex-shrink: 0;
    gap: 8px;
}
.hgc-wizard__back {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin: -4px;
    margin-right: 0;
    line-height: 0;
    border-radius: 8px;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.hgc-wizard__back svg {
    width: 22px;
    height: 22px;
    fill: #555;
    transition: fill 0.15s;
}
.hgc-wizard__back:hover { background: rgba(0,0,0,0.06); }
.hgc-wizard__back:hover svg { fill: #222; }
.hgc-wizard__back:active { transform: scale(0.9); }
.hgc-wizard__title {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    flex: 1;
}
.hgc-wizard__step-counter {
    font-size: 12px;
    color: #538a53;
    font-weight: 600;
    flex-shrink: 0;
}
.hgc-wizard__close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 0 4px 12px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}
.hgc-wizard__close:hover { color: #444; }

/* ─── PROGRESS BAR ─── */
.hgc-wizard__progress {
    height: 3px;
    background: #eee;
    margin: 0 16px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}
.hgc-wizard__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #538a53, #82d682);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* ─── BODY (scrollable step area) ─── */
.hgc-wizard__body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* ─── STEP ─── */
.hgc-wizard__step {
    display: none;
    animation: hgcSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hgc-wizard__step.active {
    display: block;
}
.hgc-wizard__step-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #222;
}
.hgc-wizard__step-desc {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
}

/* ─── OPTION CARDS ─── */
.hgc-option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hgc-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f8f9f8;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.1s, box-shadow 0.2s;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}
.hgc-option:active {
    transform: scale(0.98);
}

/* Selected option */
.hgc-option:has(input:checked),
.hgc-option.selected {
    border-color: #538a53;
    background: rgba(83, 138, 83, 0.07);
    box-shadow: 0 0 0 1px rgba(83, 138, 83, 0.15);
}

.hgc-option input[type="radio"],
.hgc-option input[type="checkbox"] {
    accent-color: #538a53;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin: 0;
}

.hgc-option__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
}
.hgc-option__label {
    font-size: 14px;
    font-weight: 500;
    color: #222;
}
.hgc-option__price {
    color: #538a53;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ─── FOOTER ─── */
.hgc-wizard__footer {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}
.hgc-wizard__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.hgc-wizard__total-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.hgc-wizard__total-value {
    font-size: 20px;
    font-weight: 700;
    color: #222;
    transition: transform 0.2s ease;
}
.hgc-wizard__total-value.hgc-bump {
    transform: scale(1.08);
}

/* Nav row: back + next/save */
.hgc-wizard__nav {
    display: flex;
    gap: 8px;
}

.hgc-wizard__next {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: #538a53;
    color: #fff;
    transition: background 0.2s, transform 0.1s;
}
.hgc-wizard__next:hover { background: #477447; }
.hgc-wizard__next:active { transform: scale(0.97); }

.hgc-wizard__done {
    padding: 14px 18px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #555;
    transition: all 0.2s;
    flex-shrink: 0;
}
.hgc-wizard__done:hover { border-color: #538a53; color: #538a53; }
.hgc-wizard__done:active { transform: scale(0.97); }

/* Last step: Concluir becomes primary */
.hgc-wizard__done.primary {
    flex: 1;
    background: #538a53;
    color: #fff;
    border-color: #538a53;
}
.hgc-wizard__done.primary:hover { background: #477447; border-color: #477447; }
.hgc-wizard__done:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── ERROR / SUCCESS STATE ─── */
.hgc-wizard__success {
    text-align: center;
    padding: 32px 16px;
}
.hgc-wizard__success-icon {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #538a53;
    color: #fff;
    font-size: 28px;
    line-height: 56px;
    margin: 0 auto 16px;
    animation: hgcPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.hgc-wizard__success-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #82d682;
    animation: hgcPulseRing 0.6s ease 0.3s backwards;
    opacity: 0;
}
.hgc-wizard__success-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #222;
    animation: hgcSlideUp 0.3s ease 0.15s backwards;
}
.hgc-wizard__btn-continue {
    display: block;
    width: 100%;
    padding: 14px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    background: transparent;
    color: #555;
    transition: border-color 0.2s, transform 0.1s;
}
.hgc-wizard__btn-continue:hover { border-color: #bbb; }
.hgc-wizard__btn-continue:active { transform: scale(0.97); }

/* ─── CART "Configurar" BUTTON ─── */
.hgc-cart-customize {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 4px;
    padding: 8px 16px 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #538a53;
    background: rgba(83, 138, 83, 0.06);
    border: 1.5px solid rgba(83, 138, 83, 0.28);
    border-radius: 100px;
    cursor: pointer;
    line-height: 1;
    font-family: inherit;
    letter-spacing: 0.01em;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    animation: hgcChipEntrance 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.3s backwards;
}

/* Shimmer gleam — single sweep */
.hgc-cart-customize::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.55) 50%, transparent 80%);
    animation: hgcShimmer 0.7s ease 1s forwards;
    pointer-events: none;
}

.hgc-cart-customize svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse dot */
.hgc-cart-customize__dot {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 7px;
    height: 7px;
    background: #3bb54a;
    border-radius: 50%;
    border: 1.5px solid #fff;
    animation: hgcDotPulse 1s ease-out 1.4s 3;
}

.hgc-cart-customize:hover {
    background: rgba(83, 138, 83, 0.12);
    border-color: #538a53;
    box-shadow: 0 2px 12px rgba(83, 138, 83, 0.18);
    transform: translateY(-1px);
}
.hgc-cart-customize:hover svg { transform: rotate(15deg); }

.hgc-cart-customize:active {
    transform: scale(0.96);
    box-shadow: none;
    transition-duration: 0.08s;
}

.hgc-cart-customize.loading {
    opacity: 0.55;
    pointer-events: none;
}

@keyframes hgcChipEntrance {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes hgcShimmer {
    0%   { left: -100%; }
    100% { left: 200%; }
}
@keyframes hgcDotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 181, 74, 0.5); }
    50%      { box-shadow: 0 0 0 5px rgba(59, 181, 74, 0); }
}

/* ─── FOCUS STYLES (accessibility) ─── */
.hgc-cart-customize:focus-visible,
.hgc-wizard__close:focus-visible,
.hgc-wizard__back:focus-visible,
.hgc-wizard__next:focus-visible,
.hgc-wizard__done:focus-visible,
.hgc-wizard__btn-continue:focus-visible {
    outline: 2px solid #538a53;
    outline-offset: 2px;
}
.hgc-option:focus-within {
    outline: 2px solid #538a53;
    outline-offset: 2px;
}

/* ─── ANIMATIONS ─── */
@keyframes hgcSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes hgcPopIn {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes hgcPulseRing {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Staggered option card entrance */
.hgc-wizard__step.active .hgc-option:nth-child(1) { animation: hgcSlideUp 0.25s ease 0.05s backwards; }
.hgc-wizard__step.active .hgc-option:nth-child(2) { animation: hgcSlideUp 0.25s ease 0.1s backwards; }
.hgc-wizard__step.active .hgc-option:nth-child(3) { animation: hgcSlideUp 0.25s ease 0.15s backwards; }
.hgc-wizard__step.active .hgc-option:nth-child(4) { animation: hgcSlideUp 0.25s ease 0.2s backwards; }
.hgc-wizard__step.active .hgc-option:nth-child(5) { animation: hgcSlideUp 0.25s ease 0.25s backwards; }
