/* --- Modern Temple Design System --- */
:root {
    --temple-saffron: #FF9933;
    --temple-maroon: #800000;
    --temple-gold: #FFD700;
    --temple-gold-light: rgba(255, 215, 0, 0.15);
    --temple-orange-warm: #FF8C00;
    --temple-cream: #FFFDF5;
    --temple-cream-accent: #FDF5E6;
    --temple-dark: #1A1A1A;
    --temple-gray: #4A4A4A;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
}

.bg-maroon {
    background-color: var(--temple-maroon) !important;
}

.text-maroon {
    color: var(--temple-maroon) !important;
}

* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

html {
    scroll-padding-top: 70px; /* Matched to navbar height */
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--temple-cream);
    color: var(--temple-dark);
    line-height: 1.6;
    padding-top: 70px; /* Precise space for fixed navbar */
    overflow-x: hidden; /* Moved from html to fix mobile fixed position drift */
}

h1,
h2,
h3,
h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

/* --- Navigation --- */
.navbar {
    background-color: white !important;
    border-bottom: 2px solid var(--temple-gold);
    height: 70px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 999999 !important; /* Maximum priority */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    -webkit-transform: translate3d(0, 0, 0) !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    contain: paint; /* Isolate navbar rendering from page scroll */
}



.navbar-brand {
    font-size: 1.8rem;
    color: var(--temple-maroon) !important;
    letter-spacing: 1px;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--temple-dark) !important;
    position: relative;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s;
    text-decoration: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--temple-saffron);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

.nav-link:hover,
.nav-link.active {
    color: var(--temple-saffron) !important;
}

.btn-booking {
    background: linear-gradient(135deg, var(--temple-maroon), #b30000);
    color: white !important;
    border-radius: 50px;
    padding: 10px 28px;
    font-weight: 600;
    border: none;
    box-shadow: 0 4px 15px rgba(128, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-booking:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(128, 0, 0, 0.3);
    color: white;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
        url('../img/hero_bg.png');
    /* Fallback to placeholder if not found */
    background-size: cover;
    background-position: center;
    min-height: calc(95svh - 70px); /* Use svh for mobile stability */
    display: flex;
    align-items: center;
    color: white;
    text-align: center;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15svh; /* Use svh */
    background: linear-gradient(transparent, var(--temple-cream));
}

.hero-content h1 {
    font-size: clamp(3rem, 8vw, 5rem);
    margin-bottom: 2rem;
    text-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
    background: linear-gradient(to bottom, #ffffff, var(--temple-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.3rem;
    max-width: 800px;
    margin: 0 auto 3rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.9);
}

/* --- Sections --- */
section {
    padding: 100px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
}

.section-title h2 {
    font-size: 2.8rem;
    color: var(--temple-maroon);
}

.section-title span {
    display: block;
    font-size: 1rem;
    color: var(--temple-saffron);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
}

.section-title::after {
    content: '✵';
    display: block;
    font-size: 1.2rem;
    color: var(--temple-gold);
    margin-top: 10px;
}

/* --- Feature Cards --- */
.card-service {
    background: white;
    padding: 3rem 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-top: 4px solid var(--temple-saffron);
    border-radius: 20px;
    text-align: center;
    transition: all 0.4s ease;
    height: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
}

.card-service:hover {
    transform: translateY(-15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

.card-icon {
    width: 80px;
    height: 80px;
    line-height: 80px;
    background: var(--temple-cream-accent);
    color: var(--temple-orange-warm);
    font-size: 2rem;
    border-radius: 50%;
    margin: 0 auto 2rem;
    transition: all 0.3s;
}

.card-service:hover .card-icon {
    background: var(--temple-saffron);
    color: white;
    transform: rotateY(180deg);
}

/* --- Booking Portal --- */
.booking-container {
    background: white;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
}

.booking-form {
    padding: 60px;
}

.form-control,
.form-select {
    border: none;
    border-bottom: 2px solid #eee;
    border-radius: 0;
    padding: 15px 0;
    background: transparent;
    transition: all 0.3s;
}

.form-control:focus,
.form-select:focus {
    box-shadow: none;
    border-color: var(--temple-saffron);
    outline: none;
}

.booking-info {
    background: linear-gradient(135deg, var(--temple-maroon), var(--temple-dark));
    color: white;
    padding: 60px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- Calendar Overlay --- */
.calendar-wrapper {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--temple-gold);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.calendar-day.booked {
    border-color: var(--temple-maroon);
    background: rgba(128, 0, 0, 0.05);
    color: var(--temple-maroon);
    opacity: 0.7;
}

.calendar-day.available {
    border-color: #28a745;
    color: #28a745;
}

.calendar-day.past {
    background: #f8f9fa;
    color: #ced4da;
    cursor: not-allowed !important;
    opacity: 0.5;
    pointer-events: none;
}

.calendar-day:hover {
    background: var(--temple-gold);
    color: var(--temple-maroon);
}

/* --- Success Modal --- */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100svh;
    background: rgba(26, 26, 26, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}

.success-modal {
    background: var(--temple-cream);
    padding: 3rem;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    border: 3px solid var(--temple-gold);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--temple-gold);
    color: var(--temple-maroon);
    border-radius: 50%;
    line-height: 80px;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
}

/* --- Prasad Grid --- */
.prasad-card {
    border-radius: 20px;
    border: none;
    overflow: hidden;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.prasad-img-wrap {
    overflow: hidden;
    position: relative;
    height: 250px;
}

.prasad-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.price-tag {
    font-size: 1.5rem;
    color: var(--temple-maroon);
    font-weight: 800;
    margin: 1rem 0;
}

/* --- Rituals --- */
.ritual-schedule {
    background: white;
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.05);
}

.ritual-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px dashed #eee;
}

.ritual-time {
    background: var(--temple-cream-accent);
    color: var(--temple-maroon);
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 10px;
}

/* --- Heritage --- */
.heritage-card {
    background: white;
    border-radius: 30px;
    padding: 60px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.08);
}

.timeline {
    border-left: 2px solid var(--temple-gold);
    padding-left: 30px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -41px;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--temple-maroon);
    border: 4px solid var(--temple-gold);
}

/* --- Gallery --- */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    height: 300px;
    margin-bottom: 24px;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(128, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s;
    color: white;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* --- Contact --- */
.contact-card {
    background: white;
    border-radius: 30px;
    padding: 50px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06);
}

.contact-info-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
}

