/**
 * AttenderLever — Single Event Template Styles
 *
 * "Clean Modern" card-based layout with scoped CSS custom properties,
 * responsive two-column desktop grid, and capacity progress bar.
 *
 * @package AttenderLever
 */

/* ========================================
   CSS Custom Properties (scoped to container)
   ======================================== */
.event-single {
    /* Primary — buttons, progress bar, link accents */
    --event-primary: #2563eb;
    --event-primary-hover: #1d4ed8;
    --event-primary-light: #2563eb1a;     /* 10 % opacity tint */
    --event-primary-shadow: #2563eb40;    /* 25 % opacity */

    /* Neutrals */
    --event-text: #1c1c1c;
    --event-text-muted: #666;
    --event-text-light: #999;
    --event-bg: #ffffff;
    --event-bg-subtle: #fafafa;
    --event-border: #f0f0f0;

    /* Shape */
    --event-radius: 12px;
    --event-radius-lg: 20px;
    --event-radius-pill: 100px;

    /* Fallback gradient (no cover image) */
    --event-gradient-from: #1e3a5f;
    --event-gradient-to: #2563eb;
}

/* ========================================
   Container
   ======================================== */
.event-single {
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   Card
   ======================================== */
.event-card {
    background: var(--event-bg);
    border-radius: var(--event-radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08),
                0 8px 30px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    max-width: 620px;
    margin: 0 auto;
}

/* ========================================
   Image
   ======================================== */
.event-image {
    position: relative;
    overflow: hidden;
}

.event-image img {
    width: 100%;
    height: 200px;
    display: block;
    object-fit: cover;
    object-position: center 30%;
}

/* Fallback gradient when no cover image */
.event-image--fallback {
    width: 100%;
    height: 200px;
    background: linear-gradient(
        135deg,
        var(--event-gradient-from),
        var(--event-gradient-to)
    );
}

.event-image--ratio-1-1 img,
.event-image--ratio-1-1 .event-image--fallback {
    aspect-ratio: 1 / 1;
    height: auto;
}

.event-image--ratio-16-9 img,
.event-image--ratio-16-9 .event-image--fallback {
    aspect-ratio: 16 / 9;
    height: auto;
}

/* ========================================
   Content Area
   ======================================== */
.event-content {
    padding: 28px 24px;
}

/* ========================================
   Date Pill
   ======================================== */
.event-date-pill {
    display: inline-block;
    padding: 6px 14px;
    background: var(--event-primary-light);
    color: var(--event-primary);
    border-radius: var(--event-radius-pill);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
    margin-bottom: 16px;
}

/* ========================================
   Title & Subtitle
   ======================================== */
h1.event-title {
    font-size: 24px;
    line-height: 1.25;
    margin: 0 0 8px;
    color: var(--event-text);
    font-weight: 700;
}

p.event-subtitle {
    font-size: 15px;
    color: var(--event-text-muted);
    font-weight: 500;
    margin: 0 0 20px;
    line-height: 1.4;
}

/* When no subtitle, add bottom margin to title */
h1.event-title:last-child,
h1.event-title + .event-location-card {
    margin-top: 0;
}

h1.event-title + .event-location-card {
    /* Title flows directly to location when no subtitle */
}

/* Ensure spacing when title has no subtitle sibling */
h1.event-title:not(:has(+ .event-subtitle)) {
    margin-bottom: 20px;
}

/* ========================================
   Location Card
   ======================================== */
.event-location-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--event-bg-subtle);
    padding: 16px;
    border-radius: var(--event-radius);
    margin-bottom: 20px;
}

.event-location-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--event-primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-location-icon svg {
    width: 20px;
    height: 20px;
    color: var(--event-primary);
}

.event-location-info {
    flex: 1;
    min-width: 0;
}

.event-location-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--event-text);
    line-height: 1.3;
}

.event-location-address {
    font-size: 13px;
    color: var(--event-text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

.event-location-directions {
    display: none; /* hidden on mobile */
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--event-primary);
    text-decoration: none;
    margin-top: 6px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.event-location-directions:hover {
    opacity: 0.8;
}

.event-location-directions svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   Description
   ======================================== */
.event-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--event-text-muted);
    margin-bottom: 24px;
}

