/* =====================================================
   Elite-Church — Programs Frontend Styles
   ===================================================== */

/* ── Section ── */
.ec-programs-wrap { max-width: 1300px; margin: 0 auto; padding: 40px 20px; }

.ec-programs-section { margin-bottom: 60px; }

.ec-section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
    margin-bottom: 32px;
    position: relative;
    padding-bottom: 14px;
}
.ec-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, #7c3aed, #2563eb);
}

/* ── Grid ── */
.ec-prog-grid {
    display: grid;
    gap: 24px;
}
.ec-grid-cols-1  { grid-template-columns: repeat(1,  1fr); }
.ec-grid-cols-2  { grid-template-columns: repeat(2,  1fr); }
.ec-grid-cols-3  { grid-template-columns: repeat(3,  1fr); }
.ec-grid-cols-4  { grid-template-columns: repeat(4,  1fr); }
.ec-grid-cols-5  { grid-template-columns: repeat(5,  1fr); }
.ec-grid-cols-6  { grid-template-columns: repeat(6,  1fr); }
.ec-grid-cols-7  { grid-template-columns: repeat(7,  1fr); }
.ec-grid-cols-8  { grid-template-columns: repeat(8,  1fr); }
.ec-grid-cols-9  { grid-template-columns: repeat(9,  1fr); }
.ec-grid-cols-10 { grid-template-columns: repeat(10, 1fr); }
.ec-grid-cols-11 { grid-template-columns: repeat(11, 1fr); }
.ec-grid-cols-12 { grid-template-columns: repeat(12, 1fr); }
.ec-grid-cols-13 { grid-template-columns: repeat(13, 1fr); }
.ec-grid-cols-14 { grid-template-columns: repeat(14, 1fr); }
.ec-grid-cols-15 { grid-template-columns: repeat(15, 1fr); }

