/* LDS Temples Timeline Map - Custom Styles */
/* Mobile-first design - optimized for touch interfaces */

:root {
    --status-announced: #3b82f6;
    --status-construction: #f59e0b;
    --status-operating: #10b981;
    --status-closed: #ef4444;
    --touch-target-min: 44px; /* Minimum touch target size */
}

body {
    margin: 0;
    padding: 0;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
}

.container-fluid {
    padding: 0.75rem;
    max-width: 100%;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem; /* Smaller on mobile */
}

header p {
    color: var(--muted-color);
    margin-top: 0;
    font-size: 0.9rem;
}

/* Timeline Controls - Mobile First */
#timeline-controls {
    background: var(--card-background-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--card-box-shadow);
}

#timeline-controls .grid {
    margin-bottom: 1rem;
    gap: 0.75rem; /* Better spacing on mobile */
}

/* Year input and slider */
#year-input {
    min-height: var(--touch-target-min);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

#year-slider {
    min-height: var(--touch-target-min);
    cursor: pointer;
}

/* Larger select dropdowns for mobile */
#month-select,
#day-select {
    min-height: var(--touch-target-min);
    font-size: 1rem;
}

/* Legend - Mobile Optimized */
#legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--muted-border-color);
    font-size: 0.875rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem; /* Easier to tap */
}

.marker {
    display: inline-block;
    width: 18px; /* Slightly larger for mobile */
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0; /* Prevent shrinking */
}

.marker.announced {
    background-color: var(--status-announced);
}

.marker.under_construction {
    background-color: var(--status-construction);
}

.marker.operating {
    background-color: var(--status-operating);
}

.marker.closed {
    background-color: var(--status-closed);
}

/* Map and List Layout - Mobile First (Vertical Stack) */
.grid > div {
    margin-bottom: 1rem;
}

#map-container {
    position: relative;
    order: 1; /* Map first on mobile */
}

#map {
    /* Taller map on mobile for better usability */
    height: 500px;
    width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-box-shadow);
    /* Improve touch interaction */
    touch-action: pan-x pan-y;
}

#map-info {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
}

#list-container {
    background: var(--card-background-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--card-box-shadow);
    /* Scrollable list on mobile */
    max-height: 450px;
    overflow-y: auto;
    /* Smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    order: 2; /* List second on mobile */
}

#list-header {
    position: sticky;
    top: 0;
    background: var(--card-background-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
    z-index: 10;
    border-bottom: 1px solid var(--muted-border-color);
}

#list-header h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

#list-header label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin: 0;
    cursor: pointer;
}

#filter-by-viewport {
    margin: 0;
    cursor: pointer;
}

/* Temple List Items - Touch Optimized */
.temple-item {
    padding: 1rem; /* Larger padding for easier tapping */
    margin-bottom: 0.75rem;
    border-left: 5px solid var(--muted-border-color); /* Thicker border on mobile */
    background: var(--code-background-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Minimum touch target */
    min-height: var(--touch-target-min);
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Prevent text selection on tap */
    -webkit-user-select: none;
    user-select: none;
    /* Better tap feedback */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.temple-item:active {
    transform: scale(0.98);
    background: var(--card-background-color);
}

.temple-item.selected {
    background: var(--primary-focus);
    border-left-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.temple-item.announced {
    border-left-color: var(--status-announced);
}

.temple-item.under_construction {
    border-left-color: var(--status-construction);
}

.temple-item.operating {
    border-left-color: var(--status-operating);
}

.temple-item.closed {
    border-left-color: var(--status-closed);
}

.temple-item h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.temple-item .location {
    color: var(--muted-color);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.temple-item .status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.temple-item .status.announced {
    color: var(--status-announced);
}

.temple-item .status.under_construction {
    color: var(--status-construction);
}

.temple-item .status.operating {
    color: var(--status-operating);
}

.temple-item .status.closed {
    color: var(--status-closed);
}

/* Debug View */
#debug-view {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--card-background-color);
    border-radius: var(--border-radius);
    box-shadow: var(--card-box-shadow);
}

#debug-view summary {
    cursor: pointer;
    font-weight: 600;
}

#debug-content {
    margin-top: 1rem;
}

.event-timeline {
    list-style: none;
    padding-left: 1rem;
    border-left: 2px solid var(--muted-border-color);
}

.event-timeline li {
    padding: 0.5rem 0 0.5rem 1rem;
    position: relative;
}

.event-timeline li::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0.75rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--background-color);
}

.event-type {
    font-weight: 600;
    text-transform: capitalize;
}

.event-date {
    color: var(--muted-color);
    font-size: 0.875rem;
}

.event-source {
    color: var(--muted-color);
    font-size: 0.75rem;
    font-style: italic;
}

/* Footer - Condensed Single Line */
footer {
    margin-top: 2rem;
    padding: 1rem 0;
    border-top: 1px solid var(--muted-border-color);
    text-align: center;
    color: var(--muted-color);
}

footer small {
    font-size: 0.75rem;
}

/* Desktop Enhancements (Desktop is OPTIONAL, mobile is primary) */
@media (min-width: 768px) {
    /* Larger header on desktop */
    header h1 {
        font-size: 2.5rem;
    }

    header p {
        font-size: 1rem;
    }

    /* More padding on desktop */
    .container-fluid {
        padding: 1.5rem;
    }

    #timeline-controls {
        padding: 1.5rem;
    }

    /* Side-by-side layout on desktop */
    .grid {
        grid-template-columns: 2fr 1fr;
        display: grid;
    }

    #timeline-controls .grid {
        grid-template-columns: 2fr 1fr 1fr;
    }

    /* Taller map on desktop */
    #map {
        height: 600px;
    }

    /* Taller list on desktop */
    #list-container {
        max-height: 600px;
        padding: 1.5rem;
    }

    /* Smaller temple items on desktop (hover available) */
    .temple-item {
        padding: 0.75rem;
    }

    .temple-item:hover {
        background: var(--card-background-color);
        transform: translateX(4px);
    }

    /* Remove active scale on desktop */
    .temple-item:active {
        transform: translateX(4px);
    }
}

/* Extra large screens */
@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Leaflet Marker Customization */
.leaflet-marker-icon {
    border-radius: 50%;
}

/* Fix Leaflet image paths */
.leaflet-default-icon-path {
    background-image: url('vendor/images/marker-icon.png');
}

/* Marker Cluster Customization */
.marker-cluster {
    background-color: rgba(128, 128, 128, 0.6) !important; /* Neutral gray */
    border-radius: 50%;
}

.marker-cluster div {
    background-color: rgba(96, 96, 96, 0.8) !important; /* Darker gray */
    border-radius: 50%;
    color: white !important;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    height: 100% !important;
}

.marker-cluster span {
    line-height: 1;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Different sizes for cluster groups */
.marker-cluster-small div {
    width: 35px !important;
    height: 35px !important;
}

.marker-cluster-medium div {
    width: 40px !important;
    height: 40px !important;
    font-size: 15px;
}

.marker-cluster-large div {
    width: 45px !important;
    height: 45px !important;
    font-size: 16px;
}
