/*
 * Eventiva theme contract.
 *
 * Public --ef-* tokens may be declared by a theme on :root or on any Eventiva
 * ancestor. The internal tokens below resolve those overrides first, then use
 * common theme.json preset slugs, and finally fall back to neutral system
 * colors. Eventiva deliberately does not declare generic tokens on :root.
 */
:where(
    .ef-single-container,
    .ef-archive-container,
    .ef-event-card,
    .ef-booking-widget,
    .evento-turnos-buttons,
    .ef-waitlist,
    .ef-waitlist-product-page,
    .eventos-cortesia-section
) {
    --ef-color-primary: var(
        --ef-primary,
        var(--wp--preset--color--contrast, CanvasText)
    );
    --ef-color-primary-hover: var(
        --ef-primary-hover,
        color-mix(in srgb, var(--ef-color-primary), CanvasText 18%)
    );
    --ef-color-on-primary: var(
        --ef-on-primary,
        var(--wp--preset--color--base, Canvas)
    );
    --ef-color-text: var(--ef-text, currentColor);
    --ef-color-text-muted: var(
        --ef-text-muted,
        color-mix(in srgb, currentColor 64%, transparent)
    );
    --ef-color-surface: var(--ef-surface, transparent);
    --ef-color-surface-muted: var(
        --ef-surface-muted,
        color-mix(in srgb, currentColor 5%, transparent)
    );
    --ef-color-surface-hover: var(
        --ef-surface-hover,
        color-mix(in srgb, currentColor 9%, transparent)
    );
    --ef-color-border: var(
        --ef-border,
        color-mix(in srgb, currentColor 20%, transparent)
    );
    --ef-color-success: var(
        --ef-success,
        var(--wp--preset--color--vivid-green-cyan, currentColor)
    );
    --ef-color-danger: var(
        --ef-danger,
        var(--wp--preset--color--vivid-red, currentColor)
    );
    --ef-resolved-radius: var(--ef-radius, 0.5rem);
    --ef-resolved-shadow: var(
        --ef-shadow,
        0 0.25rem 0.75rem color-mix(in srgb, currentColor 12%, transparent)
    );
}

/* Base Container */
.ef-single-container,
.ef-archive-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
    color: var(--ef-color-text);
}

/* Event List (Archive) - Responsive Card */
.ef-event-card {
    display: flex;
    flex-direction: column;
    background: var(--ef-color-surface);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-resolved-radius);
    overflow: hidden;
    margin-bottom: 30px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ef-event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ef-resolved-shadow);
}

@media (min-width: 768px) {
    .ef-event-card {
        flex-direction: row;
    }

    .ef-event-card-image {
        flex: 0 0 300px;
        max-width: 300px;
    }
}

.ef-event-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: 1.5rem;
}

.ef-event-list-grid .ef-event-card {
    flex-direction: column;
    margin-bottom: 0;
}

.ef-event-list-grid .ef-event-card-image {
    flex-basis: auto;
    max-width: none;
}

.ef-event-card-image a {
    display: block;
    height: 100%;
}

.ef-event-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 200px;
    display: block;
}

.ef-event-card-image .placeholder {
    width: 100%;
    height: 100%;
    min-height: 200px;
    background-color: var(--ef-color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ef-color-text-muted);
}

.ef-event-card-content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.ef-event-card-content .ef-event-card-title {
    margin: 0 0 10px;
    font-size: 1.5rem;
    line-height: 1.3;
}

.ef-event-card-content .ef-event-card-title a {
    text-decoration: none;
    color: var(--ef-color-text);
}

.ef-event-card-content .ef-event-card-title a:hover {
    color: var(--ef-color-primary);
}

.ef-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    color: var(--ef-color-text-muted);
    font-size: 0.95rem;
}

.ef-event-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ef-event-card-date,
.ef-event-card-price,
.ef-event-card-urgency {
    min-width: 0;
}

.ef-event-card-content .entry-summary {
    flex-grow: 1;
    margin-bottom: 20px;
    line-height: 1.6;
}

.ef-event-footer .ef-button {
    display: inline-block;
    padding: 10px 24px;
    background-color: var(--ef-color-primary);
    color: var(--ef-color-on-primary);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
}

.ef-event-footer .ef-button:hover {
    background-color: var(--ef-color-primary-hover);
}

/* Single Event Page */
.ef-header {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--ef-color-border);
    padding-bottom: 20px;
}

.ef-header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--ef-color-text);
}

.ef-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

.ef-grid > .ef-main,
.ef-grid > .ef-sidebar {
    min-width: 0;
}

