@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700;800&display=swap');

/* Kolkata City Pathfinder - Dark Editorial Refresh */

:root {
    --bg-0: #0b1020;
    --bg-1: #121a31;
    --surface: rgba(15, 22, 42, 0.76);
    --surface-strong: rgba(17, 25, 47, 0.92);
    --surface-soft: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #e9eefc;
    --muted: #9ba8ca;
    --accent: #7c8cff;
    --accent-2: #47d7b8;
    --danger: #ff7676;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    --shadow-soft: 0 16px 35px rgba(0, 0, 0, 0.22);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 16%, rgba(124, 140, 255, 0.26), transparent 24%),
        radial-gradient(circle at 84% 12%, rgba(71, 215, 184, 0.12), transparent 20%),
        radial-gradient(circle at 82% 80%, rgba(255, 118, 118, 0.12), transparent 18%),
        linear-gradient(180deg, var(--bg-0) 0%, #0e1528 100%);
    min-height: 100vh;
}

.page-shell {
    width: min(1500px, calc(100vw - 28px));
    margin: 0 auto;
    padding: 16px 0 24px;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    padding: 28px 30px;
    border-radius: calc(var(--radius-xl) + 6px);
    border: 1px solid var(--border);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04)),
        linear-gradient(180deg, rgba(16, 24, 44, 0.92), rgba(12, 18, 34, 0.9));
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    margin-bottom: 18px;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, transparent 0 68%, rgba(124, 140, 255, 0.16) 68% 100%),
        radial-gradient(circle at 88% 0%, rgba(124, 140, 255, 0.28), transparent 16%);
    pointer-events: none;
}

.hero-copy,
.hero-panel {
    position: relative;
    z-index: 1;
}

.hero-copy {
    max-width: 760px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #c8d2ff;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: clamp(2.4rem, 3.4vw, 4.1rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 1.02rem;
    max-width: 680px;
    line-height: 1.6;
}

.hero-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 10px;
    min-width: 390px;
}

.hero-stat {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
}

.hero-stat span {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 8px;
}

.hero-stat strong {
    font-size: 0.95rem;
    color: var(--text);
}

.workspace {
    display: flex;
    gap: 18px;
    align-items: stretch;
    min-height: calc(100vh - 175px);
}

.control-panel {
    flex: 0 0 430px;
    width: 430px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-card {
    padding: 20px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.panel-title i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(124, 140, 255, 0.16);
    color: #dbe2ff;
}

.panel-title h2 {
    margin: 0;
    font-size: 1.16rem;
    letter-spacing: -0.02em;
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
}

.panel-subtitle {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.location-input {
    margin-bottom: 16px;
}

.location-input label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text);
}

.start-icon { color: var(--accent-2) !important; }
.end-icon { color: var(--danger) !important; }

.location-input input,
.location-input select {
    width: 100%;
    appearance: none;
    min-height: 52px;
    margin-bottom: 10px;
    padding: 13px 14px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
    color: #f3f6ff;
    font: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.location-input input::placeholder {
    color: #8491b4;
}

.location-input input:focus,
.location-input select:focus {
    outline: none;
    border-color: rgba(124, 140, 255, 0.55);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.16);
}

.landmark-select {
    color: #f3f6ff;
    background-color: rgba(255, 255, 255, 0.07);
}

.landmark-select option {
    color: #10192f;
    background: #ffffff;
}

.coordinates {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.83rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.selected-location {
    margin-top: 2px;
    margin-bottom: 8px;
    color: #d9e2ff;
    font-size: 0.84rem;
    font-weight: 600;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.btn {
    min-height: 54px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    color: #0a1020;
    background: linear-gradient(135deg, #96a3ff, #7dd6ff);
    box-shadow: 0 16px 30px rgba(124, 140, 255, 0.25);
}

.btn-secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.results-section {
    background:
        linear-gradient(180deg, rgba(20, 29, 54, 0.94), rgba(13, 20, 36, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.result-grid {
    display: grid;
    gap: 10px;
}

.result-item,
.stat-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.result-item:last-child,
.stat-item:last-child {
    border-bottom: 0;
}

.result-label,
.stat-label {
    color: var(--muted);
    font-weight: 600;
}

.result-value,
.stat-value {
    color: var(--text);
    font-weight: 800;
}

.stats-section {
    background: rgba(255, 255, 255, 0.06);
}

.map-container {
    flex: 1 1 auto;
    min-width: 0;
    position: sticky;
    top: 16px;
    overflow: hidden;
    border-radius: calc(var(--radius-xl) + 12px);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: var(--shadow);
    height: calc(100vh - 210px);
    min-height: 560px;
    max-height: 760px;
}

.map-container::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 16%);
}

#map {
    width: 100%;
    height: 100%;
    min-height: 560px;
}

.map-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: rgba(10, 14, 26, 0.72);
    backdrop-filter: blur(8px);
}

.map-loading i {
    font-size: 2.6rem;
    color: var(--accent);
}

.map-loading p {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.loading-overlay,
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    background: rgba(4, 8, 16, 0.72);
    backdrop-filter: blur(10px);
}

.loading-content,
.modal-content {
    width: min(520px, calc(100vw - 22px));
    border-radius: 28px;
    background: var(--surface-strong);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.loading-content {
    padding: 34px 34px 30px;
    text-align: center;
}

.loading-content i {
    color: var(--accent);
    font-size: 3rem;
    margin-bottom: 14px;
}

.loading-content h3 {
    margin: 0 0 8px;
}

.loading-content p {
    margin: 0;
    color: var(--muted);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(255, 118, 118, 0.16), rgba(255, 118, 118, 0.04));
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-family: "Instrument Serif", Georgia, serif;
    font-weight: 400;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.modal-body,
.modal-footer {
    padding: 18px 20px;
}

.modal-footer {
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.leaflet-container {
    font-family: inherit;
    background: #0d1428;
}

.leaflet-control-zoom {
    border: 0 !important;
    overflow: hidden;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.30) !important;
}

.leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    color: #1f2d46 !important;
    border: 0 !important;
}

.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.35) !important;
    color: rgba(255, 255, 255, 0.72) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.leaflet-popup-content {
    margin: 14px 16px;
    font-family: inherit;
}

.path-highlight {
    color: #ff5b5b !important;
    weight: 6 !important;
    opacity: 0.9 !important;
}

.start-marker,
.end-marker,
.landmark-marker {
    background: transparent !important;
    border: 0 !important;
}

@media (max-width: 1180px) {
    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-panel {
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .workspace {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        flex-basis: auto;
    }

    .map-container,
    #map {
        height: 620px;
        min-height: 620px;
        max-height: none;
        position: relative;
        top: auto;
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100vw - 14px, 100%);
        padding-top: 8px;
    }

    .hero,
    .panel-card,
    .map-container {
        border-radius: 24px;
    }

    .hero {
        padding: 18px;
    }

    .hero-panel {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .map-container,
    #map {
        height: 520px;
        min-height: 520px;
    }
}
