/**
 * MT Ticketing - Frontend Ticket Selector Styles
 *
 * @package MT_Ticketing
 * @since 0.4.0
 */

/* Container */
.mt-ticket-selector {
    max-width: 600px;
    margin: 0 auto;
    font-family: inherit;
}

/* Ticket Types List */
.mt-ticket-types {
    border-bottom: 1px solid var(--mt-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Single Ticket Type */
.mt-ticket-type {
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    background: var(--mt-surface);
    transition: background-color 0.2s ease;
}

.mt-ticket-type:hover {
    background: var(--mt-surface-soft);
}

.mt-ticket-type.mt-ticket-type--selected:not(.mt-sold-out) {
    border-color: var(--mt-primary);
    background: var(--mt-primary-soft);
}

/* Unavailable row (sold out, sale not started, sale ended, temporarily held).
   .mt-not-on-sale and .mt-sale-ended only name the sale-window reason.
   The name, description and price are dimmed, the state label stays readable. */
.mt-ticket-type.mt-sold-out,
.mt-ticket-type.mt-temporarily-held {
    background: var(--mt-surface-soft);
}

.mt-ticket-type.mt-sold-out .mt-ticket-info,
.mt-ticket-type.mt-sold-out .mt-ticket-price,
.mt-ticket-type.mt-temporarily-held .mt-ticket-info,
.mt-ticket-type.mt-temporarily-held .mt-ticket-price {
    opacity: 0.6;
}

.mt-ticket-type.mt-sold-out .mt-sold-out-label,
.mt-ticket-type.mt-temporarily-held .mt-sold-out-label {
    color: var(--mt-text-secondary);
}

/* Ticket Info */
.mt-ticket-info {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.ticket-price-qty-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mt-ticket-name {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--mt-text-primary);
}

.mt-ticket-description {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: var(--mt-text-secondary);
}

.mt-ticket-hold-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    margin: 16px 0 20px;
    padding: 16px;
    color: var(--mt-text-secondary);
    background: var(--mt-primary-soft);
    border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius-card);
}

.mt-ticket-hold-notice__icon {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    color: var(--mt-primary);
}

.mt-ticket-hold-notice__content {
    min-width: 0;
}

.mt-ticket-hold-notice__title {
    display: block;
    color: var(--mt-text-primary);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.mt-ticket-hold-notice__text {
    margin: 4px 0 0;
    color: var(--mt-text-secondary);
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.mt-ticket-hold-notice__hint {
    margin: 8px 0 0;
    color: var(--mt-text-muted);
    font-size: 13px;
    line-height: 1.4;
}

.mt-ticket-availability {
    display: inline-block;
    font-size: 12px;
    color: var(--mt-text-muted);
    background: var(--mt-surface-soft);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Ticket Price */
.mt-ticket-price {
    min-width: 100px;
    text-align: left;
    font-size: 18px;
    font-weight: 700;
    color: var(--mt-text-primary);
}

/* Quantity Selector */
.mt-ticket-quantity {
    min-width: 130px;
    text-align: right;
}


.mt-qty-wrapper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--mt-border-hover);
    border-radius: 6px;
    overflow: hidden;
    background: var(--mt-surface);
}

.mt-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 18px;
    font-weight: 500;
    color: var(--mt-text-primary);
    background: var(--mt-surface-soft);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
}

.mt-qty-btn:hover {
    background: var(--mt-border);
}

.mt-qty-btn:active {
    background: var(--mt-border-hover);
}

.mt-qty-btn:disabled {
    color: var(--mt-text-muted);
    cursor: not-allowed;
}

.mt-qty-minus {
    border-right: 1px solid var(--mt-border);
}

.mt-qty-plus {
    border-left: 1px solid var(--mt-border);
}

.mt-qty-input {
    width: 50px;
    height: 36px;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    background: var(--mt-surface);
    appearance: textfield;
    -moz-appearance: textfield;
}

.mt-qty-input::-webkit-outer-spin-button,
.mt-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mt-qty-input:focus {
    outline: none;
    background: var(--mt-surface-soft);
}

/* Keep old select for fallback/deprecated */
.mt-qty-select {
    width: 70px;
    padding: 8px 12px;
    font-size: 16px;
    border: 1px solid var(--mt-border-hover);
    border-radius: 4px;
    background: var(--mt-surface);
    cursor: pointer;
    text-align: center;
}

.mt-qty-select:focus {
    border-color: var(--mt-primary);
    outline: none;
    box-shadow: var(--mt-focus-ring);
}

.mt-sold-out-label {
    display: inline-block;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--mt-text-muted);
    background: var(--mt-surface-soft);
    border-radius: 4px;
}

/* Summary Section */
.mt-ticket-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: transparent;
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    flex-direction: column;
    gap: 20px;
}

.mt-total {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mt-total-label {
    font-size: 16px;
    color: var(--mt-text-secondary);
}

.mt-total-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--mt-text-primary);
}

