/* ============================================================
   catalog-modifiers.css
   Modal centrado de opciones personalizables + sección inline en detalle
   ============================================================ */

/* ── Overlay ─────────────────────────────────────────────── */
.mod-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.2s;
}
.mod-drawer-overlay.is-open {
    display: block;
    opacity: 1;
}

/* ── Panel (modal centrado) ──────────────────────────────── */
.mod-drawer {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1101;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 48px rgba(0,0,0,.22);
    width: min(480px, calc(100vw - 32px));
    max-height: min(90vh, 680px);
    display: flex;
    flex-direction: column;
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s;
    pointer-events: none;
}
.mod-drawer.is-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

body.mod-drawer-open {
    overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────── */
.mod-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid #ede9e1;
    flex-shrink: 0;
}
.mod-drawer-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mod-drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: #1a1a1a;
}
.mod-drawer-base-price {
    font-size: 0.9rem;
    color: #666;
}
.mod-drawer-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #888;
    padding: 4px 6px;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.mod-drawer-close:hover {
    background: #f0ece4;
    color: #333;
}

/* ── Body ────────────────────────────────────────────────── */
.mod-drawer-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 8px;
    flex: 1 1 auto;
}

/* ── Footer ──────────────────────────────────────────────── */
.mod-drawer-footer {
    flex-shrink: 0;
    padding: 12px 20px 24px;
    border-top: 1px solid #ede9e1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mod-drawer-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
}
.mod-drawer-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mod-drawer-total-label {
    font-size: 0.85rem;
    color: #666;
}
.mod-drawer-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
}
.mod-drawer-confirm {
    width: 100%;
    justify-content: center;
}

/* ── Grupos de opciones (compartido drawer + inline) ─────── */
.mod-group {
    padding: 16px 0 8px;
    border-bottom: 1px solid #f0ece4;
}
.mod-group:last-child {
    border-bottom: none;
}
.mod-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.mod-group-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a1a1a;
}
.mod-group-meta {
    font-size: 0.78rem;
    color: #888;
    white-space: nowrap;
}

/* ── Filas de opción ─────────────────────────────────────── */
.mod-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mod-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #e8e2d8;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.mod-option-row:hover {
    border-color: #b5a48a;
    background: #faf8f4;
}
.mod-option-row:has(.mod-option-input:checked) {
    border-color: #2d6a4f;
    background: #f0faf4;
}
/* Fallback para Safari < 15.4 sin :has() */
.mod-option-row.is-checked {
    border-color: #2d6a4f;
    background: #f0faf4;
}
.mod-option-row.mod-option-unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}
.mod-option-input {
    width: 18px;
    height: 18px;
    accent-color: #2d6a4f;
    flex-shrink: 0;
    cursor: inherit;
}
.mod-option-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.mod-option-name {
    font-size: 0.92rem;
    color: #1a1a1a;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mod-option-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 600;
    flex-shrink: 0;
}
.mod-option-badge--unavailable {
    background: #e5e7eb;
    color: #6b7280;
}
.mod-option-price {
    font-size: 0.85rem;
    color: #2d6a4f;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.mod-option-stepper {
    display: flex;
    align-items: center;
    border: 1.5px solid rgba(30, 106, 67, 0.3);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
    margin-left: 8px;
}

.mod-option-stepper-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #1e6a43;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    padding: 0;
    font-family: inherit;
}

.mod-option-stepper-btn:hover:not(:disabled) {
    background: rgba(30, 106, 67, 0.1);
}

.mod-option-stepper-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mod-option-stepper-input {
    width: 42px;
    height: 28px;
    border: none;
    border-left: 1px solid rgba(30, 106, 67, 0.25);
    border-right: 1px solid rgba(30, 106, 67, 0.25);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a1a;
    outline: none;
    background: #fff;
    padding: 0;
    border-radius: 0;
}

.mod-option-stepper-input::-webkit-outer-spin-button,
.mod-option-stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mod-option-stepper-input[type='number'] {
    -moz-appearance: textfield;
}

/* ── Mensajes de estado ──────────────────────────────────── */
.mod-loading {
    padding: 16px 0;
    color: #888;
    font-size: 0.9rem;
}
.mod-error-msg {
    padding: 16px 0;
    color: #b91c1c;
    font-size: 0.9rem;
}
.mod-empty {
    padding: 16px 0;
    color: #888;
    font-size: 0.9rem;
}

/* ── Inline (detalle de producto) ────────────────────────── */
.detail-modifiers,
.detail-attrs-wrap {
    margin: 24px 0;
}
.mod-inline-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #1a1a1a;
}
.mod-inline-groups {
    border: 1.5px solid #e8e2d8;
    border-radius: 12px;
    padding: 0 16px;
    background: #faf8f4;
}
.mod-inline-groups .mod-group {
    padding: 14px 0 8px;
}

/* Botón "Agregar al carrito" con modificadores activos */
.btn-add-to-cart .mod-extra-label {
    font-size: 0.78rem;
    opacity: 0.85;
    display: block;
    font-weight: 400;
}

/* ── Atributos seleccionables ────────────────────────────── */
.mod-attrs-container {
    padding: 14px 0 6px;
    border-bottom: 1px solid #f0ece4;
}
.mod-attr-group {
    margin-bottom: 10px;
}
.mod-attr-group:last-child {
    margin-bottom: 0;
}
.mod-attr-group-title {
    font-size: 0.80rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.mod-attr-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mod-attr-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #f4f0e8;
    border: 1.5px solid #e2dbd0;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #4a3f2f;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
    line-height: 1.3;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.mod-attr-chip:hover {
    border-color: #a89070;
    background: #ede8dc;
}
.mod-attr-chip.is-selected {
    background: #2d6a4f;
    border-color: #2d6a4f;
    color: #fff;
    box-shadow: 0 2px 8px rgba(45,106,79,.25);
}
