/* ========================================
   India Infrastructure Tracker - Styles
   Minimalist & Modern Design
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Colors - Refined Minimalist Palette */
    --color-primary: #6366F1;
    --color-primary-dark: #4F46E5;
    --color-primary-light: #818CF8;
    --color-secondary: #0F172A;
    --color-secondary-light: #1E293B;
    --color-accent: #10B981;
    --color-accent-light: #34D399;

    /* Status Colors - Softer tones */
    --color-completed: #10B981;
    --color-construction: #F59E0B;
    --color-planned: #3B82F6;
    --color-delayed: #EF4444;

    /* Neutrals - Cleaner dark theme */
    --color-bg: #0A0A0B;
    --color-bg-card: #111113;
    --color-bg-elevated: #18181B;
    --color-text: #FAFAFA;
    --color-text-muted: #71717A;
    --color-border: #27272A;

    /* Gradients - Subtle */
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --gradient-header: linear-gradient(180deg, #111113 0%, #0A0A0B 100%);
    --gradient-card: linear-gradient(180deg, #111113 0%, #0A0A0B 100%);

    /* Shadows - Minimal */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing - More breathing room */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;

    /* Border Radius - Softer */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions - Smooth */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   Header
   ======================================== */
.header {
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: var(--transition-normal);
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.03em;
}

.tagline {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.nav-stats {
    display: flex;
    gap: var(--space-lg);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: var(--transition-normal);
}

.stat-item:hover {
    background: var(--color-bg-elevated);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl);
}

/* ========================================
   Filters Section
   ======================================== */
.filters-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-family);
    background: var(--color-bg-elevated);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    color: var(--color-text);
    transition: var(--transition-normal);
}

.search-input:hover {
    background: var(--color-bg-card);
    border-color: var(--color-border);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-bg-card);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.search-input::placeholder {
    color: var(--color-text-muted);
    font-weight: 400;
}

.filter-buttons {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 160px;
}

.filter-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-left: 0.25rem;
}

.filter-select {
    padding: 0.6rem 1rem;
    padding-right: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-family);
    background: var(--color-bg-elevated);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition-normal);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.filter-select:hover {
    background: var(--color-bg-card);
    border-color: var(--color-border);
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* ========================================
   View Toggle
   ======================================== */
.view-toggle {
    display: flex;
    gap: 0.35rem;
    margin-bottom: var(--space-lg);
    background: var(--color-bg-elevated);
    padding: 0.25rem;
    border-radius: var(--radius-full);
    width: fit-content;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-family);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
}

.view-btn svg {
    width: 16px;
    height: 16px;
}

.view-btn:hover {
    color: var(--color-text);
}

.view-btn.active {
    background: var(--color-bg-card);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Map Container
   ======================================== */
.map-container {
    width: 100%;
    height: 500px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-xl);
}

#map {
    width: 100%;
    height: 100%;
}

/* Leaflet Custom Styling */
.leaflet-popup-content-wrapper {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    color: var(--color-text);
    padding: 0;
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 250px;
}

.leaflet-popup-tip {
    background: var(--color-bg-card);
}

.leaflet-container {
    background: var(--color-bg);
}

/* Dark aesthetic filter for official Mappls tiles */
.leaflet-tile-pane {
    filter: invert(100%) hue-rotate(180deg) brightness(0.95) contrast(0.8);
}

.dark-map {
    filter: inherit;
}

/* Dark Mode Zoom Controls */
.leaflet-control-zoom a {
    background-color: #1f2937 !important;
    color: white !important;
    border-bottom: 1px solid var(--color-border) !important;
}

.leaflet-control-zoom a:hover {
    background-color: #374151 !important;
    color: white !important;
}

.leaflet-bar {
    border: 1px solid var(--color-border) !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-bar a:first-child {
    border-top-left-radius: 4px !important;
    border-top-right-radius: 4px !important;
}

.leaflet-bar a:last-child {
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
    border-bottom: none !important;
}

/* Custom Marker Styles */
.custom-marker {
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Projects Grid
   ======================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.project-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-normal);
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-border);
    background: var(--color-bg-elevated);
}