@media (min-width: 992px) {
    .ef-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* Main Content Area */
.ef-main .ef-thumbnail {
    margin-bottom: 30px;
    border-radius: var(--ef-resolved-radius);
    overflow: hidden;
}

.ef-main .ef-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.ef-single-container .entry-content {
    line-height: 1.8;
    color: var(--ef-color-text);
}

.ef-location-map {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--ef-color-border);
}

.ef-location-map h3 {
    margin-bottom: 20px;
}

.ef-google-maps-link {
    display: block;
    padding: 40px 20px;
    background: var(--ef-color-surface-muted);
    border-radius: var(--ef-resolved-radius);
    text-align: center;
    text-decoration: none;
    color: var(--ef-color-primary);
    transition: background 0.2s;
}

.ef-google-maps-link:hover {
    background: var(--ef-color-surface-hover);
}

.ef-google-maps-link .icon {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* Sidebar & Booking Widget */
.ef-sidebar {
    position: relative;
}

.ef-booking-widget {
    background: var(--ef-color-surface-muted);
    width: 100%;
    max-width: 100%;
    padding: clamp(1.125rem, 2vw, 1.5rem);
    border-radius: var(--ef-resolved-radius);
    border: 1px solid var(--ef-color-border);
    position: sticky;
    top: 20px;
    box-sizing: border-box;
}

.ef-booking-widget *,
.ef-booking-widget *::before,
.ef-booking-widget *::after {
    box-sizing: border-box;
}

.single-product.eventiva-product-unavailable form.cart,
.single-product.eventiva-product-unavailable .variations_form,
.single-product.eventiva-product-unavailable .wp-block-add-to-cart-form,
.single-product.eventiva-product-unavailable .wp-block-woocommerce-add-to-cart-form {
    display: none !important;
}

.ef-booking-widget h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: clamp(1.2rem, 2vw, 1.4rem);
    line-height: 1.25;
    color: var(--ef-color-text);
}

.ef-price-info {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--ef-color-border);
    color: var(--ef-color-text);
}

.ef-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
}

.ef-price-label {
    font-size: 0.875rem;
    color: var(--ef-color-text-muted);
}

.ef-price-value {
    color: var(--ef-color-primary);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.3;
    text-align: right;
    white-space: nowrap;
}

.ef-event-details-list {
    font-size: 0.95rem;
    color: var(--ef-color-text-muted);
}

.ef-event-details-list p {
    margin-bottom: 15px;
}

.ef-event-details-list strong {
    color: var(--ef-color-text);
    display: block;
    margin-bottom: 4px;
}

.ef-ticket-actions {
    margin: 0;
}

.ef-ticket-actions > :first-child {
    margin-top: 0;
}

.ef-ticket-actions > :last-child {
    margin-bottom: 0;
}

/* Cortesia section */
.eventos-cortesia-section {
    margin: 20px 0;
    padding: 20px;
    background: var(--ef-color-surface-muted);
    border-radius: var(--ef-resolved-radius);
    border: 1px solid var(--ef-color-border);
}

.eventos-cortesia-section h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: var(--ef-color-text);
}

.eventos-cortesia-section .ef-cortesia-description {
    font-size: 13px;
    color: var(--ef-color-text-muted);
    margin-bottom: 15px;
}

.ef-cortesia-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ef-cortesia-controls select {
    padding: 8px 12px;
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-resolved-radius);
    font-size: 14px;
    min-width: 150px;
}

.ef-cortesia-controls button {
    padding: 8px 16px;
    background: var(--ef-color-primary);
    color: var(--ef-color-on-primary);
    border: none;
    border-radius: var(--ef-resolved-radius);
    cursor: pointer;
    font-size: 14px;
}

.ef-cortesia-controls button:hover {
    background: var(--ef-color-primary-hover);
}

.ef-cortesia-controls button:disabled {
    background: var(--ef-color-surface-hover);
    color: var(--ef-color-text-muted);
    cursor: not-allowed;
}

.ef-cortesia-note {
    font-size: 12px;
    color: var(--ef-color-text-muted);
    margin-top: 10px;
}

.ef-cortesia-message {
    padding: 8px 12px;
    border-radius: var(--ef-resolved-radius);
    margin-top: 10px;
    display: none;
}

.ef-cortesia-message.success {
    background: color-mix(in srgb, var(--ef-color-success) 12%, transparent);
    color: var(--ef-color-success);
    border: 1px solid color-mix(in srgb, var(--ef-color-success) 35%, transparent);
    display: block;
}

.ef-cortesia-message.error {
    background: color-mix(in srgb, var(--ef-color-danger) 12%, transparent);
    color: var(--ef-color-danger);
    border: 1px solid color-mix(in srgb, var(--ef-color-danger) 35%, transparent);
    display: block;
}

