* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* header nempel di atas pas di-scroll */
.header {
    background: white;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #2c5f2d;
}

.search-box {
    position: relative;
    margin-bottom: 0.75rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: #2c5f2d;
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0 0.5rem;
}

.clear-btn:hover {
    color: #666;
}

.filter-toggle {
    display: none;
    width: 100%;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2c5f2d;
    cursor: pointer;
}

.filter-group {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    gap: 0.5rem;
    align-items: center;
    padding-bottom: 0.25rem;
}

.filter-group .chip {
    flex: 0 0 auto;  
}

.filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* kalahin z-index control leaflet biar gak nutupin header */
.leaflet-top,
.leaflet-bottom {
    z-index: 500;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #666;
    margin-right: 0.25rem;
}

.chip {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.chip:hover {
    border-color: #2c5f2d;
    background: #f0f8f0;
}

.chip.active {
    background: #2c5f2d;
    color: white;
    border-color: #2c5f2d;
}

.location-btn {
    width: 100%;
    padding: 0.75rem;
    background: #2c5f2d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.location-btn:hover {
    background: #1e3f1f;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* tinggi map dikunci biar list di bawah gak kegencet */
.map-container {
    height: 400px;
    width: 100%;
    position: relative;
}

.results-panel {
    background: white;
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 600px);
    overflow: hidden;
}

/* header list ikut nempel */
.results-header {
    padding: 1rem;
    border-bottom: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.results-header h2 {
    font-size: 1.125rem;
    color: #2c5f2d;
}

.result-count {
    font-size: 0.875rem;
    color: #666;
    background: #f0f0f0;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.results-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem;
}

.room-card {
    background: white;
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.room-card:hover {
    border-color: #2c5f2d;
    box-shadow: 0 2px 8px rgba(44, 95, 45, 0.1);
}

.room-name {
    font-size: 1rem;
    color: #2c5f2d;
    margin-bottom: 0.5rem;
}

.room-code {
    font-size: 0.875rem;
    color: #666;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.room-unit {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.room-location,
.room-pic {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.badge.no-location {
    background: #fff3cd;
    color: #856404;
}

.no-results {
    padding: 2rem;
    text-align: center;
    color: #666;
}

.error-message {
    padding: 1rem;
    background: #f8d7da;
    color: #721c24;
    border-radius: 8px;
    margin: 0.5rem;
}

.popup-content h3 {
    margin-bottom: 0.5rem;
    color: #2c5f2d;
}

.popup-code {
    font-size: 0.875rem;
    color: #666;
    font-weight: 600;
}

.popup-unit {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.popup-location {
    font-size: 0.875rem;
    color: #666;
}

.popup-room-list {
    list-style: none;
    padding: 0;
}

.popup-room-list li {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.popup-room-list li:hover {
    background: #f0f8f0;
}

.popup-room-list li:last-child {
    border-bottom: none;
}

.popup-room-list li strong {
    color: #2c5f2d;
}

.popup-room-list li small {
    color: #888;
}

.user-marker {
    background: #dc3545;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* layout hp */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.125rem;
    }

    .filter-toggle {
        display: block;
    }

    .filters {
        display: none;
    }

    .filters.show {
        display: flex;
    }

    .map-container {
        height: 300px;
    }

    .results-panel {
        max-height: calc(100vh - 500px);
    }
}

/* layout desktop, map kiri list kanan */
@media (min-width: 769px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .main-content {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .map-container {
        width: 60%;
        aspect-ratio: 4 / 3;
        max-height: 500px;
    }
    
    .results-panel {
        width: 40%;
        max-height: 500px;
    }
}