/* --- Global Styles & Variables --- */
:root {
    --gold: #FFD700;
    --royal-blue: #4169E1;
    --purple: #800080;
    --white: #FFFFFF;
    --dark-text: #333333;
    --light-bg: #f4f4f9;

    --font-heading: 'Cinzel', serif;
    --font-body: 'Lora', serif;
}
html, body {
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

body {
    font-family: var(--font-body);
    color: var(--dark-text);
    margin: 0;
    background-color: var(--white);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--royal-blue);
    font-weight: 700;
}

h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
}

section {
    padding: 60px 0;
}

/* --- Header --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px; /* Adjusted padding for mobile */
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo img {
    height: 50px; /* Slightly smaller logo on mobile */
    width: auto;
}

/* --- Livestream Banner --- */
.livestream-banner {
    background-color: var(--purple);
    padding: 20px;
}

.livestream-banner h2 {
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: pulse 1.5s infinite;
}

.live-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #ff0000;
    border-radius: 50%;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 900px;
    margin: 15px auto 0;
    border: 4px solid var(--gold);
    border-radius: 10px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* --- Hero Slider --- */
.hero-slider {
    width: 100%;
    height: auto; 
    aspect-ratio: 16 / 9; /* This makes it responsive by default */
    max-height: 95vh; 
    padding: 0;
    overflow: hidden;
    position: relative;
}

.hero-swiper .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.hero-swiper video, .hero-swiper img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.slide-overlay-text {
    position: absolute;
    color: var(--white);
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px 40px;
    border-radius: 10px;
}
.slide-overlay-text h1 {
    color: var(--white);
    font-size: 3.5rem;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.swiper-button-next, .swiper-button-prev {
    color: var(--gold) !important;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;                  /* above overlay text */
    background-color: rgba(0,0,0,0.3);
    border-radius: 50%;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}
.swiper-button-next:hover, .swiper-button-prev:hover {
    background-color: rgba(0,0,0,0.6);
}

.swiper-button-next::after, .swiper-button-prev::after {
    font-size: 24px !important;
}

/* --- Events Section --- */
.events-section {
    background-color: var(--light-bg);
}

.event-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.event-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(65, 105, 225, 0.2);
}

.event-media {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.event-info {
    padding: 20px;
    flex-grow: 1;
}

.event-date {
    font-weight: bold;
    color: var(--purple);
}

.event-location-link {
    display: inline-block;
    margin-top: 15px;
    background-color: var(--royal-blue);
    color: var(--white);
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.event-location-link:hover {
    background-color: #3557b4;
}

.swiper-pagination-bullet-active {
    background: var(--royal-blue) !important;
}
/* Add space to the bottom of the events slider for the pagination */
.events-swiper {
    position: relative;
    padding-top: 40px;
    padding-bottom: 40px; 
}

/* Reposition the pagination dots to the bottom */
.events-swiper .swiper-pagination {
    position: absolute;
    bottom: 10px; /* Aligns the dots to the bottom of the container */
    left: 0;
    width: 100%;
}

/* --- Sermons Section --- */
.sermons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px; /* space between h2 and cards */
}

.loading-text {
    text-align: center;
    grid-column: 1 / -1;
}

.sermon-item {
    text-decoration: none;
    color: inherit;
    display: block;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.sermon-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.sermon-item img {
    width: 100%;
    display: block;
}

/* ✅ Sermon card text styling with theme fonts */
.sermon-item-content {
    padding: 16px; /* breathing room */
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--dark); /* use your theme dark color */
}

.sermon-item-content h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--royal-blue); /* highlight with theme color */
}

.sermon-item-content p {
    font-size: 0.9rem;
    color: var(--dark);
    margin: 0;
    line-height: 1.5;
}

/* Sermons Swiper */
.sermons-swiper {
    position: relative;
    padding-top: 20px;
    padding-bottom: 50px; /* space for dots */
}

.sermons-swiper .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: auto;
}

.sermon-item {
    width: 100%;
    max-width: 350px; /* keep card width tidy */
    margin: 0 auto;
}

.sermons-swiper .swiper-pagination {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
}



/* --- Login & Admin (Shared Styles) --- */
.login-container, .form-container {
    max-width: 450px;
    width: 90%; /* Ensure it shrinks on small screens */
    margin: 50px auto;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

.login-container h2, .form-container h3 {
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="datetime-local"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

.password-wrapper {
    position: relative;
}
.password-wrapper .fa-eye {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: #7f8c8d;
}

.btn, button {
    background-color: var(--royal-blue);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    width: 100%; /* Make buttons full-width */
}

/* --- Animations --- */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- ============================ --- */
/* ---      Responsive Design     --- */
/* --- ============================ --- */

/* For Tablets and smaller desktops */
@media (max-width: 992px) {
    h2 { font-size: 2.2rem; }
    .slide-overlay-text h1 {
        font-size: 2.8rem;
    }
}


/* For Tablets and Mobile Phones */
@media (max-width: 768px) {
    section {
        padding: 40px 0;
    }
    h2 { font-size: 2rem; }
    
    .sermons-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    /* CRITICAL FIX: The old height property that caused issues is REMOVED. */
    /* .hero-slider { height: 60vh; } <-- THIS IS NO LONGER NEEDED */

    .slide-overlay-text h1 {
        font-size: 2.2rem;
    }
}

/* For small mobile phones */
@media (max-width: 480px) {
    body {
        line-height: 1.5;
    }

    .slide-overlay-text {
        padding: 15px 20px;
    }

    .slide-overlay-text h1 {
        font-size: 1.8rem;
    }

    .login-container, .form-container {
        padding: 20px;
    }

    .hero-slider .swiper-button-prev,
    .hero-slider .swiper-button-next {
        top: 50%;                      /* keep vertically centered */
        transform: translateY(-50%);   /* center correctly */
        width: 36px !important;
        height: 36px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    }
    .hero-slider .swiper-button-prev { left: 12px; }
    .hero-slider .swiper-button-next { right: 12px; }

    /* Overlay text padding stays normal */
    .hero-slider .slide-overlay-text {
        padding-bottom: 20px; /* reset, avoid big gap */
        z-index: 20;
    }

    .hero-slider .swiper-button-prev::after,
    .hero-slider .swiper-button-next::after {
        font-size: 14px !important;
    }

    /* Optional: improve touch target */
    .hero-slider .swiper-button-prev,
    .hero-slider .swiper-button-next {
        padding: 6px;
    }
}
