/* ==========================================================================
   DPA Webinar — Frontend Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties — Theme Override Points
   Override any of these in your theme's stylesheet to re-brand the plugin
   without touching the plugin files or fighting specificity.

   Example (in your theme's style.css or a custom CSS block):
     :root {
         --dpa-color-selected-bg:  #your-brand-blue;
         --dpa-bar-checkout-bg:    #your-brand-cta;
         --dpa-seat-map-columns:   10;
     }
   -------------------------------------------------------------------------- */
:root {
    /* ── Seat state colours ── */
    --dpa-color-available-bg:     #d1fae5;
    --dpa-color-available-border: #6ee7b7;
    --dpa-color-available-text:   #065f46;

    --dpa-color-selected-bg:      #2563eb;
    --dpa-color-selected-border:  #1d4ed8;
    --dpa-color-selected-text:    #fff;

    --dpa-color-held-bg:          #fef3c7;
    --dpa-color-held-border:      #fbbf24;
    --dpa-color-held-text:        #92400e;

    --dpa-color-booked-bg:        #fee2e2;
    --dpa-color-booked-border:    #fca5a5;
    --dpa-color-booked-text:      #991b1b;

    /* ── Seat shape & size ── */
    --dpa-seat-radius:            4px;
    --dpa-seat-height:            40px;
    --dpa-seat-font-size:         .7rem;

    /* ── Seat map grid ── */
    --dpa-seat-map-columns:       8;   /* integer — passed to repeat() */
    --dpa-seat-map-bg:            #f8fafc;
    --dpa-seat-map-border:        #e2e8f0;
    --dpa-seat-map-radius:        6px;

    /* ── Single-page two-column layout ── */
    --dpa-layout-columns:         3fr 2fr;
    --dpa-layout-gap:             2.5rem;

    /* ── Seat-picker sidebar panel ── */
    --dpa-sidebar-bg:             #fff;
    --dpa-sidebar-border:         #e2e8f0;
    --dpa-sidebar-radius:         8px;

    /* ── Archive cards ── */
    --dpa-card-bg:                #fff;
    --dpa-card-border:            #e2e8f0;
    --dpa-card-radius:            6px;

    /* ── Notice / login prompt ── */
    --dpa-notice-bg:              #fff3cd;
    --dpa-notice-border:          #ffc107;
    --dpa-notice-text:            #856404;

    /* ── Add-to-cart confirmation box ── */
    --dpa-cart-form-bg:           #f0fdf4;
    --dpa-cart-form-border:       #bbf7d0;
    --dpa-cart-summary-text:      #166534;
}

