/**
 * TBC Woo Events — Single event / series page styles
 *
 * Skins the single-product event page (details rows, map, price card, RSVP
 * line), the series "pick-a-date" page (header + shared card list), the
 * progress bar, the waitlist notices + "My Waitlists" list, and the product
 * extra-tabs frontend (FAQ accordion + content tabs).
 *
 * Built on Fluent Community's --fcom-* variables (with FC's default-schema
 * fallbacks); the only explicit dark rules use `html.dark` (FC toggles that
 * class on the root). Loaded alongside calendar.css, so the series card list
 * reuses the shared .tbc-wc-calendar list-card styles defined there.
 */

/* ===== EVENT DETAIL ROWS ===== */

/* Date/time, location, price, RSVP — each a bordered card row */
.tbc-wc-event-details-location,
.tbc-wc-event-details-price,
.tbc-wc-event-details-time,
.tbc-wc-event-details-rsvp {
    background-color: var(--fcom-primary-bg, #ffffff);
    border: 1px solid var(--fcom-primary-border, #e3e8ee);
    border-radius: 8px;
    padding: 10px;
    color: var(--fcom-primary-text, #19283a);
    font-weight: 500;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 10px;
}

/* Text wrappers (time / location / rsvp) lay icon beside text */
.tbc-wc-event-details-location .tbc-wc-location-text,
.tbc-wc-event-details-time .tbc-wc-time-text,
.tbc-wc-event-details-rsvp .tbc-wc-rsvp-text {
    display: flex;
    align-items: flex-start;
}

.tbc-wc-event-details-location .tbc-wc-icon,
.tbc-wc-event-details-time .tbc-wc-icon,
.tbc-wc-event-details-rsvp .tbc-wc-icon,
.tbc-wc-event-details-price .tbc-wc-icon {
    margin-right: 8px;
    flex-shrink: 0;
}

/* ===== PRICE CARD ===== */

/* Custom event price card. NOT flex on purpose: WooCommerce's price HTML
   is a run of inline elements and text nodes ("$440" + " + " + the deposit
   suffix from the donations plugin) — flex drops the whitespace between
   them and glues the fragments together ("$440+$100Deposit"). Normal
   inline flow keeps the spaces; the inline-block icon provides the gap. */
.tbc-wc-event-details-price {
    font-weight: bold;
}

.tbc-wc-event-details-price .woocommerce-Price-amount,
.tbc-wc-event-details-price .amount {
    display: inline;
}

/* WooCommerce default price (non-event context / fallback) */
.price {
    background-color: var(--fcom-secondary-content-bg, #f0f3f5);
    border: 1px solid var(--fcom-primary-border, #e3e8ee);
    border-radius: 8px;
    padding: 10px;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    font-size: 16px !important;
    line-height: 1.5;
    display: block;
    font-weight: bold;
    color: var(--fcom-primary-text, #19283a) !important;
}

/* ===== RSVP LINE ===== */

.tbc-wc-rsvp-countdown {
    color: var(--fcom-text-link, #2271b1);
    font-weight: bold;
    margin-left: 5px;
}

.tbc-wc-rsvp-closed {
    color: var(--fcom-error, #cc0000);
    font-weight: bold;
    margin-left: 5px;
}

.tbc-wc-rsvp-message {
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--fcom-secondary-text, #525866);
}

.tbc-wc-rsvp-closed-message {
    margin-top: 10px;
    margin-bottom: 10px;
}

.tbc-wc-event-details-page .tbc-wc-event-time {
    display: block;
    font-weight: 500;
    color: var(--fcom-primary-text, #19283a);
}

/* ===== GOOGLE MAP ===== */

/* Location row holds the text + the map toggle button */
.tbc-wc-event-details-location {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tbc-wc-location-text {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

/* Small round token-styled toggle button */
.tbc-wc-map-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-left: 10px;
    padding: 0;
    flex-shrink: 0;
    border: 1px solid var(--fcom-primary-border, #e3e8ee);
    border-radius: 50%;
    background-color: var(--fcom-secondary-content-bg, #f0f3f5);
    color: var(--fcom-text-link, #2271b1);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tbc-wc-map-toggle-btn:hover,
.tbc-wc-map-toggle-btn:focus {
    background-color: var(--fcom-active-bg, #f0f3f5);
    border-color: var(--fcom-text-link, #2271b1);
    outline: none;
}

.tbc-wc-map-toggle-btn .tbc-wc-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

/* Collapsed by default; expands on .show */
.tbc-wc-map-container {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 0;
    opacity: 0;
}

.tbc-wc-map-container.show {
    max-height: 420px;
    opacity: 1;
    margin-bottom: 10px;
    border: 1px solid var(--fcom-primary-border, #e3e8ee);
    border-radius: 8px;
}

.tbc-wc-google-map {
    height: 360px;
    width: 100%;
    border-radius: 8px;
    display: block !important;
}

/* Google Maps internal element fixes (Street View pegman) */
.gm-svpc div img {
    position: relative !important;
}

.gm-svpc > div:last-of-type {
    width: 32px;
    height: 32px;
}

/* Info window — Google renders it light, so keep text black for readability
   in both themes; under html.dark, pin the bubble background white so the
   black text stays legible. */
.gm-style .gm-style-iw-d,
.gm-style .gm-style-iw-d * {
    color: #000 !important;
}

html.dark .gm-style .gm-style-iw-c,
html.dark .gm-style .gm-style-iw-d,
html.dark .gm-style .gm-style-iw-t::after {
    background: #ffffff !important;
}

html.dark .gm-style .gm-style-iw-d a {
    color: #1a73e8 !important;
}

/* ===== PROGRESS BAR ===== */
/* Bar / fill colors come inline from per-product settings — CSS only
   provides shape + layout. */

.tbc-wc-progress-above-text h5 {
    text-align: center;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

.tbc-wc-progress-wrapper {
    position: relative;
}

.tbc-wc-progress-bar {
    margin: 5px auto 0;
    height: 28px;
    padding: 4px;
    width: 100%;
    background-color: var(--fcom-secondary-bg, #f0f2f5);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.tbc-wc-progress-fill {
    position: relative;
    height: 100%;
    float: left;
    background-color: var(--fcom-text-link, #2271b1);
    border-radius: 999px;
    transition: width 0.6s ease;
}

.tbc-wc-progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    color: #f0f0f0;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.tbc-wc-progress-amounts {
    margin: 6px auto 40px;
    width: 100%;
    overflow: hidden;
}

.tbc-wc-progress-current {
    float: left;
    margin-right: 10px;
    font-weight: bold;
    font-size: 13px;
    color: var(--fcom-primary-text, #19283a);
}

.tbc-wc-progress-goal {
    float: right;
    margin-left: 5px;
    font-weight: bold;
    font-size: 13px;
    color: var(--fcom-primary-text, #19283a);
}

/* ===== WAITLIST + STATUS NOTICES ===== */
/* Tinted feedback blocks (self-styled — BuddyPress CSS is not assumed). */

.bp-feedback {
    display: block;
    padding: 12px 16px;
    margin: 15px 0;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 15px;
    line-height: 1.5;
}

.bp-feedback p {
    margin: 0 0 6px;
}

.bp-feedback p:last-child {
    margin-bottom: 0;
}

.bp-feedback .bp-icon {
    display: none;
}

.bp-feedback.success {
    background-color: rgba(40, 167, 69, 0.12);
    border-color: rgba(40, 167, 69, 0.35);
    color: #1e7e34;
}

.bp-feedback.error {
    background-color: rgba(220, 53, 69, 0.12);
    border-color: rgba(220, 53, 69, 0.35);
    color: #b02a37;
}

.bp-feedback.info {
    background-color: rgba(34, 113, 177, 0.12);
    border-color: rgba(34, 113, 177, 0.35);
    color: var(--fcom-text-link, #2271b1);
}

html.dark .bp-feedback.success {
    color: #4ade80;
}

html.dark .bp-feedback.error {
    color: #f87171;
}

html.dark .bp-feedback.info {
    color: #7fb2e6;
}

/* Waitlist notifications fade in once JS adds .tbc-wc-visible */
.tbc-wc-waitlist-notification {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tbc-wc-waitlist-notification.tbc-wc-visible {
    opacity: 1;
    transform: none;
}

/* Join / leave buttons */
.tbc-wc-btn-join-waitlist {
    display: inline-block;
    background-color: var(--fcom-primary-button, #2B2E33);
    color: var(--fcom-primary-button-text, #ffffff);
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: filter 0.2s ease;
}

.tbc-wc-btn-join-waitlist:hover {
    filter: brightness(0.9);
    color: var(--fcom-primary-button-text, #ffffff);
}

.tbc-wc-btn-leave-waitlist {
    display: inline-block;
    background-color: #aa0000;
    color: #fff;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: filter 0.2s ease;
}

.tbc-wc-btn-leave-waitlist:hover {
    filter: brightness(1.1);
    color: #fff;
}

/* "My Waitlists" shortcode — stacked cards */
.tbc-wc-waitlist {
    margin: 20px 0;
}

.tbc-wc-waitlist > h3 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--fcom-primary-text, #19283a);
}

.tbc-wc-waitlist-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tbc-wc-waitlist-item {
    background-color: var(--fcom-primary-bg, #ffffff);
    border: 1px solid var(--fcom-primary-border, #e3e8ee);
    border-radius: 8px;
    padding: 14px 16px;
    line-height: 1.6;
    color: var(--fcom-secondary-text, #525866);
}

.tbc-wc-waitlist-item strong a {
    color: var(--fcom-primary-text, #19283a);
    text-decoration: none;
    font-size: 16px;
}

.tbc-wc-waitlist-item strong a:hover {
    color: var(--fcom-text-link, #2271b1);
}

.tbc-wc-waitlist-item small {
    color: var(--fcom-text-off, #959595);
}

/* ===== SERIES PAGE ===== */
/* The card list itself reuses .tbc-wc-calendar styles from calendar.css. */

.tbc-wc-event-series-header {
    margin: 0 auto 25px;
    text-align: center;
    max-width: 1200px;
    padding: 20px;
}

.tbc-wc-event-series-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--fcom-primary-text, #19283a);
}

.tbc-wc-event-series-image {
    text-align: center;
    margin-bottom: 20px;
}

.tbc-wc-event-series-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.tbc-wc-event-series-empty {
    text-align: center;
    padding: 20px;
    background-color: var(--fcom-secondary-bg, #f0f2f5);
    border: 1px solid var(--fcom-primary-border, #e3e8ee);
    border-radius: 8px;
    margin: 20px 0;
    color: var(--fcom-secondary-text, #525866);
}

/* ===== EXTRA TABS — CONTENT TAB ===== */

.tbc-wc-extra-tab-content {
    margin-top: 12px;
    color: var(--fcom-primary-text, #19283a);
    font-size: 16px;
    line-height: 1.6;
}

.tbc-wc-extra-tab-content > *:first-child {
    margin-top: 0;
}

.tbc-wc-extra-tab-content > *:last-child {
    margin-bottom: 0;
}

.tbc-wc-extra-tab-content a {
    color: var(--fcom-text-link, #2271b1);
}

/* ===== EXTRA TABS — FAQ ACCORDION ===== */
/* The JS animates max-height and toggles .active (question) / .open (answer).
   Never set display:none on the answer — the collapsed state is the JS's
   max-height:0 / overflow:hidden. */

.tbc-wc-faq-container {
    margin: 12px 0 0;
}

.tbc-wc-faq-item {
    margin-bottom: 10px;
    background-color: var(--fcom-secondary-content-bg, #f0f3f5);
    border: 1px solid var(--fcom-primary-border, #e3e8ee);
    border-radius: 8px;
    overflow: hidden;
}

.tbc-wc-faq-question {
    position: relative;
    margin: 0;
    padding: 14px 44px 14px 16px;
    background-color: transparent;
    color: var(--fcom-primary-text, #19283a);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.tbc-wc-faq-question:hover,
.tbc-wc-faq-question.active {
    background-color: var(--fcom-active-bg, #f0f3f5);
}

/* Chevron indicator — rotates when the question is .active */
.tbc-wc-faq-question::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--fcom-secondary-text, #525866);
    border-bottom: 2px solid var(--fcom-secondary-text, #525866);
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.2s ease;
}

.tbc-wc-faq-question.active::after {
    transform: translateY(-30%) rotate(-135deg);
}

/* Collapsed default (JS owns the animated max-height / .open state) */
.tbc-wc-faq-answer {
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    border-top: 1px solid transparent;
    color: var(--fcom-primary-text, #19283a);
    font-size: 15px;
    line-height: 1.6;
}

.tbc-wc-faq-answer.open {
    padding: 12px 16px;
    border-top-color: var(--fcom-primary-border, #e3e8ee);
}

.tbc-wc-faq-answer > *:first-child {
    margin-top: 0;
}

.tbc-wc-faq-answer > *:last-child {
    margin-bottom: 0;
}

.tbc-wc-faq-answer a {
    color: var(--fcom-text-link, #2271b1);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .tbc-wc-event-details-location,
    .tbc-wc-event-details-price,
    .tbc-wc-event-details-time,
    .tbc-wc-event-details-rsvp {
        padding: 8px;
        font-size: 14px;
    }

    .tbc-wc-event-series-header {
        padding: 10px;
        margin-bottom: 15px;
    }

    .tbc-wc-event-series-title {
        font-size: 22px;
    }

    .tbc-wc-btn-join-waitlist,
    .tbc-wc-btn-leave-waitlist {
        display: block;
        width: 100%;
        margin-bottom: 5px;
    }

    .tbc-wc-faq-question {
        padding: 12px 40px 12px 12px;
        font-size: 15px;
    }

    .tbc-wc-faq-answer.open {
        padding: 10px 12px;
        font-size: 14px;
    }
}

@media only screen and (max-width: 480px) {
    .tbc-wc-progress-goal,
    .tbc-wc-progress-current {
        font-size: 13px !important;
    }
}
