/* ── Coffee Subscription Wizard — Front-end styles ─────────────────────── */

:root {
    --csw-primary: #3a6b35;
    --csw-accent:  #f5c518;
    --csw-radius:  12px;
    --csw-border:  #e2e2e2;
    --csw-text:    #1a1a1a;
    --csw-muted:   #666;
    --csw-bg:      #f9f6f0;
    --csw-card-bg: #ffffff;
    --csw-shadow:  0 2px 12px rgba(0,0,0,.07);
    --csw-trans:   .2s ease;
}

/* ── Wrapper ────────────────────────────────────────────────────────────── */
.csw-wizard {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
    font-family: inherit;
    color: var(--csw-text);
}

/* ── Progress bar ───────────────────────────────────────────────────────── */
.csw-progress {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 2.5rem;
    padding: 0.75rem 0;
    position: relative;
}

.csw-progress-step {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    transition: opacity var(--csw-trans);
}

.csw-progress-step.is-active  { opacity: 1; color: var(--csw-primary); }
.csw-progress-step.is-done    { opacity: 0.7; }

.csw-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.csw-progress-step.is-done .csw-step-num {
    background: var(--csw-primary);
    border-color: var(--csw-primary);
    color: #fff;
}
.csw-progress-step.is-done .csw-step-num::after { content: '✓'; }
.csw-progress-step.is-done .csw-step-num span   { display: none; }

.csw-progress-chevron {
    opacity: 0.3;
    font-size: 0.9rem;
    margin: 0 2px;
    line-height: 1;
}

.csw-back-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--csw-border);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.8rem;
    color: var(--csw-muted);
    cursor: pointer;
    transition: border-color var(--csw-trans), color var(--csw-trans);
}
.csw-back-btn:hover { border-color: var(--csw-primary); color: var(--csw-primary); }

/* ── Heading ────────────────────────────────────────────────────────────── */
.csw-heading {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--csw-primary);
    margin: 0 0 2rem;
    line-height: 1.3;
}

/* ── Option grids ───────────────────────────────────────────────────────── */
.csw-option-grid {
    display: grid;
    gap: 16px;
}

.csw-type-grid    { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.csw-product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.csw-freq-grid    { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ── Option cards ───────────────────────────────────────────────────────── */
.csw-option-card,
.csw-product-card {
    position: relative;
    cursor: pointer;
    border-radius: var(--csw-radius);
    border: 2px solid var(--csw-border);
    background: var(--csw-card-bg);
    box-shadow: var(--csw-shadow);
    transition: border-color var(--csw-trans), box-shadow var(--csw-trans), transform var(--csw-trans);
    display: block;
    overflow: visible;
}

.csw-option-card:hover,
.csw-product-card:hover {
    border-color: var(--csw-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

/* Selected state */
.csw-option-card:has(.csw-radio:checked),
.csw-product-card:has(.csw-radio:checked) {
    border-color: var(--csw-primary);
    box-shadow: 0 0 0 3px rgba(58,107,53,.15), var(--csw-shadow);
}

/* Hide native radios */
.csw-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.csw-card-inner {
    padding: 1.5rem 1.25rem 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* ── Badge ──────────────────────────────────────────────────────────────── */
.csw-badge {
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--csw-accent);
    color: #5a3e00;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 12px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    z-index: 1;
}

/* ── Icons ──────────────────────────────────────────────────────────────── */
.csw-icon {
    width: 72px;
    height: 56px;
    color: var(--csw-primary);
    margin-bottom: 4px;
}
.csw-icon svg { width: 100%; height: 100%; }

.csw-icon-freq {
    width: 44px;
    height: 44px;
}

/* ── Product images ─────────────────────────────────────────────────────── */
.csw-product-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 6px;
}

/* ── Card text ──────────────────────────────────────────────────────────── */
.csw-option-label,
.csw-product-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    color: var(--csw-text);
    line-height: 1.3;
}

.csw-option-desc,
.csw-product-desc {
    font-size: 0.8rem;
    color: var(--csw-muted);
    margin: 0;
    line-height: 1.4;
}

.csw-product-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--csw-primary);
    margin: 4px 0 0;
}

