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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.welcome-message {
    padding: 20px;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 20px;
}

.instruction-box {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.instruction-box ol {
    padding-left: 20px;
    margin: 15px 0;
}

.instruction-box li {
    margin: 10px 0;
    line-height: 1.4;
}

.quick-legend {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-sample {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border-radius: 4px;
    vertical-align: middle;
}

.color-sample.high { background: #800000; }
.color-sample.medium { background: #FF0000; }
.color-sample.low { background: #FF9999; }

.province-metrics {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.metric {
    text-align: center;
}

.metric-value {
    display: block;
    font-size: 24px;
    font-weight: 500;
    color: #2196F3;
}

.metric-label {
    font-size: 12px;
    color: #666;
}

.province-details {
    margin: 15px 0;
}

.province-ranking {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.ranking-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin-top: 8px;
    position: relative;
}

.ranking-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--rank-percentage);
    background: #2196F3;
    border-radius: 3px;
}

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

.header {
    padding: 20px;
    background-color: #333;
    color: white;
    text-align: left;
}

.map-container {
    position: relative;
    flex: 1;
}

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

.legend {
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    line-height: 1.5;
}

.legend h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.legend-item {
    margin-bottom: 5px;
    font-size: 13px;
    color: #666;
}

.legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

.info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    min-width: 300px;
    max-width: 400px;
    z-index: 1000;
}

.info-header {
    padding: 10px 15px;
    background: #f8f8f8;
    border-bottom: 1px solid #ddd;
    border-radius: 5px 5px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapse-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 0 5px;
}

.info-content {
    padding: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.info-content.collapsed {
    display: none;
}

#district-info {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

#province-stats {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

#top-districts {
    margin-bottom: 10px;
}

.stat-item {
    background: rgba(248, 248, 248, 0.9);
    border-left: 4px solid #2196F3;
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
}

.stat-item:hover {
    background: #f5f5f5;
}

.province-summary {
    background: rgba(245, 245, 245, 0.9);
    border-left: 4px solid #4CAF50;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.top-district-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    margin: 8px 0;
    background: rgba(248, 248, 248, 0.9);
    border-left: 3px solid #FF9800;
    transition: background-color 0.2s ease;
}

.top-district-item:hover {
    background: #f5f5f5;
}

.side-panel {
    position: fixed;
    right: -400px; /* Start hidden */
    top: 0;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    transition: right 0.3s ease;
    z-index: 1000;
}

.side-panel.open {
    right: 0;
}

.toggle-button {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 4px 0 0 4px;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-button .arrow {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.side-panel.open .toggle-button .arrow {
    transform: rotate(180deg);
}

.panel-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 20px;
    background: #2196F3;
    color: white;
    border-bottom: none;
}

.panel-header h3 {
    color: white;
    font-weight: 500;
    font-size: 1.2em;
    margin-top: 15px;
}

.panel-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

#district-info {
    margin-bottom: 20px;
}

.empty-state {
    color: #666;
    text-align: center;
    padding: 20px;
}

.section-header {
    color: #2196F3;
    font-weight: 500;
    border-bottom: 2px solid #e0e0e0;
    margin: 20px 0 10px 0;
    padding-bottom: 10px;
}

.search-container {
    margin-bottom: 10px;
}

.search-box {
    position: relative;
}

#district-search {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#district-search:focus {
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-result-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f5f5f5;
}

.search-result-item .district-name {
    font-weight: 500;
    color: #333;
}

.search-result-item .province-name {
    font-size: 0.9em;
    color: #666;
}

p {
    line-height: 1.5;
    color: #424242;
}

.leaflet-bottom.leaflet-left {
    z-index: 999;
}

.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loader-content {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.loader-content p {
    color: #333;
    font-size: 16px;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-hidden {
    display: none;
}

/* Add these new styles */
.welcome-message {
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 20px;
}

.instruction-card {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.instruction-card ul {
    list-style: none;
    padding-left: 0;
    margin-top: 10px;
}

.instruction-card li {
    margin: 10px 0;
    padding-left: 25px;
    position: relative;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.stat-value {
    font-size: 1.2em;
    font-weight: 500;
    color: #2196F3;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.province-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.province-rank {
    background: #2196F3;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9em;
}

.national-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}