.event-description p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Capacity Bar
   ======================================== */
.event-capacity {
    margin-bottom: 24px;
}

.event-capacity-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.event-capacity-registered {
    font-size: 13px;
    font-weight: 600;
    color: var(--event-text);
}

.event-capacity-remaining {
    font-size: 13px;
    color: var(--event-text-light);
}

.event-capacity-bar {
    height: 4px;
    background: var(--event-border);
    border-radius: 2px;
    overflow: hidden;
}

.event-capacity-fill {
    height: 100%;
    background: var(--event-primary);
    border-radius: 2px;
    transition: width 0.8s ease;
}

/* ========================================
   RSVP Button
   ======================================== */
.event-rsvp-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--event-primary);
    color: #fff;
    border: none;
    border-radius: var(--event-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 2px 8px var(--event-primary-shadow);
    transition: background 0.2s, box-shadow 0.2s;
    margin-bottom: 20px;
    -webkit-appearance: none;
    appearance: none;
}

.event-rsvp-btn:hover {
    background: var(--event-primary-hover);
    color: #fff;
    text-decoration: none;
}

.event-rsvp-btn:focus-visible {
    outline: 2px solid var(--event-primary);
    outline-offset: 2px;
}

/* Prevent theme/Elementor link colors from overriding CTA readability */
.event-single .event-rsvp-btn,
.event-single a.event-rsvp-btn,
.event-single a.event-rsvp-btn:visited {
    background: var(--event-primary) !important;
    border-color: var(--event-primary) !important;
    color: #fff !important;
}

.event-single .event-rsvp-btn:hover,
.event-single a.event-rsvp-btn:hover,
.event-single a.event-rsvp-btn:focus {
    background: var(--event-primary-hover) !important;
    border-color: var(--event-primary-hover) !important;
    color: #fff !important;
}

/* ========================================
   Actions Bar (Calendar, Share, Invite)
   ======================================== */
.event-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding-top: 4px;
}

.event-action-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--event-text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.event-action-link:hover {
    color: var(--event-primary);
    text-decoration: none;
}

.event-action-link svg {
    width: 20px;
    height: 20px;
    color: var(--event-text-light);
    transition: color 0.2s;
}

.event-action-link:hover svg {
    color: var(--event-primary);
}

/* ========================================
   Sections Below Card
   (Registration, Calendar, Invite, Share)
   ======================================== */
.event-section {
    max-width: 620px;
    margin: 20px auto 0;
    padding: 18px 20px;
    background: var(--event-bg);
    border-radius: var(--event-radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--event-border);
}

.event-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--event-text);
    margin: 0 0 12px;
}

/* Compact lower-section action styles */
.event-section .attenderlever-calendar-links {
    gap: 10px;
}

.event-section .attenderlever-calendar-link {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--event-text) !important;
    border-color: var(--event-border) !important;
    background: var(--event-bg) !important;
}

.event-section .attenderlever-calendar-link span {
    font-weight: 500;
}

.event-section .attenderlever-share-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.event-section .attenderlever-share-button {
    justify-content: center;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--event-text) !important;
    border-color: var(--event-border) !important;
    background: var(--event-bg) !important;
    line-height: 1.2;
}

.event-section .attenderlever-share-button svg {
    width: 18px;
    height: 18px;
}

.event-section .attenderlever-share-button__label {
    font-weight: 500;
}

.event-section .attenderlever-invite-note {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--event-text-muted);
}

.event-section .attenderlever-invite-group label {
    font-size: 13px;
    color: var(--event-text-muted);
}

.event-section .attenderlever-invite-group input,
.event-section .attenderlever-invite-group textarea {
    border-color: var(--event-border);
    border-radius: 10px;
    background: #fff !important;
    color: var(--event-text) !important;
    font-size: 16px; /* avoid iOS zoom */
    line-height: 1.4;
}

.event-section .attenderlever-invite-submit {
    border-radius: 10px;
    background: transparent !important;
    color: var(--event-primary) !important;
    border-color: var(--event-primary) !important;
    border-width: 1.5px;
    border-style: solid;
    min-height: 44px;
    font-size: 15px;
    box-shadow: none;
}

.event-section .attenderlever-invite-submit:hover {
    background: var(--event-primary-light) !important;
    border-color: var(--event-primary-hover) !important;
    color: var(--event-primary-hover) !important;
}