/* ── Footer / CTA ───────────────────────────────────────────────────────── */
.csw-footer {
    margin-top: 2rem;
    text-align: center;
}

.csw-btn-primary {
    background: var(--csw-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 13px 36px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--csw-trans), transform var(--csw-trans);
    letter-spacing: .02em;
}
.csw-btn-primary:hover  { background: color-mix(in srgb, var(--csw-primary) 85%, black); transform: translateY(-1px); }
.csw-btn-primary:active { transform: scale(0.98); }

/* ── Loading overlay ────────────────────────────────────────────────────── */
.csw-step-body.is-loading {
    position: relative;
    min-height: 180px;
    pointer-events: none;
}
.csw-step-body.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="16" stroke="%233a6b35" stroke-width="3" fill="none" stroke-dasharray="60 40"><animateTransform attributeName="transform" type="rotate" from="0 20 20" to="360 20 20" dur=".8s" repeatCount="indefinite"/></circle></svg>') center / 40px no-repeat;
    border-radius: var(--csw-radius);
}

/* ── Notice ─────────────────────────────────────────────────────────────── */
.csw-notice {
    text-align: center;
    color: var(--csw-muted);
    font-style: italic;
    padding: 2rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .csw-type-grid    { grid-template-columns: 1fr; }
    .csw-product-grid { grid-template-columns: repeat(2, 1fr); }
    .csw-freq-grid    { grid-template-columns: repeat(2, 1fr); }
    .csw-heading      { font-size: 1.25rem; }
    .csw-step-label   { display: none; }
}

/* ── Qty card additions ─────────────────────────────────────────────────── */
.csw-qty-card { cursor: default; }

.csw-qty-label {
    font-size: 0.8rem;
    color: var(--csw-muted);
    margin: 8px 0 2px;
}

/* Active (qty > 0) */
.csw-qty-card.csw-card-active {
    border-color: var(--csw-primary);
    box-shadow: 0 0 0 3px rgba(58,107,53,.15), var(--csw-shadow);
}

/* Qty stepper row */
.csw-qty-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--csw-border);
    border-radius: 999px;
    overflow: hidden;
    height: 36px;
    margin: 2px 0 6px;
}

.csw-qty-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--csw-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--csw-trans);
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.csw-qty-btn:hover:not(:disabled) { background: var(--csw-bg); color: var(--csw-primary); }
.csw-qty-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.csw-qty-display {
    min-width: 32px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    line-height: 36px;
    user-select: none;
    color: var(--csw-text);
}

/* Add button */
.csw-add-btn {
    width: 100%;
    background: var(--csw-accent);
    color: #5a3e00;
    border: none;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--csw-trans), transform var(--csw-trans);
}
.csw-add-btn:hover  { background: #e8b800; transform: translateY(-1px); }
.csw-add-btn:active { transform: scale(0.97); }
.csw-add-btn.csw-added {
    background: var(--csw-primary);
    color: #fff;
}

/* Shake for validation */
@keyframes csw-shake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}
.csw-shake { animation: csw-shake 0.4s ease; }


/* ═══════════════════════════════════════════════════════════════
   STEP 3 — Frequency layout (2-column)
   ═══════════════════════════════════════════════════════════════ */

.csw-freq-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 32px;
    align-items: start;
}

/* ── Left column: daily counter ── */
.csw-freq-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.csw-freq-question {
    font-size: 1rem;
    font-weight: 600;
    color: var(--csw-text);
    margin: 0 0 8px;
    line-height: 1.4;
}

/* Big ± counter */
.csw-daily-counter {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 4px 0;
}