/* Add to Cart Button */
.mt-add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    color: var(--mt-text-on-dark);
    background: var(--mt-primary);

    border: none;
    border-radius: var(--mt-radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mt-add-to-cart-btn:hover:not(:disabled) {
    background: var(--mt-primary-hover);
;
}

.mt-add-to-cart-btn:disabled {
    background: var(--mt-border-hover);
    cursor: not-allowed;
}

.mt-add-to-cart-btn.mt-loading {
    position: relative;
    color: transparent;
}

.mt-add-to-cart-btn.mt-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--mt-text-on-dark);
    border-radius: 50%;
    animation: mt-spin 0.8s linear infinite;
}

.mt-add-to-cart-btn.mt-success {
    background: var(--mt-success);
}

@keyframes mt-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Messages */
.mt-messages {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

.mt-messages.mt-success {
    background: var(--mt-primary-soft);
    color: var(--mt-text-primary);
    border: 1px solid var(--mt-primary);
}

/* The check mark lives here and not in the message string: showMessage() replaces
   the container's html(), so a glyph in the text would have to be repeated at every
   call site and would end up in the translations. */
.mt-messages.mt-success::before {
    content: "\2713";
    margin-right: 6px;
    color: var(--mt-primary);
    font-weight: 700;
}

.mt-messages__actions {
    display: flex;
    gap: 16px;
    margin-top: 6px;
}

.mt-messages.mt-error {
    background: var(--mt-error-soft);
    color: var(--mt-error-text);
    border: 1px solid var(--mt-error);
}

.mt-messages a {
    color: inherit;
    font-weight: 600;
}

/* Error/Notice Messages */
.mt-error,
.mt-notice {
    padding: 16px 20px;
    border-radius: 6px;
    font-size: 14px;
}

.mt-error {
    background: var(--mt-error-soft);
    color: var(--mt-error-text);
    border: 1px solid var(--mt-error);
}

.mt-notice {
    background: var(--mt-warning-soft);
    color: var(--mt-warning-text);
    border: 1px solid var(--mt-warning);
}

/* Compact Style */
.mt-ticket-selector[data-style="compact"] .mt-ticket-type {
    padding: 12px 16px;
    
}

.mt-ticket-selector[data-style="compact"] .mt-ticket-name {
    font-size: 14px;
}

.mt-ticket-selector[data-style="compact"] .mt-ticket-price {
    font-size: 16px;
    padding: 0 12px;
}

.mt-ticket-selector[data-style="compact"] .mt-qty-btn {
    width: 30px;
    height: 30px;
    font-size: 16px;
}

.mt-ticket-selector[data-style="compact"] .mt-qty-input {
    width: 40px;
    height: 30px;
    font-size: 14px;
}

.mt-ticket-selector[data-style="compact"] .mt-qty-select {
    width: 60px;
    padding: 6px 8px;
    font-size: 14px;
}

/* Minimal Style */
.mt-ticket-selector[data-style="minimal"] .mt-ticket-types {
    border: none;
    border-radius: 0;
}

.mt-ticket-selector[data-style="minimal"] .mt-ticket-type {
    border-bottom: 1px solid var(--mt-border);
    padding: 10px 0;
}

.mt-ticket-selector[data-style="minimal"] .mt-ticket-summary {
    background: none;
    border: none;
    padding: 16px 0;
}

/* Responsive */
@media (max-width: 600px) {
    .mt-ticket-type {
        flex-wrap: wrap;
        gap: 12px;
    }

    .mt-ticket-info {
        width: 100%;
    }

    .mt-ticket-price {
        padding: 0;
        font-size: 16px;
    }

    .mt-ticket-quantity {
        min-width: auto;
    }

    .mt-ticket-summary {
        flex-direction: column;
        gap: 16px;
    }

    .mt-add-to-cart-btn {
        width: 100%;
    }
}

/* ===========================
   Seating Section (v0.8.0)
   =========================== */

.mt-seating-section {
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--mt-surface);
}

.mt-seating-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}

.mt-seating-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--mt-text-primary);
}

.mt-open-seating-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--mt-text-on-dark);
    background: var(--mt-primary);
    border: none;
    border-radius: var(--mt-radius-pill);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mt-open-seating-btn:hover:not(:disabled) {
    background: var(--mt-primary-hover);
}

.mt-open-seating-btn:disabled {
    background: var(--mt-border-hover);
    cursor: not-allowed;
    color: var(--mt-text-muted);
}

.mt-seating-summary-text {
    padding: 0 20px 12px;
    font-size: 13px;
    color: var(--mt-text-secondary);
}

/* Seating tickets injected into form */
.mt-seating-tickets {
    margin-bottom: 16px;
}

/* ===========================
   Seating Modal (v0.8.0)
   =========================== */

.mt-seating-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
}

.mt-seating-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.mt-seating-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(1200px, 92vw);
    max-height: 92vh;
    overflow-y: auto;
    background: var(--mt-surface);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: mt-modal-in 0.25s ease-out;
}