.event-section .attenderlever-invite-submit:focus-visible,
.event-section .attenderlever-calendar-link:focus-visible,
.event-section .attenderlever-share-button:focus-visible {
    outline: 2px solid var(--event-primary);
    outline-offset: 2px;
}

.event-section .attenderlever-invite-group input:focus,
.event-section .attenderlever-invite-group textarea:focus {
    border-color: var(--event-primary) !important;
    box-shadow: 0 0 0 2px var(--event-primary-light) !important;
    outline: none !important;
}

.event-section .attenderlever-form-message {
    font-size: 14px;
}

/* ========================================
   Responsive: Tablet (481px+)
   ======================================== */
@media (min-width: 481px) {
    .event-image img {
        height: 260px;
    }

    .event-image--fallback {
        height: 260px;
    }

    .event-image--ratio-1-1 img,
    .event-image--ratio-1-1 .event-image--fallback {
        height: auto;
    }

    .event-image--ratio-16-9 img,
    .event-image--ratio-16-9 .event-image--fallback {
        height: auto;
    }

    .event-content {
        padding: 40px 44px;
    }

    .event-card {
        border-radius: var(--event-radius-lg);
    }

    h1.event-title {
        font-size: 32px;
    }

    p.event-subtitle {
        font-size: 17px;
    }

    .event-description {
        font-size: 15px;
    }

    .event-location-directions {
        display: inline-flex;
    }

    .event-section .attenderlever-calendar-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .event-section .attenderlever-calendar-link {
        width: auto;
    }

    .event-section .attenderlever-share-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ========================================
   Responsive: Desktop (900px+)
   ======================================== */
@media (min-width: 900px) {
    /* Two-column grid when image is present */
    .event-card--has-image {
        display: grid;
        grid-template-columns: 360px 1fr;
        max-width: 960px;
    }

    .event-card--has-image .event-image {
        position: relative;
    }

    .event-card--has-image .event-image img {
        width: 100%;
        height: 100%;
        min-height: 480px;
        object-position: center center;
        border-radius: 0; /* card overflow:hidden handles corners */
    }

    .event-card--has-image .event-image--fallback {
        height: 100%;
        min-height: 480px;
    }

    .event-card--has-image .event-image--ratio-1-1 img,
    .event-card--has-image .event-image--ratio-1-1 .event-image--fallback {
        aspect-ratio: 1 / 1;
        height: auto;
        min-height: 0;
    }

    /* 16:9 images → full-width banner above content, not side column */
    .event-card--has-image:has(.event-image--ratio-16-9) {
        display: block;
    }

    .event-card--has-image .event-image--ratio-16-9 img,
    .event-card--has-image .event-image--ratio-16-9 .event-image--fallback {
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 0;
        object-position: center 30%;
    }

    /* Sections below card match the wider layout when image is present */
    .event-single:has(.event-card--has-image) .event-section {
        max-width: 960px;
    }
}

/* ========================================
   Mobile refinements (≤480px)
   ======================================== */
@media (max-width: 480px) {
    .event-single {
        padding: 12px;
    }

    .event-card {
        border-radius: 14px;
    }

    .event-actions {
        gap: 20px;
    }

    .event-actions .event-action-link {
        min-width: 64px;
    }

    .event-actions .event-action-link svg {
        width: 22px;
        height: 22px;
    }

    .event-actions .event-action-link span {
        font-size: 13px;
    }

    .event-section {
        margin-top: 14px;
        padding: 14px;
        border-radius: 12px;
    }

    .event-section h2 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .event-section .attenderlever-share-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .event-section .attenderlever-share-button,
    .event-section .attenderlever-calendar-link {
        justify-content: flex-start;
        width: 100%;
        min-height: 42px;
        padding: 9px 12px;
    }

    .event-section .attenderlever-invite-fields {
        gap: 0.75rem;
    }

    .event-section .attenderlever-invite-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .event-section .attenderlever-invite-group label {
        font-size: 14px;
    }

    .event-section .attenderlever-invite-group textarea {
        min-height: 110px;
    }

    .event-section .attenderlever-invite-submit {
        width: 100%;
        justify-self: stretch;
    }
}