.csw-daily-btn {
    background: none;
    border: none;
    font-size: 2rem;
    font-weight: 300;
    color: var(--csw-text);
    cursor: pointer;
    line-height: 1;
    padding: 0 6px;
    transition: color var(--csw-trans);
}
.csw-daily-btn:hover { color: var(--csw-primary); }
.csw-daily-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.csw-daily-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--csw-primary);
    line-height: 1;
    min-width: 2.5rem;
    text-align: center;
}

.csw-daily-unit {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--csw-muted);
    margin: 0;
    text-transform: uppercase;
}

/* Info box */
.csw-daily-info {
    display: flex;
    gap: 10px;
    background: #f0f7ee;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 6px;
    max-width: 320px;
}

.csw-info-icon {
    font-size: 0.9rem;
    color: var(--csw-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.csw-daily-info-text {
    font-size: 0.85rem;
    color: var(--csw-text);
    margin: 0 0 3px;
    line-height: 1.4;
}

.csw-daily-info-sub {
    font-size: 0.77rem;
    color: var(--csw-muted);
    margin: 0;
}

/* ── Right column: frequency option cards ── */
.csw-freq-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.csw-freq-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.csw-freq-option-card {
    display: block;
    border: 2px solid var(--csw-border);
    border-radius: var(--csw-radius);
    background: var(--csw-card-bg);
    cursor: pointer;
    transition: border-color var(--csw-trans), box-shadow var(--csw-trans);
    position: relative;
    overflow: visible;
}

.csw-freq-option-card:hover {
    border-color: var(--csw-primary);
}

.csw-freq-option-card:has(.csw-radio:checked),
.csw-freq-option-card.csw-freq-selected {
    border-color: var(--csw-primary);
    box-shadow: 0 0 0 3px rgba(58,107,53,.12);
}

.csw-freq-option-inner {
    padding: 16px 18px;
    position: relative;
}

.csw-freq-option-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.csw-freq-option-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.csw-freq-option-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--csw-text);
}

.csw-freq-badge-recommended {
    background: var(--csw-accent);
    color: #5a3e00;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
}

/* Eco stamp (top-right rotated circle) */
.csw-freq-badge-eco {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #4a7c45;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
    transform: rotate(-12deg);
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.csw-freq-option-sub {
    font-size: 0.85rem;
    color: var(--csw-muted);
    margin: 2px 0 8px;
}

.csw-freq-option-bullets {
    list-style: disc;
    padding-left: 18px;
    margin: 0 0 10px;
}

.csw-freq-option-bullets li {
    font-size: 0.8rem;
    color: var(--csw-muted);
    margin-bottom: 4px;
    line-height: 1.4;
}

/* Coffee bags illustration */
.csw-freq-bags-img {
    position: absolute;
    right: 12px;
    bottom: 10px;
    width: 70px;
    height: 70px;
    opacity: 0.85;
    pointer-events: none;
}
.csw-freq-bags-img svg { width: 100%; height: 100%; }

/* ── Responsive Step 3 ── */
@media (max-width: 640px) {
    .csw-freq-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .csw-freq-left { align-items: center; text-align: center; }
    .csw-daily-info { max-width: 100%; }
}


/* ═══════════════════════════════════════════════════════════════
   STEP 4 — Coffee product cards (improved)
   ═══════════════════════════════════════════════════════════════ */

/* Recommendation banner */
.csw-coffee-rec-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--csw-bg);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--csw-text);
    line-height: 1.4;
}

.csw-coffee-rec-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.csw-rec-cups,
.csw-rec-weight {
    background: var(--csw-accent);
    color: #5a3e00;
    border-radius: 6px;
    padding: 1px 7px;
    font-weight: 700;
    font-size: 0.85rem;
}

.csw-rec-weight {
    background: #e2ede0;
    color: var(--csw-primary);
}