/* Wrapper */
.dpa-webinar-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ---- Archive ---- */
.dpa-webinar-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dpa-webinar-card {
    border: 1px solid var(--dpa-card-border);
    border-radius: var(--dpa-card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--dpa-card-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: box-shadow .2s;
}
.dpa-webinar-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.dpa-webinar-card__thumbnail {
    aspect-ratio: 16 / 9;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.dpa-webinar-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.dpa-webinar-card__body {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.dpa-webinar-card__title {
    font-size: 1.1rem;
    margin: 0 0 .6rem;
}
.dpa-webinar-card__date,
.dpa-webinar-card__price,
.dpa-webinar-card__seats {
    font-size: .9rem;
    color: #555;
    margin: .2rem 0;
}
.dpa-webinar-card__excerpt {
    flex: 1;
    font-size: .9rem;
    color: #444;
    margin: .6rem 0 1rem;
}
.dpa-webinar-card__cta {
    align-self: flex-start;
}
.dpa-webinar-none {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* ---- Single Webinar — page width ---- */
/* Widen only the single-webinar page to accommodate the two-column layout. */
#dpa-webinar-single {
    max-width: 1200px;
}

/* ---- Two-column layout ---- */
.dpa-webinar-layout {
    display: grid;
    grid-template-columns: var(--dpa-layout-columns);
    gap: var(--dpa-layout-gap);
    align-items: start; /* required: allows sticky to work inside a grid */
}

/* Left: description */
.dpa-webinar-main {
    min-width: 0; /* prevent grid blowout on long content */
}

/* Right: sticky seat-selection panel */
.dpa-webinar-sidebar {
    min-width: 0;
}

.dpa-webinar-sidebar__inner {
    position: sticky;
    /* Respect the WP admin bar height (CSS var set by WordPress core). */
    top: calc(var(--wp-admin--admin-bar--height, 0px) + 1.5rem);
    border: 1px solid var(--dpa-sidebar-border);
    border-radius: var(--dpa-sidebar-radius);
    padding: 1.25rem;
    background: var(--dpa-sidebar-bg);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .07);
}

/* Remove extra top margin from the seat section when it's inside the sidebar */
.dpa-webinar-sidebar__inner .dpa-seat-map-section {
    margin-top: 0;
}

/* ---- Responsive: stack below 768 px ---- */
@media ( max-width: 768px ) {
    .dpa-webinar-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .dpa-webinar-sidebar__inner {
        position: static;
        box-shadow: none;
    }
}

/* ---- Single Webinar ---- */
.dpa-webinar-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    border-bottom: 2px solid var(--dpa-sidebar-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.dpa-webinar-header__meta {
    flex: 1;
    min-width: 0;
}
.dpa-webinar-header__thumbnail {
    flex-shrink: 0;
    width: 240px;
}
.dpa-webinar-thumbnail {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.dpa-webinar-title {
    margin-bottom: .4rem;
}
.dpa-webinar-date,
.dpa-webinar-price {
    margin: .25rem 0;
    font-size: .95rem;
}
.dpa-webinar-notice {
    background: var(--dpa-notice-bg);
    border: 1px solid var(--dpa-notice-border);
    border-radius: var(--dpa-seat-radius);
    padding: .8rem 1.2rem;
    margin: 1rem 0;
    color: var(--dpa-notice-text);
}

/* ---- Image Gallery Strip ---- */
.dpa-webinar-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 1.5rem;
}

.dpa-webinar-gallery__item {
    display: block;
    border-radius: 5px;
    overflow: hidden;
    flex: 0 0 auto;
    line-height: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    transition: box-shadow .2s, transform .2s;
}

.dpa-webinar-gallery__item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
    transform: scale(1.03);
}

.dpa-webinar-gallery__img {
    display: block;
    height: 140px;
    width: auto;
    object-fit: cover;
    border-radius: 5px;
}

@media ( max-width: 600px ) {
    .dpa-webinar-gallery__img {
        height: 100px;
    }
}

/* ---- Seat Map ---- */
.dpa-seat-map-section {
    margin-top: 2rem;
}
.dpa-seat-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
    font-size: .85rem;
    align-items: center;
}
/* Legend items share seat colours but must not use the fixed 40×40 square size. */
.dpa-seat-legend .dpa-seat {
    width: auto;
    height: auto;
    padding: 4px 10px;
    white-space: nowrap;
    transform: none !important;
}
.dpa-seat-map {
    display: grid;
    grid-template-columns: repeat(var(--dpa-seat-map-columns), 1fr);
    gap: 6px;
    padding: 1rem;
    border: 1px solid var(--dpa-seat-map-border);
    border-radius: var(--dpa-seat-map-radius);
    background: var(--dpa-seat-map-bg);
    min-height: 80px;
}
/* Seats inside the map stretch to fill their grid cell for equal spacing on all edges. */
.dpa-seat-map .dpa-seat {
    width: 100%;
}
.dpa-seat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--dpa-seat-height); /* width == height for the legend; overridden to 100% inside the map */
    height: var(--dpa-seat-height);
    border-radius: var(--dpa-seat-radius);
    font-size: var(--dpa-seat-font-size);
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .1s, box-shadow .1s;
    user-select: none;
    overflow: hidden;
    white-space: nowrap;
}
.dpa-seat--available {
    background: var(--dpa-color-available-bg);
    border-color: var(--dpa-color-available-border);
    color: var(--dpa-color-available-text);
    cursor: pointer;
}
.dpa-seat--available:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.dpa-seat--selected {
    background: var(--dpa-color-selected-bg);
    border-color: var(--dpa-color-selected-border);
    color: var(--dpa-color-selected-text);
    transform: scale(1.1);
}
.dpa-seat--held {
    background: var(--dpa-color-held-bg);
    border-color: var(--dpa-color-held-border);
    color: var(--dpa-color-held-text);
    cursor: not-allowed;
}
.dpa-seat--booked {
    background: var(--dpa-color-booked-bg);
    border-color: var(--dpa-color-booked-border);
    color: var(--dpa-color-booked-text);
    cursor: not-allowed;
}
.dpa-seat-map__loading {
    color: #999;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 1.5rem 0;
}

/* ---- Reservation Timer ---- */
.dpa-reservation-timer {
    margin: 1rem 0;
    padding: .8rem 1.2rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    color: #1e40af;
    font-size: .95rem;
}
.dpa-reservation-timer strong {
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}

/* ---- Pick for Me ---- */
.dpa-pick-for-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
}
.dpa-pick-qty {
    width: 160px;
    padding: .45rem .65rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: .9rem;
    line-height: 1.4;
}
.dpa-pick-btn {
    padding: .45rem 1.1rem;
    font-size: .9rem;
    white-space: nowrap;
}
.dpa-pick-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ---- Password Gate ---- */
.dpa-webinar-password-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 1rem;
}
.dpa-webinar-password {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    text-align: center;
}
.dpa-webinar-password__intro {
    margin: 0 0 1.25rem;
    color: #475569;
    font-size: .95rem;
    line-height: 1.5;
}
/* WordPress generates .post-password-form for the form element */
.dpa-webinar-password .post-password-form,
.dpa-webinar-password form {
    margin: 0;
}
.dpa-webinar-password .post-password-form label,
.dpa-webinar-password form label {
    display: none; /* intro paragraph already explains the context */
}
.dpa-webinar-password .post-password-form input[type="password"],
.dpa-webinar-password form input[type="password"] {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 1rem;
    margin-bottom: .75rem;
    box-sizing: border-box;
}
.dpa-webinar-password .post-password-form input[type="submit"],
.dpa-webinar-password form input[type="submit"] {
    width: 100%;
    padding: .6rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background .15s ease;
}
.dpa-webinar-password .post-password-form input[type="submit"]:hover,
.dpa-webinar-password form input[type="submit"]:hover {
    background: #1d4ed8;
}

/* ---- Add-to-Cart Form ---- */
.dpa-add-to-cart-form {
    margin-top: .75rem;
    margin-bottom: 1rem;
    padding: 1.2rem;
    background: var(--dpa-cart-form-bg);
    border: 1px solid var(--dpa-cart-form-border);
    border-radius: var(--dpa-card-radius);
}
.dpa-selected-summary {
    font-size: .95rem;
    margin-bottom: .8rem;
    color: var(--dpa-cart-summary-text);
}
.dpa-checkout-btn {
    font-size: 1rem;
    padding: .6rem 1.5rem;
}