@media (max-width: 1024px) {
    [class*="ec-grid-cols-"] { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 600px) {
    [class*="ec-grid-cols-"] { grid-template-columns: 1fr; }
}

/* ── Carousel ── */
.ec-carousel-wrap { position: relative; overflow: hidden; }
.ec-carousel-track {
    display: flex;
    gap: 24px;
    transition: transform 0.4s ease;
    padding-bottom: 16px;
}
.ec-carousel-track .ec-prog-card {
    min-width: 300px;
    flex: 0 0 300px;
}
.ec-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 22px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: background 0.2s;
}
.ec-carousel-btn:hover { background: #5b21b6; }
.ec-carousel-prev { left: 0; }
.ec-carousel-next { right: 0; }

/* ── Card ── */
.ec-prog-card {
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}
.ec-prog-card:hover {
    transform: translateY(-6px);
}

.ec-shadow-sm { box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.ec-shadow-md { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.ec-shadow-lg { box-shadow: 0 8px 32px rgba(0,0,0,0.2);  }

.ec-prog-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.ec-prog-card-body {
    padding: 20px;
}
.ec-prog-title {
    margin: 0 0 12px;
    line-height: 1.3;
}
.ec-prog-date,
.ec-prog-time {
    margin: 6px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ec-prog-icon { font-size: 1.1rem; }
.ec-prog-excerpt {
    margin: 10px 0;
    line-height: 1.6;
    opacity: 0.85;
}
.ec-prog-know-more-btn {
    margin-top: 16px;
    padding: 10px 22px;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    display: inline-block;
}
.ec-prog-know-more-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ── Animations ── */
@keyframes ec-fadeInUp   { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:translateY(0); } }
@keyframes ec-fadeIn     { from { opacity:0; } to { opacity:1; } }
@keyframes ec-slideInLeft{ from { opacity:0; transform:translateX(-40px); } to { opacity:1; transform:translateX(0); } }
@keyframes ec-zoomIn     { from { opacity:0; transform:scale(0.85); } to { opacity:1; transform:scale(1); } }
@keyframes ec-bounceIn   { 0%{opacity:0;transform:scale(.3)} 50%{opacity:1;transform:scale(1.05)} 70%{transform:scale(.9)} 100%{transform:scale(1)} }

.ec-anim-fadeInUp    { animation: ec-fadeInUp    0.6s ease-out both; }
.ec-anim-fadeIn      { animation: ec-fadeIn      0.6s ease-out both; }
.ec-anim-slideInLeft { animation: ec-slideInLeft 0.6s ease-out both; }
.ec-anim-zoomIn      { animation: ec-zoomIn      0.5s ease-out both; }
.ec-anim-bounceIn    { animation: ec-bounceIn    0.7s both; }

/* ══════════════════════════════════════════════════
   Know More Modal — improved with animations
══════════════════════════════════════════════════ */
.ec-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 5, 30, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.ec-modal-overlay.ec-modal-visible {
    opacity: 1;
}
.ec-modal-overlay.ec-modal-closing {
    opacity: 0;
}
.ec-modal-box {
    background: #fff;
    border-radius: 20px;
    max-width: 720px;
    width: 93%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.88) translateY(24px);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
    opacity: 0;
    box-shadow:
        0 0 0 1px rgba(124,58,237,0.12),
        0 24px 80px rgba(0,0,0,0.35),
        0 0 60px rgba(124,58,237,0.15);
}
.ec-modal-visible .ec-modal-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.ec-modal-closing .ec-modal-box {
    transform: scale(0.92) translateY(16px);
    opacity: 0;
}
.ec-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(243,244,246,0.9);
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: background 0.2s, transform 0.2s;
    z-index: 5;
}
.ec-modal-close:hover { background: #e5e7eb; transform: rotate(90deg); }
.ec-modal-image img { width:100%; max-height:340px; object-fit:cover; border-radius:20px 20px 0 0; display:block; }
.ec-modal-body { padding: 32px; }
.ec-modal-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 18px;
    line-height: 1.25;
}
.ec-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}
.ec-modal-meta span {
    background: linear-gradient(135deg, #f5f3ff, #eff6ff);
    border: 1px solid #ddd6fe;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    color: #374151;
}
.ec-modal-description { color: #374151; line-height: 1.75; font-size: 0.97rem; }

/* ── Popup Overlay — transition-based show/hide ── */
/*
 * FIX: position classes now use flex alignment on the OVERLAY (not absolute
 * positioning + translate on the box). This prevents the CSS transform
 * conflict where position-translate was overwriting the scale() animation.
 */
.ec-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99980;
    display: flex;
    align-items: center;       /* default: centre vertically   */
    justify-content: center;   /* default: centre horizontally */
    padding: 20px;             /* safe margin from edges       */
    /* Hidden state uses visibility+opacity so display:flex is preserved */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.ec-popup-overlay.ec-popup-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.ec-popup-box {
    /* NO position:absolute — box is a flex child, positioned by parent */
    width: 480px;
    max-width: calc(100vw - 40px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 0 0 2px rgba(124,58,237,0.25),
        0 0 0 5px rgba(37,99,235,0.1),
        0 24px 80px rgba(0,0,0,0.38),
        0 0 40px rgba(124,58,237,0.2);
    /* Only scale animation — no translate conflict */
    transform: scale(0.78) translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), opacity 0.4s ease;
    opacity: 0;
    background: #fff;
}
.ec-popup-visible .ec-popup-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Animated gradient top border */
.ec-popup-box::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #7c3aed, #2563eb, #7c3aed);
    background-size: 200% 100%;
    animation: ec-border-flow 3s linear infinite;
}
@keyframes ec-border-flow {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Popup positions — flex alignment on overlay, no transform on box */
.ec-popup-position-top-left     { align-items: flex-start; justify-content: flex-start; }
.ec-popup-position-top-center   { align-items: flex-start; justify-content: center;      }
.ec-popup-position-top-right    { align-items: flex-start; justify-content: flex-end;   }
.ec-popup-position-center-left  { align-items: center;     justify-content: flex-start; }
.ec-popup-position-center-center{ align-items: center;     justify-content: center;      }
.ec-popup-position-center-right { align-items: center;     justify-content: flex-end;   }
.ec-popup-position-bottom-left  { align-items: flex-end;   justify-content: flex-start; }
.ec-popup-position-bottom-center{ align-items: flex-end;   justify-content: center;      }
.ec-popup-position-bottom-right { align-items: flex-end;   justify-content: flex-end;   }

.ec-popup-image { overflow: hidden; }
.ec-popup-image img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.ec-popup-image:hover img { transform: scale(1.03); }
.ec-popup-body { padding: 24px 24px 22px; }
.ec-popup-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 14px;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.ec-popup-date, .ec-popup-time {
    margin: 7px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 7px;
    color: #374151;
}
.ec-popup-speaker, .ec-popup-location {
    margin: 6px 0;
    font-size: 0.875rem;
    color: #4b5563;
}
.ec-popup-desc { margin-top: 14px; line-height: 1.68; font-size: 0.9rem; color: #4b5563; }
.ec-popup-close {
    position: absolute;
    top: 14px; right: 14px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 50%;
    width: 32px; height: 32px;
    font-size: 18px;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 0.2s, transform 0.2s;
}
.ec-popup-close:hover { background: rgba(255,255,255,1); transform: rotate(90deg); }

/* ══════════════════════════════════════════════════
   Filter Bar
══════════════════════════════════════════════════ */
.ec-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin: 0 auto 40px;
    padding: 14px 20px;
    background: #ffffff;
    border-radius: 50px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    max-width: fit-content;
}

.ec-filter-btn {
    padding: 9px 22px;
    background: transparent;
    border: none;
    border-radius: 30px;
    font-size: 13.5px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.22s ease;
    outline: none;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
}
.ec-filter-btn:hover {
    background: #f3f0ff;
    color: #7c3aed;
}
.ec-filter-btn.active {
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.35);
}

/* Center the filter bar wrapper */
.ec-filter-bar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}
.ec-filter-bar-wrap .ec-filter-bar {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .ec-filter-bar {
        border-radius: 14px;
        padding: 12px;
        max-width: 100%;
        gap: 6px;
    }
    .ec-filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ══════════════════════════════════════════════════
   Sub-Programs in Modal
══════════════════════════════════════════════════ */
.ec-modal-sub-programs {
    margin-top: 24px;
    border-top: 2px solid #f3f4f6;
    padding-top: 20px;
}
.ec-modal-sub-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #374151;
    margin: 0 0 16px;
}
.ec-sub-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ec-sub-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 10px;
    border-left: 4px solid #7c3aed;
    transition: background 0.2s;
}
.ec-sub-item:hover { background: #f3f4f6; }
.ec-sub-item-time {
    min-width: 120px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #2563eb;
    background: #dbeafe;
    padding: 4px 10px;
    border-radius: 20px;
    text-align: center;
    white-space: nowrap;
    align-self: center;
}
.ec-sub-item-info {
    flex: 1;
}
.ec-sub-item-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}
.ec-sub-item-meta {
    display: inline-block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-right: 12px;
}

