/* style.css – Churu District Map Application */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --blue: #1A73E8;
    --blue2: #4285F4;
    --green: #34A853;
    --red: #EA4335;
    --yellow: #FBBC04;
    --orange: #FF6D00;
    --purple: #9C27B0;
    --gray1: #F8F9FA;
    --gray2: #E8EAED;
    --gray3: #DADCE0;
    --gray4: #BDC1C6;
    --gray5: #80868B;
    --gray6: #5F6368;
    --dark: #202124;
    --shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px rgba(60, 64, 67, 0.15);
    --shadow2: 0 2px 6px rgba(60, 64, 67, 0.3);
}

body {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    background: #e8eaed;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
#topbar {
    background: #fff;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    border-right: 1px solid var(--gray3);
    flex-shrink: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #1A73E8, #34A853);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.logo-txt h1 {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
}

.logo-txt p {
    font-size: 11px;
    color: var(--gray5);
}

/* Search Box */
.search-box {
    flex: 1;
    max-width: 520px;
    background: var(--gray1);
    border: 1px solid var(--gray3);
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 40px;
    transition: all 0.2s;
    position: relative;
}

.search-box:focus-within {
    background: #fff;
    border-color: var(--blue);
    box-shadow: 0 0 0 1px var(--blue);
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: var(--dark);
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--gray5);
}

.search-icon {
    color: var(--gray5);
    font-size: 16px;
}

#clear-btn {
    color: var(--gray5);
    cursor: pointer;
    font-size: 16px;
    display: none;
}

#search-dropdown {
    position: absolute;
    top: 44px;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-height: 320px;
    overflow-y: auto;
    z-index: 2000;
    display: none;
}

.sd-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--gray2);
    transition: background 0.15s;
}

.sd-item:hover {
    background: var(--gray1);
}

.sd-pin {
    font-size: 18px;
}

.sd-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
}

.sd-sub {
    font-size: 11px;
    color: var(--gray5);
}

/* Stat pills */
.stat-pills {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.pill {
    background: var(--gray1);
    border: 1px solid var(--gray3);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--gray6);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.pill b {
    color: var(--dark);
}

/* Filter Bar */
#filterbar {
    background: #fff;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    border-top: 1px solid var(--gray2);
    overflow-x: auto;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1090;
}

#filterbar::-webkit-scrollbar {
    height: 0;
}

.fchip {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid var(--gray3);
    font-size: 12px;
    font-weight: 500;
    color: var(--gray6);
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.fchip:hover {
    background: var(--gray1);
    border-color: var(--gray4);
}

.fchip.active {
    background: #E8F0FE;
    border-color: var(--blue);
    color: var(--blue);
    font-weight: 600;
}

.fchip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--gray3);
    flex-shrink: 0;
}

/* Main layout */
#main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: 380px;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--gray2);
    z-index: 900;
    position: relative;
}

#result-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--gray2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#result-count {
    font-size: 13px;
    color: var(--gray6);
}

.sort-btn {
    font-size: 12px;
    color: var(--blue);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-weight: 500;
}

#village-list {
    flex: 1;
    overflow-y: auto;
}

#village-list::-webkit-scrollbar {
    width: 4px;
}

#village-list::-webkit-scrollbar-thumb {
    background: var(--gray3);
    border-radius: 4px;
}

.vcard {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray2);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.vcard:hover {
    background: var(--gray1);
}

.vcard.selected {
    background: #E8F0FE;
}

.vcard-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.vcard-body {
    flex: 1;
    min-width: 0;
}

.vcard-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vcard-hindi {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 11px;
    color: var(--gray5);
}

.vcard-row {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.vcard-tag {
    font-size: 11px;
    color: var(--gray6);
    display: flex;
    align-items: center;
    gap: 3px;
}

.pop-bar-wrap {
    margin-top: 5px;
}

.pop-bar {
    height: 3px;
    background: var(--gray2);
    border-radius: 2px;
    overflow: hidden;
}

.pop-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.vcard-pop-num {
    font-size: 11px;
    color: var(--gray6);
    margin-top: 2px;
}

/* Detail Panel */
#detail-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 2px solid var(--blue);
    border-radius: 12px 12px 0 0;
    padding: 16px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 500;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

#detail-panel.open {
    transform: translateY(0);
}

.dp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--gray2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.dp-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 2px;
}

.dp-hindi {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 13px;
    color: var(--gray5);
    margin-bottom: 12px;
}

.dp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.dp-cell {
    background: var(--gray1);
    border-radius: 8px;
    padding: 10px 12px;
}

.dp-cell-val {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
}

.dp-cell-lbl {
    font-size: 10px;
    color: var(--gray5);
    margin-top: 1px;
    text-transform: uppercase;
}

