/* ====== Variables base ====== */
:root {
    --swz-nav-h: 72px;
}
@media (max-width: 480px) {
    :root {
        --swz-nav-h: 64px;
    }
}

/* ====== Contenedor principal ====== */
.swz.sectors-wizard {
    --primary: #af172b;
    --primary-dark: #8b1322;
    --secondary: #30373d;
    --muted: #878a8c;
    --muted-light: #b9bcbe;
    --background: #fff;
    --foreground: #000;
    --border: #e5e7eb;
    min-height: 90vh;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    margin-bottom: 15%;
}

/* ====== Contenedor interno ====== */
.swz .wizard-container {
    max-width: 1320px;
    width: 100%;
    margin: 15px auto 0;
    padding: 3px var(--swz-nav-h) 3px 3px;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding-top: 2%;
}

/* ====== Progreso ====== */
.swz .progress-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 20px;
}
.swz .progress-step {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    transition: all 0.3s;
}
.swz .progress-step.active {
    background: var(--primary);
    transform: scale(1.1);
}
.swz .progress-step.completed {
    background: var(--primary);
}
.swz .progress-step.inactive {
    background: var(--muted);
}

/* ====== Pasos ====== */
.swz .wizard-step {
    display: none;
    text-align: center;
    margin-bottom: 2rem;
}
.swz .wizard-step.active {
    display: block;
}
.swz .step-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0;
}
.swz .step-description {
    font-size: 1.125rem;
    color: var(--muted);
    margin-bottom: 2.9rem;
}

/* ====== Sectores ====== */
.swz .sectors-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
    grid-template-columns: 1fr;
}
@media (min-width: 641px) and (max-width: 991px) {
    .swz .sectors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 992px) {
    .swz .sectors-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 1.25rem;
    }
}
.swz .sector-card {
    position: relative;
    height: 50vh;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: 0.3s;
    background-size: cover;
    background-position: center;
    width: 100%;
}
.swz .sector-card:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.swz .sector-card.selected {
    outline: 2px solid var(--primary);
    transform: scale(1.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.swz .sector-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.6));
}
.swz .sector-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    color: #fff;
}
.swz .sector-title {
    text-transform: uppercase;
    font-weight: 900;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}
.swz .sector-description {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.swz .sector-button {
    align-self: center;
    padding: 0.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 9999px;
    color: #fff;
    font-weight: 600;
    transition: 0.3s;
    backdrop-filter: blur(4px);
}
.swz .sector-button:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* ====== Tarjetas ====== */
.swz .option-card,
.swz .swz-option-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: 0.15s;
    display: flex;
    align-items: center;
}
.swz .option-card:hover,
.swz .swz-option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}
.swz .option-card.selected,
.swz .swz-option-card.selected {
    border-color: var(--primary);
    background: rgba(175, 23, 43, 0.06);
    box-shadow: 0 0 0 2px rgba(175, 23, 43, 0.12) inset;
}
.swz .option-title {
    font-weight: 700;
    color: var(--secondary);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.swz .option-description {
    color: var(--muted);
    font-size: 0.85rem;
}

/* ====== Grid de opciones ====== */
.swz .swz-col-grid,
.swz #swz-normatives-container,
.swz #swz-risks-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
}
@media (min-width: 992px) {
    .swz .swz-step2-grid #swz-risks-container,
    .swz .swz-step2-grid #swz-normatives-container {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* ====== Navegación ====== */
.swz .navigation {
    position: static;
    margin-top: auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    padding: 1.8rem 1rem;
    background: #fff;
    border-top: 1px solid var(--border);
}
.nav-button.ghost {
    background: transparent;
    border: 1px solid #ccc;
    color: #333;
}
.nav-button.ghost:hover {
    border-color: #000;
}
.nav-button + #swz-skip-btn {
    margin-left: 8px;
}
#swz-next-btn {
    margin-left: auto;
    width: 100%;
}
#swz-skip-btn {
    margin-left: 8px;
}
.swz .nav-button {
    padding: 1.12rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: #fff;
    color: var(--secondary);
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
    max-width: 170px;
}
.swz .nav-button:hover:not(:disabled) {
    background: var(--muted-light);
}
.swz .nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.swz .nav-button.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.swz .nav-button.primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

