/**
 * Boletería — selección de entradas
 * Mobile-first responsive + tokens claro/oscuro
 */
.tt-buy {
    --tt-surface: #ffffff;
    --tt-surface-2: #f7f8fa;
    --tt-surface-action: #f5f6f8;
    --tt-surface-sticky: rgba(255, 255, 255, 0.94);
    --tt-border: #e4e7ec;
    --tt-border-strong: #c8cdd6;
    --tt-text: #1a1d22;
    --tt-text-muted: #6b7385;
    --tt-text-subtle: #8b93a3;
    --tt-accent: #3c8dbc;
    --tt-accent-soft: rgba(60, 141, 188, 0.12);
    --tt-accent-ring: rgba(60, 141, 188, 0.35);
    --tt-danger: #d64545;
    --tt-danger-soft: rgba(214, 69, 69, 0.1);
    --tt-shadow: 0 1px 2px rgba(26, 29, 34, 0.05), 0 4px 16px rgba(26, 29, 34, 0.04);
    --tt-shadow-hover: 0 2px 6px rgba(26, 29, 34, 0.06), 0 10px 28px rgba(26, 29, 34, 0.08);
    --tt-shadow-sticky: 0 -8px 24px rgba(26, 29, 34, 0.1);
    --tt-radius: 10px;
    --tt-media-ratio: 3 / 2;
    --tt-media-width: min(220px, 34vw);
    --tt-gap: 16px;
    --tt-pad-x: clamp(12px, 3vw, 22px);
    --tt-pad-y: clamp(14px, 2.5vw, 20px);
    --tt-touch: 44px;
    --tt-transition: 180ms ease;
    --tt-title-size: clamp(1.05rem, 2.4vw, 1.25rem);
    --tt-desc-lines: 4;
}

body.dark-mode .tt-buy,
.dark-mode .tt-buy {
    --tt-surface: #242b4f;
    --tt-surface-2: #1c1f2f;
    --tt-surface-action: #191d2f;
    --tt-surface-sticky: rgba(28, 31, 47, 0.96);
    --tt-border: rgba(255, 255, 255, 0.12);
    --tt-border-strong: rgba(255, 255, 255, 0.22);
    --tt-text: #f0f2f6;
    --tt-text-muted: #9aa3b5;
    --tt-text-subtle: #7d8799;
    --tt-accent: #7eb8e0;
    --tt-accent-soft: rgba(126, 184, 224, 0.14);
    --tt-accent-ring: rgba(126, 184, 224, 0.4);
    --tt-danger: #f08080;
    --tt-danger-soft: rgba(240, 128, 128, 0.14);
    --tt-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.18);
    --tt-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.28), 0 14px 32px rgba(0, 0, 0, 0.22);
    --tt-shadow-sticky: 0 -8px 28px rgba(0, 0, 0, 0.45);
}

/* —— Layout página —— */
.tt-buy .v-page-wrap .container {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
}

.tt-buy .tt-buy-intro {
    margin-bottom: clamp(14px, 3vw, 22px);
}

body.dark-mode .tt-buy .v-heading-v2 h3,
.dark-mode .tt-buy .v-heading-v2 h3 {
    color: var(--tt-text) !important;
    font-size: clamp(1.15rem, 3.2vw, 1.45rem);
}

/* —— Lista —— */
.tt-buy-list {
    display: flex;
    flex-direction: column;
    gap: var(--tt-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* —— Tarjeta (grid areas) —— */
.tt-buy-card {
    display: grid;
    grid-template-columns: var(--tt-media-width) minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
        "media body"
        "media action";
    align-items: stretch;
    margin: 0;
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    background: var(--tt-surface);
    overflow: hidden;
    box-shadow: var(--tt-shadow);
    transition:
        border-color var(--tt-transition),
        box-shadow var(--tt-transition);
}

.tt-buy-card--no-media {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "body"
        "action";
}

@media (hover: hover) and (pointer: fine) {
    .tt-buy-card:hover {
        border-color: var(--tt-border-strong);
        box-shadow: var(--tt-shadow-hover);
    }
}

.tt-buy-card.is-selected {
    border-color: var(--tt-accent);
    box-shadow: var(--tt-shadow-hover), 0 0 0 1px var(--tt-accent-soft);
}

.tt-buy-card.is-unavailable {
    border-style: dashed;
}

.tt-buy-card.is-unavailable .tt-buy-card__media-inner img {
    filter: grayscale(0.85) brightness(0.72);
}

.tt-buy-card.is-unavailable .tt-buy-card__title,
.tt-buy-card.is-unavailable .tt-buy-desc__text,
.tt-buy-card.is-unavailable .tt-buy-card__price {
    opacity: 0.72;
}

.tt-buy-card__media {
    grid-area: media;
    position: relative;
    background: var(--tt-surface-2);
    align-self: stretch;
}

.tt-buy-card__media-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
}

@supports (aspect-ratio: 1) {
    .tt-buy-card__media-inner {
        aspect-ratio: var(--tt-media-ratio);
        min-height: auto;
        height: auto;
    }

    .tt-buy-card--no-media .tt-buy-card__media-inner {
        aspect-ratio: auto;
    }
}

.tt-buy-card__media-inner::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--tt-transition);
}