@keyframes mt-modal-in {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.mt-seating-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 1;
    color: var(--mt-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mt-seating-modal-close:hover {
    background: var(--mt-surface-soft);
    color: var(--mt-text-primary);
}

.mt-seating-modal-title {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--mt-text-primary);
}

/* ===========================
   Gallery Slider (CSS-only with JS nav)
   =========================== */

.mt-seating-gallery {
    position: relative;
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--mt-surface-soft);
}

.mt-seating-gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.mt-seating-gallery-track::-webkit-scrollbar {
    display: none;
}

.mt-seating-gallery-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

.mt-gallery-lightbox-link {
    display: block;
    cursor: zoom-in;
}

/* Keep PhotoSwipe controls visible even with aggressive theme button resets. */
.pswp .pswp__button--close {
    display: block !important;
    opacity: 1;
}

/* Prevent aggressive theme img rules (max-width:100%) from collapsing
 * PhotoSwipe slide images when the zoom-wrap has auto width. */
.pswp .pswp__img {
    max-width: none !important;
    width: auto !important;
}

.mt-seating-gallery-slide img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 700px;
}

.mt-gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    font-size: 28px;
    line-height: 1;
    color: var(--mt-text-on-dark);
    background: rgba(0, 0, 0, 0.45);
    border: none;
    border-radius: var(--mt-radius-pill);
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 2;
}

.mt-gallery-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.mt-gallery-prev {
    left: 8px;
}

.mt-gallery-next {
    right: 8px;
}

.mt-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.8);
}

.mt-gallery-dot {
    width: 10px;
    height: 10px;
    background: var(--mt-border-hover);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease;
}

.mt-gallery-dot.active {
    background: var(--mt-primary);
}

/* ===========================
   Seating Table Selector
   =========================== */

.mt-seating-selector {
    margin-bottom: 20px;
}

.mt-seating-select-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.mt-seating-select-wrapper {
    flex: 1;
    min-width: 200px;
    width: 100%;
}

.mt-seating-select-wrapper label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.mt-seating-table-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid var(--mt-border-hover);
    border-radius: 6px;
    background: var(--mt-surface);
    cursor: pointer;
}

.mt-seating-table-select:focus {
    border-color: var(--mt-primary);
    outline: none;
    box-shadow: var(--mt-focus-ring);
}

.mt-seating-qty-button-wrapper {
    display: inline-flex;
    align-items: flex-start;
    gap: 30px;
    width: 300px;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

.mt-seating-qty-info-wrapper {
    display: inline-block;
    font-size: 13px;
    color: var(--mt-text-secondary);
}

.mt-seating-qty-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mt-seating-qty-wrapper label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.mt-seating-price-info {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--mt-text-secondary);
}

.mt-seating-add-table-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--mt-primary);
    background: transparent;
    border: 2px solid var(--mt-primary);
    border-radius: var(--mt-radius-pill);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mt-seating-add-table-btn:hover {
    background: var(--mt-primary);
    color: var(--mt-text-on-dark);
}

/* ===========================
   Selections List
   =========================== */

.mt-seating-selections {
    margin-bottom: 20px;
}

.mt-seating-selections h4 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--mt-text-primary);
}

.mt-seating-selections-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mt-seating-selections-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--mt-border);
    font-weight: 600;
    color: var(--mt-text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mt-seating-selections-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--mt-surface-soft);
    vertical-align: middle;
}

.mt-seating-remove-btn {
    padding: 4px 10px;
    font-size: 12px;
    color: var(--mt-error);
    background: transparent;
    border: 1px solid var(--mt-error);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mt-seating-remove-btn:hover {
    background: var(--mt-error);
    color: var(--mt-text-on-dark);
}

/* ===========================
   Modal Footer
   =========================== */

.mt-seating-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--mt-border);
}

.mt-seating-save-btn {
    min-width: 160px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--mt-text-on-dark);
    background: var(--mt-primary);
    border: none;
    border-radius: var(--mt-radius-pill);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mt-seating-save-btn:hover:not(:disabled) {
    background: var(--mt-primary-hover);
}

.mt-seating-save-btn:disabled {
    background: var(--mt-border-hover);
    cursor: not-allowed;
}

/* ===========================
   Responsive — Modal
   =========================== */

@media (max-width: 600px) {
    .mt-seating-modal-content {
        width: 96vw;
        padding: 20px;
        max-height: 96vh;
    }

    .mt-seating-select-row {
        flex-direction: column;
        gap: 12px;
    }

    .mt-seating-select-wrapper,
    .mt-seating-qty-wrapper {
        min-width: 100%;
    }

    .mt-seating-header {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .mt-open-seating-btn {
        width: 100%;
        justify-content: center;
    }

    .mt-gallery-btn {
        width: 32px;
        height: 32px;
        font-size: 22px;
    }

    .mt-seating-gallery-slide img {
        max-height: 250px;
    }
}
