:root {
    --bg-main: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.95);
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --border-color: rgba(255, 255, 255, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-main);
    color: var(--text-primary);
}

#map {
    width: 100%;
    height: 100vh;
    z-index: 1;
}

/* Global Hidden Utility (Fixes overlapping elements) */
.hidden {
    display: none !important;
}

#ui-header {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 92%;
    max-width: 650px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.header-top h1 {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
}

#status-text {
    font-size: 11px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}

#filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

#filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.filter-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    font-weight: 600;
}

#sort-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

#sort-select option {
    background: #0f172a;
    color: #ffffff;
}

#btn-drop-pin {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.5);
    cursor: pointer;
}

#pin-instruction {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    background: #1e293b;
    border: 1px solid var(--accent-blue);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* Custom Price Badge */
.custom-price-badge-container {
    background: transparent;
    border: none;
}

.map-price-badge {
    background: #059669;
    color: white;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid #ffffff;
    white-space: nowrap;
}

/* Popup Overhaul */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: #1e293b !important;
    color: #ffffff !important;
    border-radius: 14px !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.custom-popup-card {
    padding: 4px;
    color: #ffffff;
}

.popup-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

.popup-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.popup-prop-type {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.popup-price {
    font-size: 15px;
    font-weight: 800;
    color: #34d399;
}

.popup-address {
    font-size: 12px;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.popup-msg {
    font-size: 12px;
    color: #ffffff;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px;
    border-radius: 6px;
}

.popup-vote-container {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.vote-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: #ffffff; /* Pure white */
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.vote-btn.report {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

.popup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.action-btn {
    display: block;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 11px;
    color: #ffffff !important; /* Forces all button text to white */
}

.call-btn {
    background: var(--accent-blue);
}

.wa-btn {
    background: #059669;
    color: white;
}

/* Modal styling */
#pin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-content h2, .modal-content label {
    color: #ffffff;
}

.modal-content input, .modal-content select {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 6px;
    margin-bottom: 12px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    flex: 1;
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.toast {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    background: #059669;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