@media (hover: hover) and (pointer: fine) {
    .tt-buy-card:hover .tt-buy-card__media-inner::after,
    .tt-buy-card.is-selected .tt-buy-card__media-inner::after {
        opacity: 1;
    }
}

.tt-buy-card__media-inner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.tt-buy-card__media-inner img.tt-buy-card__img--default {
    object-fit: contain;
    object-position: center;
    padding: clamp(14px, 16%, 32px);
    box-sizing: border-box;
    background: var(--tt-surface-2);
}

.tt-buy-card.is-unavailable .tt-buy-card__media-inner img.tt-buy-card__img--default {
    filter: grayscale(0.65) opacity(0.75);
}

@supports not (aspect-ratio: 1) {
    .tt-buy-card__media-inner img {
        min-height: 140px;
    }
}

.tt-buy-card__media-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 140px;
    color: var(--tt-text-subtle);
    font-size: clamp(1.5rem, 5vw, 2rem);
    background: linear-gradient(135deg, var(--tt-surface-2) 0%, var(--tt-surface-action) 100%);
}

/* —— Cuerpo —— */
.tt-buy-card__body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1vw, 6px);
    min-width: 0;
    padding: var(--tt-pad-y) var(--tt-pad-x) clamp(8px, 1.5vw, 12px);
}

.tt-buy-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.tt-buy-card__title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--tt-title-size);
    font-weight: 600;
    line-height: 1.3;
    color: var(--tt-text) !important;
    overflow-wrap: anywhere;
}

.tt-buy-card__status {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

/* Descripción colapsable — paso 1 boletería */
.tt-buy-desc {
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.tt-buy-desc__body {
    position: relative;
}

.tt-buy-desc__text {
    margin: 0;
    font-size: clamp(0.8125rem, 2.2vw, 0.875rem);
    line-height: 1.6;
    color: var(--tt-text-muted) !important;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.tt-buy-desc:not(.is-expanded) .tt-buy-desc__text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--tt-desc-lines);
    overflow: hidden;
}

.tt-buy-desc.is-expanded .tt-buy-desc__text {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    max-height: none;
}

.tt-buy-desc:not(.is-expanded) .tt-buy-desc__body::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.75em;
    background: linear-gradient(180deg, transparent 0%, var(--tt-surface) 78%);
    pointer-events: none;
}

.tt-buy-desc.is-expanded .tt-buy-desc__body::after {
    display: none;
}

.tt-buy-desc__action {
    appearance: none;
    margin: 2px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: clamp(0.8125rem, 2.2vw, 0.875rem);
    font-weight: 600;
    line-height: 1.4;
    color: var(--tt-accent) !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    white-space: nowrap;
    text-align: right;
}

.tt-buy-desc__action:hover,
.tt-buy-desc__action:focus {
    text-decoration: underline;
    outline: none;
}

.tt-buy-desc__action:focus-visible {
    outline: 2px solid var(--tt-accent-ring);
    outline-offset: 2px;
    border-radius: 2px;
}

.tt-buy-card__meta {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}

.tt-buy-card__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 8px;
    font-size: clamp(0.8125rem, 2.2vw, 0.875rem);
    color: var(--tt-text) !important;
    line-height: 1.45;
}

.tt-buy-card__price-label {
    color: var(--tt-text-muted) !important;
    font-weight: 500;
    flex: 0 0 auto;
}

.tt-buy-card__price-value {
    font-size: clamp(0.95rem, 2.6vw, 1.05rem);
    font-weight: 700;
    color: var(--tt-accent) !important;
    white-space: nowrap;
}