/* Minimum notice */
.csw-coffee-min-notice {
    font-size: 0.82rem;
    color: var(--csw-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    padding-bottom: 20px;
}

.csw-min-tag {
    background: var(--csw-accent);
    color: #5a3e00;
    border-radius: 6px;
    padding: 1px 8px;
    font-weight: 700;
    font-size: 0.8rem;
}

/* Coffee product grid */
.csw-coffee-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Coffee card */
.csw-coffee-card {
    position: relative;
}

.csw-coffee-badge {
    left: 50%;
    transform: translateX(-50%);
    top: -11px;
}

/* Larger product image for coffee */
.csw-coffee-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 8px;
}

/* Price with strikethrough */
.csw-coffee-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 6px 0 2px;
}

.csw-price-regular {
    font-size: 0.82rem;
    color: var(--csw-muted);
    text-decoration: line-through;
}

.csw-price-sale {
    font-size: 1rem;
    font-weight: 700;
    color: var(--csw-primary);
}

/* Weight line */
.csw-coffee-weight {
    font-size: 0.78rem;
    color: var(--csw-muted);
    margin: 0 0 6px;
}

/* Weight tag badge (shows selected kg) */
.csw-coffee-weight-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1.5px solid var(--csw-primary);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--csw-primary);
    margin: 4px 0 6px;
    background: #f0f7ee;
}

.csw-hidden { display: none !important; }

/* SIGUIENTE button (replaces "Añadir al carrito" label) */
.csw-coffee-siguiente {
    width: 100%;
    background: var(--csw-accent);
    color: #5a3e00;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .04em;
    transition: background var(--csw-trans), transform var(--csw-trans);
}
.csw-coffee-siguiente:hover { background: #e8b800; transform: translateY(-1px); }

/* When card is active (qty > 0) → SIGUIENTE becomes green */
.csw-qty-card.csw-card-active .csw-coffee-siguiente {
    background: var(--csw-primary);
    color: #fff;
}

/* ── Responsive Step 4 ── */
@media (max-width: 540px) {
    .csw-coffee-grid { grid-template-columns: repeat(2, 1fr); }
    .csw-coffee-img  { width: 80px; height: 80px; }
}


/* ═══════════════════════════════════════════════════════════════
   STEP 2 — Machine cards (same design as coffee cards)
   ═══════════════════════════════════════════════════════════════ */

.csw-machine-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.csw-machine-card {
    position: relative;
}

.csw-machine-badge {
    left: 50%;
    transform: translateX(-50%);
    top: -11px;
}

.csw-machine-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 8px;
}

.csw-machine-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 4px 0 2px;
}

.csw-machine-finance {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--csw-muted);
    text-transform: uppercase;
    margin: 0 0 6px;
}

/* Machine select button */
.csw-machine-select-btn {
    width: 100%;
    background: #f5c518 !important;
    color: #5a3e00;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .04em;
    transition: background var(--csw-trans), transform var(--csw-trans);
}
.csw-machine-select-btn:hover { background: #e8b800; transform: translateY(-1px); }
.csw-qty-card.csw-card-active .csw-machine-select-btn {
    background: var(--csw-primary);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   STEP 4 — Coffee multi-select + Continuar footer
   ═══════════════════════════════════════════════════════════════ */

/* Per-card select button */
.csw-coffee-select-btn {
    width: 100%;
    background: var(--csw-accent);
    color: #5a3e00;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .04em;
    transition: background var(--csw-trans), transform var(--csw-trans);
}
.csw-coffee-select-btn:hover { background: #e8b800; transform: translateY(-1px); }
.csw-qty-card.csw-card-active .csw-coffee-select-btn {
    background: var(--csw-primary);
    color: #fff;
}

/* Continuar footer (inside step body, below the grid) */
.csw-coffee-footer {
    margin-top: 24px;
    text-align: center;
}

/* Responsive */
@media (max-width: 540px) {
    .csw-machine-grid { grid-template-columns: repeat(2, 1fr); }
    .csw-machine-img  { width: 90px; height: 90px; }
}