/* Shift selector */
.evento-turnos-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.evento-turnos-buttons .turno-option {
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-resolved-radius);
    padding: clamp(0.875rem, 2vw, 1rem);
    background: var(--ef-color-surface);
}

.evento-turnos-buttons .turno-option.esgotado {
    opacity: 0.6;
}

.evento-turnos-buttons .turno-header {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
    margin-bottom: 0.35rem;
}

.evento-turnos-buttons .turno-spots {
    color: var(--ef-color-text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 0.875rem;
}

.evento-turnos-buttons .turno-spots.esgotado,
.ef-out-of-stock,
.ef-ticket-actions .out-of-stock {
    color: var(--ef-color-danger);
}

/* WooCommerce purchase form inside the compact booking panel. */
.ef-booking-widget .variations_form,
.ef-booking-widget .variations,
.ef-booking-widget .variations tbody,
.ef-booking-widget .variations tr {
    display: block;
    width: 100%;
    margin: 0;
}

.ef-booking-widget .variations {
    border: 0;
}

.ef-booking-widget .variations tr {
    display: grid;
    gap: 0.375rem;
}

.ef-booking-widget .variations th,
.ef-booking-widget .variations td {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    text-align: left;
}

.ef-booking-widget .variations label {
    display: block;
    margin: 0;
    color: var(--ef-color-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
}

.ef-booking-widget .variations select,
.ef-booking-widget .quantity .qty {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--ef-color-border);
    border-radius: calc(var(--ef-resolved-radius) * 0.75);
    background: var(--ef-color-surface);
    color: var(--ef-color-text);
    font: inherit;
    line-height: 1.2;
}

.ef-booking-widget .reset_variations {
    display: inline-block;
    margin-top: 0.375rem;
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
}

.ef-booking-widget .single_variation_wrap {
    margin-top: 0.875rem;
}

.ef-booking-widget .woocommerce-variation-price {
    min-height: 0;
    margin: 0 0 0.625rem;
    color: var(--ef-color-primary);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: right;
}

.ef-booking-widget .woocommerce-variation-price .price {
    color: inherit;
    font: inherit;
}

.ef-booking-widget .woocommerce-variation-add-to-cart {
    display: grid;
    grid-template-columns: minmax(4.5rem, 5.5rem) minmax(0, 1fr);
    gap: 0.625rem;
    align-items: stretch;
    width: 100%;
}

.ef-booking-widget .quantity,
.ef-booking-widget .single_add_to_cart_button {
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
}

.ef-booking-widget .single_add_to_cart_button,
.ef-booking-widget .ef-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    border: 0;
    border-radius: var(--ef-resolved-radius);
    background: var(--ef-color-primary);
    color: var(--ef-color-on-primary);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.ef-booking-widget .single_add_to_cart_button:hover,
.ef-booking-widget .ef-button:hover {
    background: var(--ef-color-primary-hover);
}

.ef-booking-widget .single_add_to_cart_button:focus-visible,
.ef-booking-widget .ef-button:focus-visible,
.ef-booking-widget .variations select:focus-visible,
.ef-booking-widget .quantity .qty:focus-visible {
    outline: 2px solid var(--ef-color-primary);
    outline-offset: 2px;
}

.ef-booking-widget .single_add_to_cart_button:active,
.ef-booking-widget .ef-button:active {
    transform: translateY(1px);
}

.ef-booking-widget .ef-stock-info {
    margin: 0.75rem 0 0;
    color: var(--ef-color-text-muted);
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 991px) {
    .ef-booking-widget {
        position: static;
        max-width: 38rem;
        margin-inline: auto;
    }
}

/* Waitlist components */
.ef-waitlist,
.ef-waitlist-product-page {
    font-family: inherit;
}

.ef-waitlist {
    margin-top: 10px;
}

.ef-waitlist-product-page {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--ef-color-border);
}

.ef-waitlist__details summary {
    cursor: pointer;
    list-style: none;
}

.ef-waitlist__details summary::-webkit-details-marker {
    display: none;
}

.ef-waitlist__form {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.ef-waitlist__field {
    margin: 0;
}

.ef-waitlist__notice {
    padding: 10px 12px;
    border-radius: var(--ef-resolved-radius);
    font-size: 13px;
}

.ef-waitlist__notice--success {
    background: color-mix(in srgb, var(--ef-color-success) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--ef-color-success) 35%, transparent);
}

/* Suppress theme publish-date block (and its "·" separator) on the /eventos archive. */
.post-type-archive-evento .wp-block-group:has(> .wp-block-post-date) {
    display: none;
}

.ef-waitlist__notice--error {
    background: color-mix(in srgb, var(--ef-color-danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--ef-color-danger) 35%, transparent);
}