.tt-buy-card__price-fee {
    flex: 1 1 auto;
    color: var(--tt-text-muted) !important;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.tt-buy-card__price-fee a {
    color: var(--tt-text-subtle) !important;
}

.tt-buy-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.tt-buy-card__badge--soldout {
    color: var(--tt-danger) !important;
    background: var(--tt-danger-soft);
}

.tt-buy-card__badge--selected {
    color: var(--tt-accent) !important;
    background: var(--tt-accent-soft);
}

/* —— Acción (cantidad) —— */
.tt-buy-card__action {
    grid-area: action;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 var(--tt-pad-x) var(--tt-pad-y);
    background: transparent;
    border: 0;
}

.tt-buy-card__qty {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 200px;
    margin-left: auto;
}

.tt-buy-card__qty label {
    margin: 0;
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tt-text-muted) !important;
    white-space: nowrap;
}

.tt-buy .tt-buy-card__qty .form-control {
    flex: 1 1 auto;
    min-width: 0;
    min-height: var(--tt-touch);
    height: var(--tt-touch);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--tt-border);
    background: var(--tt-surface);
    color: var(--tt-text) !important;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    box-shadow: none;
    transition:
        border-color var(--tt-transition),
        box-shadow var(--tt-transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7385' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.tt-buy .tt-buy-card__qty .form-control:hover:not(:disabled) {
    border-color: var(--tt-border-strong);
}

.tt-buy .tt-buy-card__qty .form-control:focus {
    border-color: var(--tt-accent);
    box-shadow: 0 0 0 3px var(--tt-accent-ring);
    outline: none;
}

.tt-buy .tt-buy-card__qty .form-control:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