/* ══════════════════════════════════════════════════
   Weekly Card — Sub-program list
══════════════════════════════════════════════════ */
.ec-prog-card--weekly .ec-prog-day-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    margin: 0 0 14px;
    padding: 6px 12px;
    background: #f5f3ff;
    border-radius: 20px;
    width: fit-content;
}

.ec-prog-sub-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 0 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.ec-prog-sub-item {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}
.ec-prog-sub-item:last-child { border-bottom: none; }
.ec-prog-sub-item:hover { background: #f9fafb; }

.ec-prog-sub-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ec-prog-sub-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.ec-prog-sub-time {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 10px;
}

.ec-prog-sub-desc {
    margin: 6px 0 4px;
    font-size: 0.85rem;
    opacity: 0.8;
    line-height: 1.5;
}

.ec-prog-sub-meta {
    display: inline-block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-right: 10px;
    margin-top: 4px;
}

/* ── Modal weekly day badge ── */
.ec-modal-day-badge {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: #f5f3ff;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #374151;
}

.ec-sub-item-desc {
    margin: 6px 0 4px;
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.55;
}

/* ── Empty programs state ── */
.ec-no-programs {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 1.1rem;
    font-style: italic;
}

/* ══════════════════════════════════════════════════
   Additional / Multiple Time Slots
══════════════════════════════════════════════════ */
.ec-prog-time .ec-time-separator,
.ec-popup-time .ec-time-separator {
    color: #9ca3af;
    margin: 0 4px;
    font-weight: 400;
}

/* Better sub-item time badge with multiple slots */
.ec-sub-item-time {
    min-width: 110px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #2563eb;
    background: #dbeafe;
    padding: 4px 10px;
    border-radius: 20px;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    align-self: flex-start;
    margin-top: 2px;
}

/* Custom date display in modal/card */
.ec-prog-date,
.ec-modal-meta .ec-modal-date {
    word-break: break-word;
    white-space: normal;
}

/* Schedule mode badge in modal */
.ec-modal-schedule-mode {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #7c3aed;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    padding: 2px 9px;
    border-radius: 10px;
    margin-bottom: 10px;
}
