/* =========================================================
   Events Calendar — Frontend Styles
   ========================================================= */

/* ---- Calendar wrapper (calendar page) ---- */
.ec-calendar-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ---- Calendar container ---- */
.ec-calendar-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 1.5rem;
}

.ec-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.ec-calendar-header h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a1a;
}

.ec-nav-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    color: #333;
    font-size: 14px;
    line-height: 1;
    font-weight: 300;
}

.ec-nav-btn:hover {
    background: #e0e7ff;
    color: var(--ec-primary);
    transform: translateY(-1px);
}

/* ---- Calendar grid ---- */
.ec-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.ec-weekday {
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #888;
    padding: 0.4rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#ec-calendar-days {
    display: contents;
}

.ec-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.875rem;
    position: relative;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    background: #fafafa;
    color: #333;
    border: 2px solid transparent;
    gap: 2px;
}

.ec-day:not(.ec-disabled):hover {
    background: #eef2ff;
    color: var(--ec-primary);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(79,70,229,0.15);
}

.ec-day.ec-disabled {
    cursor: default;
    background: transparent;
    opacity: 0.3;
}

.ec-day.ec-today {
    background: #e0e7ff;
    color: var(--ec-primary);
    font-weight: 700;
    border-color: #c7d2fe;
}

.ec-day.ec-has-events {
    background: #fff7ed;
    color: #c2410c;
    font-weight: 600;
}

.ec-day.ec-selected {
    background: var(--ec-primary);
    color: #fff;
    font-weight: 700;
    border-color: var(--ec-primary-dark);
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

.ec-day.ec-has-events.ec-selected {
    background: var(--ec-primary);
}

.ec-day-number {
    line-height: 1;
}

.ec-event-indicator {
    width: 5px;
    height: 5px;
    background: currentColor;
    border-radius: 50%;
}

.ec-day.ec-selected .ec-event-indicator {
    background: rgba(255,255,255,0.7);
}

/* ---- Events panel ---- */
.ec-events-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 1.5rem;
    max-height: 680px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ec-events-header {
    margin-bottom: 1rem;
    padding-bottom: 0.875rem;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
}

.ec-events-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
}

/* ---- Time filter ---- */
.ec-time-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ec-time-filter-btn {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #374151;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ec-time-filter-btn:hover,
.ec-time-filter-btn.active {
    background: var(--ec-primary);
    border-color: var(--ec-primary);
    color: #fff;
}

/* ---- Events list ---- */
.ec-events-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.ec-no-events,
.ec-error {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #888;
}

.ec-no-events-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.ec-error {
    color: #dc2626;
}

/* ---- Event card ---- */
.ec-event-card {
    display: grid;
    grid-template-columns: 100px 1fr;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid #f0f0f0;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    background: #fafafa;
    text-decoration: none;
    color: inherit;
}

.ec-event-card:hover {
    border-color: var(--ec-primary);
    box-shadow: 0 4px 16px rgba(79,70,229,0.12);
    transform: translateY(-2px);
}

.ec-event-image {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ec-event-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ec-event-image.ec-no-image {
    color: #9ca3af;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ec-event-content {
    padding: 0.75rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.ec-event-meta {
    display: flex;
    gap: 0.875rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #6b7280;
}

.ec-event-time,
.ec-event-location {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.ec-event-time {
    color: var(--ec-primary);
    font-weight: 600;
}

.ec-event-title {
    margin: 0;
    font-size: 0.975rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ec-event-excerpt {
    margin: 0;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ec-event-date-badge {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ---- Loading ---- */
.ec-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.ec-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--ec-primary);
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    animation: ec-spin 0.7s linear infinite;
}

@keyframes ec-spin { to { transform: rotate(360deg); } }

.ec-loading p {
    color: #6b7280;
    margin: 0;
    font-size: 0.9rem;
}

/* ==========================================================
   Single Event Page
   ========================================================== */

.ec-single-event-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

/* Hero */
.ec-event-hero {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
    min-height: 300px;
    background: #1e1b4b;
}

.ec-event-hero-image {
    position: absolute;
    inset: 0;
}

.ec-event-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

.ec-event-hero-overlay {
    position: relative;
    z-index: 2;
    padding: 3rem 2.5rem 2.5rem;
}

.ec-single-title {
    color: #fff;
    font-size: 2.25rem;
    font-weight: 800;
    margin: 0 0 1rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ec-single-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Body layout */
.ec-single-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

.ec-single-content .entry-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #374151;
}

/* Sidebar cards */
.ec-single-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ec-single-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.ec-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.875rem 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a1a1a;
}

.ec-card-header i {
    color: var(--ec-primary);
    font-size: 1rem;
}

.ec-card-body {
    padding: 1rem;
}

/* Schedule items */
.ec-schedule-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.ec-schedule-item:last-child {
    border-bottom: none;
}

.ec-schedule-date {
    flex-shrink: 0;
    background: var(--ec-primary);
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    text-align: center;
    min-width: 52px;
}

.ec-schedule-day {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
}

.ec-schedule-month {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    margin-top: 2px;
}

.ec-schedule-times {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 2px;
}

.ec-schedule-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.ec-schedule-time i {
    color: var(--ec-primary);
    font-size: 0.85rem;
}

/* Location card */
.ec-location-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 0.875rem;
    font-size: 0.9rem;
}

.ec-location-name i {
    color: #ef4444;
}

.ec-map-container {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 1px solid #e5e7eb;
}

.ec-map-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ec-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}

.ec-map-link:hover {
    color: var(--ec-primary-dark);
    text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .ec-single-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ec-calendar-wrapper {
        grid-template-columns: 1fr;
    }

    .ec-event-card {
        grid-template-columns: 80px 1fr;
    }

    .ec-event-image {
        width: 80px;
        height: 80px;
    }

    .ec-single-title {
        font-size: 1.5rem;
    }

    .ec-event-hero-overlay {
        padding: 2rem 1.5rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .ec-calendar-grid { gap: 3px; }

    .ec-day { font-size: 0.78rem; }

    .ec-weekday {
        font-size: 0.68rem;
        padding: 0.2rem 0;
    }

    .ec-event-card {
        grid-template-columns: 1fr;
    }

    .ec-event-image {
        width: 100%;
        height: 150px;
    }
}

/* ---- Branding CSS variable overrides ---- */

/* Hero overlay uses the saved branding color + opacity */
.ec-event-hero-image img {
    opacity: 1; /* actual overlay handled by pseudo-element below */
}

.ec-event-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--ec-overlay-color, #1e1b4b);
    opacity: var(--ec-overlay-alpha, 0.55);
    pointer-events: none;
    z-index: 1;
}

/* Ensure hero content sits above the overlay */
.ec-event-hero-overlay {
    position: relative;
    z-index: 2;
}

/* ---- Hero logo ---- */
.ec-event-hero-logo {
    margin-bottom: 10px;
}

.ec-event-hero-logo img {
    max-height: 40px;
    max-width: 160px;
    object-fit: contain;
    background: rgba(255,255,255,0.12);
    padding: 4px 10px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

/* Spinning dashicon for save button */
@keyframes ec-rotate { to { transform: rotate(360deg); } }
.ec-spin { display: inline-block; animation: ec-rotate 0.7s linear infinite; }
