:root {
    --primary-color: #B91C1C;
    --secondary-color: #F59E0B;
    --background-color: #F8F4F1;
    --surface-color: #FFFFFF;
    --text-color: #262626;
    --text-muted: #525252;
    /* MODIFIED: Changed to the new Puja vibe font */
    --font-heading: 'Atma', cursive;
    --font-body: 'Montserrat', sans-serif;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background-color: var(--background-color);
    color: var(--text-color);
    overscroll-behavior: none;
}

#app-container { display: flex; flex-direction: column; height: 100vh; }
.content { flex-grow: 1; overflow-y: auto; padding-bottom: 70px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Pandal Directory --- */
.directory-container { display: flex; height: calc(100vh - 70px); }
.sidebar { width: 420px; background: var(--background-color); border-right: 1px solid #e5e5e5; display: flex; flex-direction: column; }

/* MODIFIED: New Aesthetic Header Design */
.sidebar-header {
    height: 120px;
    background: var(--primary-color);
    /* A subtle, traditional pattern representing Alpona art */
    background-image:
        linear-gradient(135deg, rgba(185, 28, 28, 0.95), rgba(153, 27, 27, 1)),
        url('traditional-mandala.png'); /* THIS IS THE CORRECTED LINE */
    background-size: auto, 50px; /* Control pattern size */
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 4px solid var(--secondary-color);
    position: relative;
    /* MODIFIED: Adjusted padding to better center the new font */
    padding-top: 8px;
}
.header-content h1 { font-family: var(--font-heading); color: white; font-size: 2.8rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
.search-filter-box { padding: 1rem; background: #fff; border-bottom: 1px solid #e5e5e5; }
#searchInput, .filters select { width: 100%; padding: 0.8rem; background: #f0f0f0; border: 1px solid #d4d4d4; border-radius: 8px; margin-bottom: 0.5rem; }
.filters { display: flex; gap: 0.5rem; }
.pandal-list-container { flex-grow: 1; overflow-y: auto; padding: 1rem; }
.pandal-card { background: var(--surface-color); margin-bottom: 1rem; padding: 1rem; border-radius: 10px; border-left: 5px solid var(--secondary-color); box-shadow: var(--shadow); cursor: pointer; }
.pandal-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.pandal-card h3 { font-size: 1.1rem; }
.add-to-plan-container { display: flex; align-items: center; gap: 5px; }
.day-selector { padding: 4px; border-radius: 4px; border: 1px solid #ccc; font-size: 0.8rem; }
.add-to-plan-btn { background: none; border: 1px solid #d4d4d4; color: var(--primary-color); font-size: 1rem; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; }
.pandal-card p { margin: 0.5rem 0; font-size: 0.9rem; color: var(--text-muted); }
.map-view { flex-grow: 1; }
#map { width: 100%; height: 100%; }

/* --- Itinerary & Essentials Pages --- */
.page-container { padding: 1.5rem; }
.page-container h2 { font-family: var(--font-heading); font-size: 2rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.itinerary-actions { display: flex; gap: 10px; }
.itinerary-actions button { background-color: var(--secondary-color); color: var(--text-color); border: none; padding: 10px 15px; border-radius: 8px; font-weight: bold; cursor: pointer; font-family: var(--font-body); }
.itinerary-planner .day-tabs { display: flex; overflow-x: auto; margin-bottom: 1rem; border-bottom: 1px solid #ddd; }
.day-tab { background: none; border: none; padding: 10px 15px; cursor: pointer; font-size: 1rem; color: var(--text-muted); border-bottom: 3px solid transparent; }
.day-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.essentials-grid { display: grid; gap: 1rem; }
.essential-card { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: var(--shadow); }
.essential-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Changed from space-between to flex-start */
}
.essential-card h3 > i:first-child {
    margin-right: 10px; /* Added margin to the first icon */
}
.essential-card ul { list-style: none; padding-left: 0; }
.essential-card ul li { margin-bottom: 0.5rem; }
.essential-map-icon {
    color: var(--text-muted);
    font-size: 1rem;
    margin-left: auto; /* Added to push the icon to the right */
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--surface-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: grid; /* Use grid for better control on all devices */
    grid-template-columns: repeat(4, 1fr);
    justify-items: center;
    align-items: center;
    z-index: 100;
}
.nav-btn { background: none; border: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.75rem; cursor: pointer; }
.nav-btn i { font-size: 1.5rem; }
.nav-btn.active { color: var(--primary-color); }

.pandal-card-actions { margin-top: 1rem; display: flex; justify-content: flex-end; }
.navigate-btn { background-color: var(--primary-color); color: white; padding: 6px 12px; border-radius: 6px; text-decoration: none; font-weight: 500; font-size: 0.9rem; transition: background-color 0.2s; }
.navigate-btn:hover { background-color: #991B1B; }

/* --- Itinerary Card Styles --- */
.day-plan-content { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; padding-top: 1rem; counter-reset: pandal-counter; }
.plan-item-card { background: var(--surface-color); border-radius: 12px; box-shadow: var(--shadow); padding: 1rem; display: flex; align-items: center; gap: 1rem; transition: transform 0.2s ease-in-out; position: relative; overflow: visible; }
.plan-item-card:hover { transform: translateY(-4px); }
.plan-item-card::before {
    counter-increment: pandal-counter; content: counter(pandal-counter);
    position: absolute; top: -12px; left: -12px;
    background-color: var(--primary-color); color: white;
    width: 32px; height: 32px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1rem;
    border: 3px solid var(--surface-color); box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}
.plan-item-icon { font-size: 1.5rem; color: var(--primary-color); background-color: #fee2e2; border-radius: 50%; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; }
.plan-item-details h4 { margin: 0; font-size: 1.1rem; color: var(--text-color); }
.plan-item-details p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.remove-from-plan-btn { margin-left: auto; background: #f1f1f1; color: var(--text-muted); border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; transition: background-color 0.2s, color 0.2s; }
.remove-from-plan-btn:hover { background-color: #fee2e2; color: var(--primary-color); }
.day-plan-empty { text-align: center; padding: 40px 20px; background-color: #fff; border-radius: 12px; box-shadow: var(--shadow); grid-column: 1 / -1; }

/* --- Modal Styles --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.visible { display: flex; }
.modal-content { background-color: var(--surface-color); padding: 20px; border-radius: 12px; box-shadow: 0 5px 25px rgba(0,0,0,0.2); width: 90%; max-width: 800px; position: relative; max-height: 90vh; overflow-y: auto;}
.modal-close-btn { position: absolute; top: 10px; right: 20px; font-size: 2.5rem; color: #aaa; cursor: pointer; line-height: 1; z-index: 1001; }
#routeMapContainer { width: 100%; height: 65vh; border-radius: 8px; background-color: #e0e0e0; }
.google-maps-btn { display: block; width: 100%; text-align: center; background-color: #4285F4; color: white; padding: 12px; border-radius: 8px; text-decoration: none; font-weight: bold; margin-top: 15px; }
.google-maps-btn i { margin-right: 8px; }

/* --- Pandal Detail Modal Styles --- */
#pandalDetailContent .pandal-image { width: 100%; height: 250px; object-fit: cover; border-radius: 8px; margin-bottom: 1rem; }
#pandalDetailContent h2 { font-family: var(--font-heading); font-size: 2rem; color: var(--primary-color); margin-bottom: 0.5rem; }
#pandalDetailContent .pandal-tags { margin-bottom: 1rem; }
#pandalDetailContent .pandal-tags span { background: #fee2e2; color: var(--primary-color); padding: 3px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 500; }
#pandalDetailContent h4 { margin-top: 1.5rem; margin-bottom: 0.5rem; border-bottom: 2px solid var(--secondary-color); padding-bottom: 5px; font-size: 1.2rem; }
#pandalDetailContent p { line-height: 1.6; color: var(--text-muted); }

/* --- Professional Share Card Design --- */
.share-card-template { position: absolute; left: -9999px; top: 0; width: 600px; padding: 30px; background-color: #FFF8E1; background-image: url('traditional-mandala.png'); font-family: var(--font-body); color: var(--text-color); }
.share-card-header { text-align: center; border-bottom: 2px solid var(--primary-color); padding-bottom: 15px; margin-bottom: 20px; }
.share-card-header h2 { font-family: 'Montserrat', sans-serif; font-size: 2.5rem; color: var(--primary-color); margin: 0; }
.share-card-header p { font-family: 'Tiro Bangla', serif; font-size: 1.8rem; color: var(--secondary-color); margin: 0; }
.share-card-list { counter-reset: pandal-counter; }
.share-card-item { display: flex; align-items: center; background: rgba(255, 255, 255, 0.7); border-radius: 8px; padding: 10px; margin-bottom: 10px; border-left: 4px solid var(--secondary-color); }
.share-card-item::before {
    counter-increment: pandal-counter; content: counter(pandal-counter);
    background-color: var(--primary-color); color: white;
    width: 30px; height: 30px; min-width: 30px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1rem;
    margin-right: 15px;
}
.share-card-item-details h4 { margin: 0; font-size: 1.2rem; }
.share-card-item-details p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.share-card-footer { margin-top: 20px; text-align: center; font-size: 0.8rem; color: var(--text-muted); }

/* Responsive adjustments */
@media (max-width: 768px) {
    .directory-container { flex-direction: column; height: auto; }
    .sidebar { width: 100%; height: 55vh; border-right: none; }
    .map-view { height: calc(100vh - 55vh - 70px); }
    .content { padding-bottom: 70px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}


/* --- Interactive Highlight for Pandal Cards --- */
.pandal-card.highlight {
    box-shadow: 0 0 15px var(--secondary-color), 0 0 5px var(--secondary-color);
    border-left-color: #ffc107;
    transform: scale(1.02);
}

/* --- "Best Plan" Tab Professional Redesign --- */
#bestPlanContainer {
    display: grid;
    gap: 1.5rem;
}

.itinerary-trail-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

.trail-header {
    padding: 1.5rem;
    background-color: #fffaf0;
    border-bottom: 1px solid #e5e5e5;
}

.trail-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.trail-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--primary-color);
    line-height: 1.2;
}

.trail-day {
    background-color: var(--secondary-color);
    color: var(--text-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 1rem;
}

.trail-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.trail-meta {
    padding: 1rem 1.5rem;
    background-color: var(--background-color);
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-bottom: 1px solid #e5e5e5;
}

.trail-meta > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.trail-meta i {
    color: var(--primary-color);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.trail-stops-list {
    list-style: none;
    padding: 1.5rem;
    position: relative;
}

.trail-stop-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "details nav"
        "note    nav";
    align-items: center;
    gap: 0.5rem 1rem;
    position: relative;
    padding-left: 30px; /* Space for the timeline line and dot */
    padding-bottom: 1.5rem;
}

.trail-stop-item:last-child {
    padding-bottom: 0;
}

/* The vertical timeline line */
.trail-stop-item::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 5px;
    bottom: -5px;
    width: 2px;
    background-color: #ddd;
}

.trail-stop-item:last-child::before {
    display: none; /* Hide line for the last item */
}

/* The circular timeline dot */
.trail-stop-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 3px solid var(--background-color);
    z-index: 1;
}

.stop-details {
    grid-area: details;
}

.stop-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.stop-region {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.travel-note {
    grid-area: note;
    font-size: 0.85rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 5px;
}

.trail-nav-btn {
    grid-area: nav;
    padding: 6px 14px;
    font-size: 0.9rem;
}

/* --- Styling for the updated "Essentials" tab --- */
.essential-card.interactive {
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.essential-card.interactive:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

/* --- Responsive adjustment for the bottom navigation bar --- */
.bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Changed to 4 columns */
}


/* --- ADDED: Splash Screen Styles --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--background-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.7s ease-out, visibility 0.7s ease-out;
    opacity: 1;
    visibility: visible;
}

#splash-screen img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: pulse 2.5s infinite ease-in-out;
}

#splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Make sure it's not interactable when hidden */
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- Leaflet Map Style Overrides --- */
/* This rule fixes the "cut-off" text issue by ensuring there is adequate space inside the popup */
.leaflet-popup-content {
    margin: 14px 20px;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
}

/* --- NEW: Install Modal Styles --- */
.install-content {
    text-align: center;
    max-width: 400px;
    padding: 40px 20px;
}

.install-content .install-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

.install-content h3 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 1.8rem;
}

.install-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.install-btn {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.install-btn:hover {
    background-color: #e59300;
}