/* ==========================================================================
   My Mix: armador visual de Frappuccinos (vista "mix"). Usa los tokens de theme.css.
   ========================================================================== */
body[data-view="mix"] .global-search-shell {
    display: none;
}

.mix-view {
    display: grid;
    gap: 16px;
    width: min(100%, 980px);
    margin: 0 auto;
    color: var(--g-900);
}

.mix-loading,
.mix-error p {
    margin: 0;
    padding: 28px 8px;
    text-align: center;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 700;
}

.mix-error {
    display: grid;
    justify-items: center;
    gap: 10px;
}

/* ---------- Encabezado ---------- */
.mix-hero {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
    color: #fff;
}

.mix-logo {
    height: 46px;
    width: auto;
    /* El logo es negro: se vuelve blanco para el fondo verde */
    filter: brightness(0) invert(1) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.mix-hero h2 {
    margin: 0;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
}

.mix-hero p {
    margin: 0;
    max-width: 46ch;
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.4;
}

/* ---------- Cargar un código (segundas ventas) ---------- */
.mix-load {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.mix-load label {
    font-weight: 800;
}

.mix-load-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.mix-load-row input {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mix-load-feedback {
    margin: 0;
    min-height: 1.1em;
    color: var(--danger-700);
    font-size: 0.88rem;
    font-weight: 700;
}

/* ---------- Distribución ---------- */
.mix-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.mix-controls {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.mix-preview-card {
    position: sticky;
    top: 8px;
    z-index: 6;
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 26px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

/* ---------- Vaso (capas apiladas en el mismo cuadro) ---------- */
.mix-stage {
    position: relative;
    width: 100%;
    max-width: min(100%, clamp(150px, 26vh, 230px));
    aspect-ratio: 1;
    margin-inline: auto;
    border-radius: 22px;
    background: radial-gradient(circle at 50% 42%, #ffffff 0%, #e9f3ee 62%, #d6e8df 100%);
    overflow: hidden;
}

.mix-stage--ticket {
    max-width: min(100%, 300px);
}

.mix-stage-shadow {
    position: absolute;
    left: 50%;
    bottom: 5%;
    width: 46%;
    height: 7%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(4, 31, 23, 0.32), transparent 70%);
    filter: blur(5px);
}

.mix-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.mix-layer.is-on {
    opacity: 1;
}

.mix-layer.is-instant {
    transition: none;
}

.mix-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px;
    font-weight: 800;
}

.mix-price-row span {
    color: var(--g-700);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mix-price-row strong {
    font-size: 1.7rem;
    letter-spacing: -0.02em;
}

/* ---------- Tamaños ---------- */
.mix-sizes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mix-size {
    display: grid;
    gap: 1px;
    justify-items: center;
    padding: 7px 4px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--g-900);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.mix-size small {
    font-weight: 700;
    color: var(--g-700);
}

.mix-size.is-selected {
    border-color: var(--g-600);
    background: var(--g-700);
    color: #fff;
}

.mix-size.is-selected small {
    color: var(--g-100);
}

.mix-size:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---------- Grupos de opciones ---------- */
.mix-group,
.mix-summary {
    display: grid;
    gap: 6px;
    padding: 14px 14px 10px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.mix-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.mix-group-head h3,
.mix-summary h3,
.mix-saved h3 {
    margin: 0;
    color: var(--g-800);
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mix-group-value {
    font-weight: 800;
    text-align: right;
}

.mix-group-hint {
    margin: 0;
    color: #55665f;
    font-size: 0.86rem;
    line-height: 1.35;
}

.mix-group[data-empty="true"] .mix-group-hint::after {
    content: ' · Todavía no hay opciones para esta mezcla.';
    color: var(--g-700);
    font-weight: 800;
}

.mix-options {
    display: flex;
    gap: 10px;
    padding: 6px 2px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.mix-option {
    flex: none;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 3px;
    width: 88px;
    padding: 8px 6px 6px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-xs);
    color: var(--g-900);
    font: inherit;
    cursor: pointer;
    scroll-snap-align: start;
    transition: border-color 0.15s, background-color 0.15s, transform 0.15s var(--ease-out);
}

.mix-option:hover:not(.is-disabled) {
    transform: translateY(-2px);
}

.mix-option.is-selected {
    border-color: var(--g-600);
    background: var(--g-50);
    box-shadow: 0 0 0 3px rgba(70, 166, 126, 0.25);
}

.mix-option.is-disabled {
    opacity: 0.38;
    filter: grayscale(0.7);
    cursor: not-allowed;
}

.mix-option-media {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
}

.mix-option-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.mix-swatch {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sw, #fff);
    border: 2px solid rgba(15, 61, 46, 0.18);
}

.mix-option--none .mix-swatch {
    background: #fff;
    border-style: dashed;
    border-color: rgba(15, 61, 46, 0.35);
}

.mix-option--none .mix-swatch::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 120%;
    background: rgba(15, 61, 46, 0.35);
    transform: translate(-50%, -50%) rotate(45deg);
}

.mix-option-label {
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
}

.mix-option-price {
    min-height: 1em;
    color: var(--g-700);
    font-size: 0.7rem;
    font-weight: 700;
}

/* ---------- Resumen ---------- */
.mix-lines {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mix-lines li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border);
}

.mix-lines li span {
    min-width: 0;
}

.mix-total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
    font-weight: 800;
}

.mix-total-row strong {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.mix-actions {
    display: grid;
    gap: 10px;
}

.mix-cta {
    justify-content: center;
    min-height: 54px;
    font-size: 1.05rem;
}

/* ---------- Mezclas guardadas ---------- */
.mix-saved {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.mix-saved[hidden] {
    display: none;
}

.mix-saved-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mix-saved-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
}

.mix-saved-load {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--g-900);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.mix-saved-load small {
    color: #55665f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mix-saved-price {
    font-weight: 800;
}

/* ---------- Ticket con el código ---------- */
.mix-ticket {
    display: grid;
    gap: 12px;
    width: min(100%, 460px);
    margin: 0 auto;
    padding: 18px;
    border-radius: 28px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.mix-ticket h2 {
    margin: 0;
    text-align: center;
    font-size: 1.4rem;
}

.mix-ticket-sub,
.mix-ticket-hint {
    margin: 0;
    text-align: center;
    color: #55665f;
    line-height: 1.4;
}

.mix-code-box {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 14px;
    border: 2px dashed var(--g-600);
    border-radius: 18px;
    background: var(--g-50);
}

.mix-code-box span {
    color: var(--g-700);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mix-code-box strong {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: clamp(1.5rem, 8vw, 2.1rem);
    letter-spacing: 0.1em;
    user-select: all;
}

.mix-ticket-actions {
    display: grid;
    gap: 8px;
}

/* ---------- Pantallas grandes: vaso a la izquierda, opciones a la derecha ---------- */
@media (min-width: 880px) {
    .mix-layout {
        grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
        gap: 22px;
    }

    .mix-preview-card {
        top: 16px;
        padding: 16px;
    }

    .mix-stage {
        max-width: 100%;
    }

    .mix-options {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

/* ---------- Menos movimiento ---------- */
html.perf-lite .mix-layer,
html.perf-lite .mix-option,
html.perf-lite .mix-size {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .mix-layer,
    .mix-option,
    .mix-size {
        transition: none;
    }
}
