/* Programs Enhanced CSS - v2 */

/* Force light theme colors for content legibility */
:root {
    --program-text-dark: #2c3e50;
    --program-text-light: #6b7280;
    --program-bg-card: #ffffff;
}

/* Base Fixes */
body {
    padding-top: 80px;
    margin: 0;
}

/* --- Hero Section --- */
.programs-hero {
    position: relative;
    height: 60vh;
    min-height: 400px;
    background: linear-gradient(135deg, var(--primary-wine) 0%, #2c1a1d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    overflow: hidden;
    margin-bottom: 4rem;
    border-radius: 0 0 50px 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.programs-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/slide3.jpg') center/cover no-repeat;
    opacity: 0.3;
    z-index: 0;
}

.programs-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 2rem;
    animation: fadeInUp 0.8s ease-out;
}

.programs-hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1rem;
    font-weight: 800;
    color: white !important;
    /* Force white on dark background */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.programs-hero p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9) !important;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Navigation Link Override --- */
/* Ensure nav links are visible against their background */
.tab-btn {
    padding: 0.75rem 2rem;
    border: none;
    background: white;
    color: var(--program-text-dark);
    /* Forced dark text */
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    font-family: var(--font-primary);
}

.tab-btn.active,
.tab-btn:hover {
    background: var(--gradient-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(114, 47, 55, 0.2);
}

.programs-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

/* --- Gallery Grid --- */
.programs-grid-section {
    padding: 2rem 0 5rem;
    /* Ensure background is light so dark text is visible */
    background-color: transparent;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.gallery-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    background: var(--program-bg-card);
    /* Force white background */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.gallery-img-container {
    height: 240px;
    overflow: hidden;
    position: relative;
    background-color: #f1f5f9;
}

.gallery-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-item:hover .gallery-img-container img {
    transform: scale(1.1);
}

.gallery-overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-wine);
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    opacity: 0;
}

.gallery-item:hover .gallery-overlay-icon {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Content Text Styling - Enforcing Colors */
.program-card-content,
.gallery-content {
    padding: 1.5rem;
    background: white;
    /* Ensure white bg */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: rgba(114, 47, 55, 0.08);
    /* Wine tint */
    color: var(--primary-wine);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    align-self: flex-start;
}

/* Titles */
.gallery-item h3,
.gallery-title {
    font-size: 1.25rem;
    font-family: var(--font-display);
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #1f2937 !important;
    /* Force dark gray */
    line-height: 1.3;
}

/* Descriptions */
.gallery-item p {
    font-size: 0.95rem;
    color: #4b5563 !important;
    /* Force medium gray */
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* Links */
.program-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary-wine) !important;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    gap: 0.5rem;
    transition: gap 0.3s ease;
    margin-top: auto;
}

.program-link:hover {
    gap: 0.8rem;
    color: var(--primary-gold) !important;
}

/* --- Modal Gallery --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 2rem;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 10;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-prev,
.modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    backdrop-filter: blur(5px);
}

.modal-prev:hover,
.modal-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-prev {
    left: 30px;
}

.modal-next {
    right: 30px;
}

.modal-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

@media (max-width: 768px) {
    body {
        padding-top: 56px;
    }

    .programs-hero {
        margin-bottom: 2rem;
        min-height: 300px;
    }

    .programs-hero h1 {
        font-size: 2.2rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .modal-prev,
    .modal-next {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .modal-prev {
        left: 10px;
    }

    .modal-next {
        right: 10px;
    }

    .modal-content {
        max-height: 70vh;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 400px) {
    body {
        padding-top: 45px !important;
    }

    .programs-hero {
        margin-bottom: 1.5rem;
        min-height: 250px;
    }
}

.hidden {
    display: none !important;
}