.dp-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray2);
    font-size: 13px;
}

.dp-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.dp-action {
    flex: 1;
    padding: 9px;
    border-radius: 8px;
    border: 1px solid var(--gray3);
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: var(--blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Map */
#map {
    flex: 1;
    position: relative;
    background: #f0f2f5;
}

/* Marker clusters */
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    font-family: 'Google Sans', sans-serif !important;
    font-weight: 700 !important;
}

.marker-cluster-small {
    background: rgba(51, 136, 255, 0.25) !important;
}

.marker-cluster-small div {
    background: rgba(51, 136, 255, 0.7) !important;
    color: #fff !important;
}

.marker-cluster-medium {
    background: rgba(255, 109, 0, 0.25) !important;
}

.marker-cluster-medium div {
    background: rgba(255, 109, 0, 0.7) !important;
    color: #fff !important;
}

.marker-cluster-large {
    background: rgba(234, 67, 53, 0.25) !important;
}

.marker-cluster-large div {
    background: rgba(234, 67, 53, 0.7) !important;
    color: #fff !important;
}

/* Popup */
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    padding: 0 !important;
    min-width: 220px;
}

.leaflet-popup-content {
    margin: 0 !important;
}

.mp-wrap {
    padding: 14px 16px 10px;
}

.mp-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
}

.mp-hindi {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 11px;
    color: var(--gray5);
    margin-bottom: 8px;
}

.mp-stat {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.mp-stat-item {
    text-align: center;
}

.mp-stat-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--blue);
}

.mp-stat-lbl {
    font-size: 10px;
    color: var(--gray5);
}

.mp-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 10px;
}

.mp-footer {
    background: var(--gray1);
    padding: 8px 16px;
    border-top: 1px solid var(--gray2);
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--gray5);
}

/* Map controls */
#map-controls {
    position: absolute;
    bottom: 24px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 900;
}

.mc-btn {
    background: #fff;
    border: none;
    border-radius: 8px;
    padding: 0;
    box-shadow: var(--shadow2);
    overflow: hidden;
    cursor: pointer;
}

.mc-inner {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.15s;
}

.mc-inner:hover {
    background: var(--gray1);
}

.mc-stack {
    display: flex;
    flex-direction: column;
}

#layer-sw {
    position: absolute;
    bottom: 24px;
    left: 16px;
    z-index: 900;
    display: flex;
    gap: 6px;
}

.lsw-btn {
    background: #fff;
    border: 1px solid var(--gray3);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray6);
    cursor: pointer;
    box-shadow: var(--shadow2);
}

.lsw-btn.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

#coords {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 11px;
    color: var(--gray6);
    box-shadow: var(--shadow2);
    backdrop-filter: blur(4px);
    z-index: 900;
    pointer-events: none;
}

/* Admin Panel */
#admin-panel {
    position: absolute;
    top: 70px;
    right: 10px;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
    width: 280px;
    display: none;
}

#admin-panel input,
#admin-panel textarea {
    width: 100%;
    margin-bottom: 8px;
    padding: 6px;
    border: 1px solid var(--gray3);
    border-radius: 4px;
}

#admin-panel button {
    margin-top: 6px;
    margin-right: 6px;
}

/* Customer Modal */
#customerModal {
    display: none;
    position: fixed;
    top: 15%;
    left: 30%;
    width: 40%;
    background: white;
    z-index: 2000;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-height: 70%;
    overflow-y: auto;
}

#customerModal input,
#customerModal textarea {
    width: 100%;
    margin-bottom: 8px;
    padding: 6px;
}

.customer-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 8px 0;
}

.customer-item {
    padding: 6px;
    border-bottom: 1px solid #ddd;
    font-size: 12px;
}

.tag {
    background: #e0e0e0;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 10px;
    margin: 2px;
    display: inline-block;
}

/* Loading overlay */
#loading {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.ld-logo {
    font-size: 48px;
    animation: bounce 0.8s ease infinite alternate;
}

@keyframes bounce {
    to {
        transform: translateY(-10px);
    }
}

.ld-bar {
    width: 240px;
    height: 4px;
    background: var(--gray2);
    border-radius: 4px;
    overflow: hidden;
}

.ld-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green));
    border-radius: 4px;
    animation: fill 1.2s ease forwards;
}

@keyframes fill {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.ld-text {
    font-size: 14px;
    color: var(--gray6);
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        width: 280px;
    }

    #customerModal {
        left: 5%;
        width: 90%;
        top: 10%;
    }

    .stat-pills .pill {
        display: none;
    }

    .search-box {
        max-width: 200px;
    }
}