.contact-info-icon {
    width: 60px;
    height: 60px;
    background: var(--temple-cream-accent);
    color: var(--temple-maroon);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 20px;
}

.contact-map-wrap {
    border-radius: 30px;
    overflow: hidden;
    height: 100%;
}

body.menu-open {
    overflow: hidden !important;
    height: 100svh;
}

.footer {
    background: var(--temple-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 100px 0 30px;
}

.footer-logo {
    color: white !important;
    font-size: 2.2rem;
    margin-bottom: 2rem;
    display: block;
    text-decoration: none;
}

.social-circle {
    width: 45px;
    height: 45px;
    line-height: 45px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    display: inline-block;
    text-align: center;
    border-radius: 50%;
    margin-right: 15px;
    transition: all 0.3s;
    text-decoration: none;
}

.social-circle:hover {
    background: var(--temple-saffron);
    transform: translateY(-5px);
    color: white;
}

/* --- Success Modal --- */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 26, 26, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
}

.success-modal {
    background: var(--temple-cream);
    padding: 3rem;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
    border: 3px solid var(--temple-gold);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-icon {
    width: 100px;
    height: 100px;
    background: var(--temple-gold);
    color: var(--temple-maroon);
    border-radius: 50%;
    line-height: 100px;
    font-size: 3rem;
    margin: 0 auto 2rem;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Responsiveness & Mobile Optimization --- */
@media (max-width: 991px) {
    .navbar {
        display: none !important; /* Completely hide topbar on mobile */
    }

    body {
        padding-top: 0 !important; /* Remove space for hidden navbar */
    }

    section {
        padding: 60px 0;
    }

    .section-title h2 {
        font-size: 2.2rem;
    }

    .navbar-collapse {
        background: white;
        position: fixed;
        top: 70px;
        /* Aligned to the new explicit navbar height */
        left: 0;
        width: 100%;
        padding: 1rem 0;
        border-bottom: 2px solid var(--temple-gold);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 999;
    }

    .navbar-nav {
        padding: 0 1.5rem;
    }

    .nav-link {
        padding: 1rem 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        font-size: 1.1rem;
    }

    .navbar-nav li:last-child .nav-link {
        border-bottom: none;
    }

    .nav-link::after {
        display: none;
    }

    .btn-booking {
        width: 100%;
        text-align: center;
        margin-top: 1rem;
    }

    .hero-section {
        min-height: 80vh;
    }

    .hero-content h1 {
        font-size: 3rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    /* Stack hero buttons on mobile and adjust size */
    .hero-section .d-flex {
        flex-direction: column;
        padding: 0 20px;
    }

    .hero-section .btn {
        width: 100%;
        padding: 12px 20px !important;
        font-size: 1rem !important;
    }

    #services .row {
        row-gap: 15px;
        /* Reduced gap between cards */
    }

    .btn-booking {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    .booking-form,
    .booking-info,
    .heritage-card {
        padding: 40px 25px;
    }

    .booking-container {
        border-radius: 0;
    }

    .contact-card {
        padding: 30px 20px;
    }

    .contact-map-wrap {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .section-title h2 {
        font-size: 1.8rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-section {
        min-height: 70vh;
    }

    .card-service {
        padding: 2.5rem 1.5rem;
    }

    .ritual-schedule {
        padding: 25px;
    }

    .ritual-name {
        font-size: 1rem;
    }

    .success-modal {
        padding: 2rem 1.5rem;
    }

    .footer {
        padding: 60px 0 30px;
    }
}

@media (max-width: 576px) {
    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .section-title span {
        font-size: 0.8rem;
        letter-spacing: 2px;
    }

    .booking-form {
        padding: 30px 15px;
    }

    .calendar-wrapper {
        padding: 15px;
    }

    .calendar-day {
        font-size: 0.8rem;
    }
}