.card-header {
    padding: var(--space-lg) var(--space-lg) var(--space-sm);
}

.card-category {
    display: inline-block;
    padding: 0.2rem var(--space-sm);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-sm);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.card-location {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.card-body {
    padding: var(--space-sm) var(--space-lg) var(--space-lg);
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.card-stat {
    display: flex;
    flex-direction: column;
}

.card-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-accent);
}

.card-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.progress-container {
    margin-bottom: var(--space-md);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.progress-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.progress-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s ease;
}

.progress-fill.completed {
    background: var(--color-completed);
}

.progress-fill.construction {
    background: var(--color-construction);
}

.progress-fill.planned {
    background: var(--color-planned);
}

.progress-fill.delayed {
    background: var(--color-delayed);
}

.card-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.status-completed {
    background: rgba(72, 187, 120, 0.2);
    color: var(--color-completed);
}

.status-construction {
    background: rgba(246, 173, 85, 0.2);
    color: var(--color-construction);
}

.status-planned {
    background: rgba(99, 179, 237, 0.2);
    color: var(--color-planned);
}

.status-delayed {
    background: rgba(252, 129, 129, 0.2);
    color: var(--color-delayed);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-completed .status-dot {
    background: var(--color-completed);
}

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

.status-planned .status-dot {
    background: var(--color-planned);
}

.status-delayed .status-dot {
    background: var(--color-delayed);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   Results Info
   ======================================== */
.results-info {
    text-align: center;
    padding: var(--space-md);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

#results-count {
    color: var(--color-primary);
    font-weight: 600;
}

/* ========================================
   Modal
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
    z-index: 10;
}

.modal-close:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

#modal-body {
    padding: var(--space-xl);
}

.modal-header {
    margin-bottom: var(--space-xl);
    padding-right: var(--space-xl);
}

.modal-category {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    line-height: 1.2;
}

.modal-location {
    font-size: 1rem;
    color: var(--color-text-muted);
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.modal-stat {
    background: var(--color-bg-elevated);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    text-align: center;
}

.modal-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    display: block;
}

.modal-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-progress {
    margin-bottom: var(--space-xl);
}

.modal-progress .progress-bar {
    height: 12px;
}

.modal-description {
    margin-bottom: var(--space-xl);
}

.modal-description h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.modal-description p {
    color: var(--color-text-muted);
    line-height: 1.7;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.meta-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-size: 0.9rem;
    color: var(--color-text);
}

.meta-value a {
    color: var(--color-primary);
    text-decoration: none;
}

.meta-value a:hover {
    text-decoration: underline;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
    padding: var(--space-xl);
    text-align: center;
}

.footer-content p {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.footer-note {
    margin-top: var(--space-sm);
    font-size: 0.75rem !important;
}

.disclaimer {
    max-width: 800px;
    margin: var(--space-md) auto 0;
    line-height: 1.5;
    font-style: italic;
    opacity: 0.8;
}

/* ========================================
   Utilities
   ======================================== */
.hidden {
    display: none !important;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .header-content {
        padding: var(--space-md);
        flex-direction: column;
        text-align: center;
    }

    .logo {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .logo-text h1 {
        font-size: 1.5rem;
    }

    .nav-stats {
        gap: var(--space-md);
    }

    .stat-item {
        padding: var(--space-xs) var(--space-sm);
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .main-content {
        padding: var(--space-md);
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .map-container {
        height: 350px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: var(--space-md);
    }

    .modal-content {
        max-height: 95vh;
    }

    #modal-body {
        padding: var(--space-lg);
    }

    .modal-title {
        font-size: 1.4rem;
    }

    .modal-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Map popup custom styling */
.map-popup {
    padding: var(--space-md);
}

.map-popup-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.map-popup-category {
    font-size: 0.75rem;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.map-popup-stats {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.map-popup-btn {
    display: block;
    width: 100%;
    padding: var(--space-sm);
    margin-top: var(--space-sm);
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.map-popup-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}