body.dark-mode .tt-buy .tt-buy-card__qty .form-control,
.dark-mode .tt-buy .tt-buy-card__qty .form-control {
    background-color: var(--tt-surface-2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa3b5' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

body.dark-mode .tt-buy .tt-buy-card__qty .form-control option,
.dark-mode .tt-buy .tt-buy-card__qty .form-control option {
    background: #1c1f2f;
    color: #f0f2f6;
}

/* —— Continuar —— */
.tt-buy-continue {
    clear: both;
    display: block;
    margin-top: 24px;
    margin-bottom: 12px;
    text-align: right;
}

.tt-buy-continue .btn-primary {
    float: none;
}

/* —— Vacío / skeleton —— */
.tt-buy-empty {
    padding: clamp(20px, 5vw, 32px) var(--tt-pad-x);
    border: 1px dashed var(--tt-border);
    border-radius: var(--tt-radius);
    text-align: center;
    color: var(--tt-text-muted) !important;
    background: var(--tt-surface-2);
    font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.tt-buy-skeleton-list {
    display: flex;
    flex-direction: column;
    gap: var(--tt-gap);
}

.tt-buy-skeleton-card {
    display: grid;
    grid-template-columns: var(--tt-media-width) minmax(0, 1fr);
    grid-template-areas:
        "media body"
        "media action";
    border-radius: var(--tt-radius);
    border: 1px solid var(--tt-border);
    overflow: hidden;
    background: var(--tt-surface);
    min-height: 120px;
}

.tt-buy-skeleton-card__media {
    grid-area: media;
}

.tt-buy-skeleton-card__body {
    grid-area: body;
    padding: var(--tt-pad-y) var(--tt-pad-x);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tt-buy-skeleton-card__action {
    grid-area: action;
    padding: 0 var(--tt-pad-x) var(--tt-pad-y);
}

.tt-buy-skeleton-card__media,
.tt-buy-skeleton-card__line,
.tt-buy-skeleton-card__block {
    background: linear-gradient(
        90deg,
        var(--tt-surface-2) 0%,
        var(--tt-surface-action) 45%,
        var(--tt-surface-2) 90%
    );
    background-size: 220% 100%;
    animation: tt-buy-shimmer 1.35s ease-in-out infinite;
}

.tt-buy-skeleton-card__line {
    height: 14px;
    border-radius: 6px;
}

.tt-buy-skeleton-card__line--title {
    width: min(55%, 220px);
    height: 18px;
}

.tt-buy-skeleton-card__line--short {
    width: min(38%, 140px);
}

@keyframes tt-buy-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ══════════════════════════════════════════
   BREAKPOINTS
   ══════════════════════════════════════════ */

/* Desktop ancho: 3 columnas en una fila */
@media (min-width: 992px) {
    .tt-buy {
        --tt-media-width: 220px;
        --tt-desc-lines: 5;
    }

    .tt-buy-card {
        grid-template-columns: var(--tt-media-width) minmax(0, 1fr) auto;
        grid-template-rows: 1fr;
        grid-template-areas: "media body action";
    }

    .tt-buy-card--no-media {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "body action";
    }

    .tt-buy-card__body {
        padding: var(--tt-pad-y) var(--tt-pad-x);
    }

    .tt-buy-card__action {
        flex-direction: column;
        justify-content: center;
        align-self: stretch;
        min-width: 132px;
        padding: var(--tt-pad-y);
        background: var(--tt-surface-action);
        border-left: 1px solid var(--tt-border);
    }

    .tt-buy-card__qty {
        flex-direction: column;
        align-items: stretch;
        max-width: none;
        margin-left: 0;
    }

    .tt-buy-card__qty label {
        text-align: center;
    }

    .tt-buy-skeleton-card {
        grid-template-columns: 220px minmax(0, 1fr) 108px;
        grid-template-areas: "media body action";
        grid-template-rows: 1fr;
    }

    .tt-buy-skeleton-card__action {
        border-left: 1px solid var(--tt-border);
        background: var(--tt-surface-action);
        min-height: 100%;
    }
}

/* Tablet: imagen + contenido, cantidad en barra inferior */
@media (min-width: 576px) and (max-width: 991px) {
    .tt-buy {
        --tt-media-width: min(168px, 28vw);
        --tt-media-ratio: 4 / 5;
    }

    .tt-buy-card {
        grid-template-columns: var(--tt-media-width) minmax(0, 1fr);
        grid-template-areas:
            "media body"
            "action action";
    }

    .tt-buy-card--no-media {
        grid-template-areas:
            "body"
            "action";
    }

    .tt-buy-card__action {
        justify-content: space-between;
        padding: 12px var(--tt-pad-x) var(--tt-pad-y);
        background: var(--tt-surface-action);
        border-top: 1px solid var(--tt-border);
    }

    .tt-buy-card__qty {
        max-width: 240px;
    }

    .tt-buy-skeleton-card {
        grid-template-areas:
            "media body"
            "action action";
    }

    .tt-buy-skeleton-card__action {
        min-height: 52px;
        border-top: 1px solid var(--tt-border);
        background: var(--tt-surface-action);
    }
}

/* Móvil: stack completo + barra de acción integrada */
@media (max-width: 575px) {
    .tt-buy {
        --tt-media-ratio: 16 / 9;
        --tt-desc-lines: 3;
        --tt-gap: 12px;
    }

    .tt-buy-card,
    .tt-buy-skeleton-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "media"
            "body"
            "action";
    }

    .tt-buy-card--no-media {
        grid-template-areas:
            "body"
            "action";
    }

    .tt-buy-card__body {
        padding-top: 14px;
    }

    .tt-buy-card__head {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .tt-buy-card__status {
        justify-content: flex-start;
    }

    .tt-buy-card__price-fee {
        flex-basis: auto;
    }

    .tt-buy-card__action {
        justify-content: space-between;
        padding: 12px var(--tt-pad-x) 14px;
        background: var(--tt-surface-action);
        border-top: 1px solid var(--tt-border);
    }

    .tt-buy-card__qty {
        max-width: none;
        width: auto;
        margin-left: 0;
    }

    .tt-buy .tt-buy-card__qty .form-control {
        width: 80px;
        flex: 0 0 80px;
    }

    .tt-buy-skeleton-card__action {
        min-height: 52px;
        border-top: 1px solid var(--tt-border);
        background: var(--tt-surface-action);
    }
}

/* Pantallas muy estrechas */
@media (max-width: 359px) {
    .tt-buy {
        --tt-pad-x: 10px;
    }

    .tt-buy-card__qty label {
        font-size: 0.6875rem;
    }

    .tt-buy .tt-buy-card__qty .form-control {
        width: 72px;
        flex-basis: 72px;
        padding-right: 28px;
        font-size: 0.9375rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tt-buy-card,
    .tt-buy-card__media-inner::after,
    .tt-buy .tt-buy-card__qty .form-control {
        transition: none;
    }

    .tt-buy-skeleton-card__media,
    .tt-buy-skeleton-card__line,
    .tt-buy-skeleton-card__block {
        animation: none;
    }
}