/* ====== Móviles ====== */
@media (max-width: 768px) {
    .swz .navigation {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        background: #fff;
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
    }
    .swz .wizard-container {
        padding-bottom: 100px;
    }
}
@media (min-width: 992px) and (max-width: 1440px) {
    .swz.sectors-wizard {
        transform: scale(0.9);
        transform-origin: top center;
    }
}
@media (max-width: 640px) {
    .swz .sectors-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .swz .wizard-container {
        padding: 1.5rem 1rem;
    }
    .swz .sector-card {
        height: clamp(120px, 24vh, 170px) !important;
    }
    .swz .sector-title {
        font-size: 1rem !important;
    }
    .swz .sector-description {
        display: none !important;
    }
    .swz .sector-button {
        padding: 0.35rem 0.9rem !important;
        font-size: 0.85rem !important;
    }
}
@media (max-width: 480px) {
    .swz .nav-button {
        padding: 0.6rem 1rem;
    }
}

/* ====== Accesibilidad ====== */
.swz .option-card:focus-visible,
.swz .swz-option-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ====== Layout interno de las tarjetas ====== */
.swz #swz-risks-container .option-card,
.swz #swz-normatives-container .swz-option-card,
.swz .swz-col-grid .option-card,
.swz .swz-col-grid .swz-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    min-height: 90px;
    padding: 10px;
}
.swz .swz-option-logo {
    flex: 0 0 75px;
    width: 75px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.swz .swz-option-logo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.swz .swz-option-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}
.swz .swz-option-title {
    color: #000;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
    margin-bottom: 4px;
}
.swz .swz-option-desc,
.swz .option-description {
    color: #9ca3af;
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: left;
}

/* === Paso 4: Gramaje en UNA sola columna === */
.swz #swz-gramaje-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    max-width: 750px;
    margin: 0 auto;
}
.swz .gramaje-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 4% 4%;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s,
        transform 0.15s;
}
.swz .gramaje-row:hover {
    border-color: var(--primary);
    background: rgba(175, 23, 43, 0.05);
}
.swz .gramaje-row.selected {
    border-color: var(--primary);
    background: rgba(175, 23, 43, 0.1);
}
.swz .gramaje-text {
    flex: 1 1 auto;
    text-align: left;
}
.swz .gramaje-desc {
    font-size: 1.1rem;
    color: var(--secondary);
    font-weight: 500;
}
.swz .gramaje-value {
    flex: 0 0 auto;
    min-width: 150px;
    text-align: right;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    margin-left: 16px;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .swz .gramaje-row {
        padding: 12px 14px;
    }
    .swz .gramaje-value {
        min-width: 120px;
    }
}
/* ===== Skip button styling ===== */
.swz .nav-button.is-skip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    border: 1px solid var(--border);
}

.swz .skip-icon {
    width: 16px;
    height: 16px;
}
/* Más ancho sin romper las 5 columnas */
@media (min-width: 1280px) {
    .swz .wizard-container {
        max-width: 1560px; /* antes 1320px */
        padding-right: 24px; /* libera espacio horizontal */
    }
    .swz .sectors-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.9rem; /* antes 1.25rem */
    }
}

@media (min-width: 1600px) {
    .swz .wizard-container {
        max-width: 1680px;
    }
}

@media (min-width: 1920px) {
    .swz .wizard-container {
        max-width: 1800px;
    }
}

.swz #swz-normatives-container.is-single {
    grid-template-columns: 1fr !important;
    justify-items: center;
}
.swz #swz-normatives-container.is-single .swz-option-card {
    width: 100%;
    max-width: 560px;
}
/* ===== Alinear títulos de sector ===== */
.swz .sector-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem 1rem;
}

.swz .sector-title {
    margin: 0;
    min-height: 3em;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.swz .sector-description {
    min-height: 3.5em;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.swz .sector-overlay {
    background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6));
}

/* ===== Una sola fila cuando hay ≤6 ===== */
/* ===== Una sola columna cuando hay ≤6 ===== */
.swz #swz-risks-container.is-single,
.swz #swz-normatives-container.is-single {
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    gap: 12px !important;
}

.swz #swz-risks-container.is-single .option-card,
.swz #swz-normatives-container.is-single .swz-option-card {
    width: 100%;
    max-width: 560px;
}

/* En pantallas pequeñas puedes permitir scroll horizontal si no caben cómodas */
@media (max-width: 640px) {
    .swz #swz-risks-container.is-single,
    .swz #swz-normatives-container.is-single {
        overflow-x: auto;
    }
}
