:root { --sidebar-width: 380px; --primary: #008037; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; color: #1e293b; overflow: hidden; height: 100vh; margin: 0; }

/* Global Navigation Sidebar */
.nav-sidebar { 
    position: fixed; top: 0; left: 0; bottom: 0; width: 45px; 
    background: var(--primary); display: flex; flex-direction: column; 
    align-items: center; padding-top: 15px; z-index: 2000; 
    box-shadow: 2px 0 10px rgba(0,0,0,0.1); 
}
.nav-item { 
    color: rgba(255,255,255,0.6); font-size: 1.1rem; margin-bottom: 12px; 
    transition: all 0.2s; cursor: pointer; text-decoration: none; 
    width: 32px; height: 32px; display: flex; align-items: center; 
    justify-content: center; border-radius: 8px; 
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-item.active { background: rgba(255,255,255,0.2); color: white; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3); }

/* Layout Containers */
.app-container { display: flex; height: 100vh; margin-left: 45px; width: calc(100% - 45px); }
.sidebar { width: var(--sidebar-width); background: white; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; z-index: 1000; box-sizing: border-box; }
.map-view { flex: 1; position: relative; }

/* Sidebar Elements */
.brand { display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: var(--primary); color: white; width: 100%; box-sizing: border-box; }
.brand h1 { font-size: 1.1rem; font-weight: 700; margin: 0; color: white; letter-spacing: -0.02em; }
.sidebar-header { padding: 20px; border-bottom: 1px solid #f1f5f9; }
.sidebar-header strong { color: var(--primary); }
.street-list { flex: 1; overflow-y: auto; padding: 10px 0; }
.street-item { height: 42px; padding: 0 24px; cursor: pointer; display: flex; align-items: center; gap: 12px; border-left: 4px solid transparent; text-decoration: none; color: inherit; font-size: 0.8rem; box-sizing: border-box; }
.street-item.active { background: #eff6ff; border-left-color: var(--primary); }
.street-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; width: 58px; justify-content: flex-end; flex-shrink: 0; }
.focus-icon { color: var(--primary); background: #f1f5f9; width: 26px; height: 26px; display: grid; place-items: center; visibility: hidden; border-radius: 50%; font-size: 0.95rem; transition: all 0.2s; cursor: pointer; }
.street-item.active .focus-icon { visibility: visible; }
.focus-icon:hover { background: var(--primary); color: white; opacity: 1 !important; }
.point-count-badge { background: var(--primary); color: white; font-size: 0.75rem; font-weight: 700; width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 50%; flex-shrink: 0; display: block; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

body.rotating-map, body.rotating-map #map canvas { cursor: grabbing !important; }

#map { height: 100%; width: 100%; background: #f1f5f9; }

/* Map Options - Content Driven Width & Fixed Height Header */
.map-controls { position: absolute; top: 10px; right: 50px; z-index: 1200; display: flex; flex-direction: column; align-items: flex-end; }
.map-options-wrapper {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    width: max-content;
    min-width: 120px;
    max-height: 32px; /* CLOSED STATE */
    pointer-events: auto;
}
.map-options-wrapper.active { 
    max-height: 600px; /* Effectively AUTO height */
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); 
}
.map-options-header {
    height: 30px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: #475569;
    user-select: none;
    gap: 15px;
}
.map-options-header:hover { color: var(--primary); }
.map-options-header span { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.map-options-header i { font-size: 0.85rem; }
.map-options-header .arrow-icon { transition: transform 0.3s ease; font-size: 0.6rem; }
.map-options-content { padding: 8px 12px 15px 12px; border-top: 1px solid rgba(0,0,0,0.05); opacity: 0; visibility: hidden; transition: opacity 0.2s; }
.map-options-wrapper.active .map-options-content { opacity: 1; visibility: visible; }
.map-options-wrapper.active .arrow-icon { transform: rotate(180deg); }
.map-options-wrapper.active .map-options-header { color: var(--primary); }

.image-upload-wrapper { position: relative; width: 100%; border-radius: 8px; overflow: hidden; margin-bottom: 15px; border: 1px solid #e2e8f0; }
.image-upload-wrapper img { width: 100%; height: auto; display: block; cursor: pointer; transition: transform 0.2s; }
.image-upload-wrapper img:hover { transform: scale(1.02); }
.remove-img-btn { position: absolute; top: 8px; right: 8px; background: rgba(239, 68, 68, 0.9); color: white; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: all 0.2s; }
.remove-img-btn:hover { background: #ef4444; transform: scale(1.1); }

/* Overlay UI */
.overlay-stack { position: absolute; top: 20px; left: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 15px; pointer-events: none; }
.eval-card, .point-card { position: relative; background: white; padding: 20px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.12); width: 275px; border: 1px solid rgba(0,0,0,0.05); display: none; pointer-events: auto; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; padding-top: 15px; border-top: 1px dashed #e2e8f0; }
.meta-item { font-size: 0.75rem; color: #64748b; }
.meta-label { font-weight: 700; color: var(--primary); display: block; margin-bottom: 2px; text-transform: uppercase; font-size: 0.65rem; }

/* Selection & Activation */
.selection-overlay { position: fixed; top: 0; left: 45px; width: calc(100% - 45px); height: 100%; background: white; z-index: 3000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.selection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; width: 100%; max-width: 1200px; margin-top: 40px; }
.subarea-card { background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 16px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s ease; }
.subarea-card:hover { border-color: var(--primary); background: #f0fdf4; transform: translateY(-5px); }
.subarea-card.selected { border-color: var(--primary); background: #f0fdf4; box-shadow: 0 0 0 4px rgba(0, 128, 55, 0.1); }
.subarea-card.disabled { opacity: 0.4; filter: grayscale(1); cursor: not-allowed; }

.activate-btn { position: fixed; bottom: 40px; left: calc(45px + (100% - 45px) / 2); transform: translateX(-50%); padding: 15px 40px; border-radius: 50px; box-shadow: 0 10px 30px rgba(0, 128, 55, 0.3); z-index: 3100; display: none; }
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; color: white !important; }
.btn-primary:hover { background-color: #00662c !important; border-color: #00662c !important; }

/* Street View Tabs */
.gsv-tab { background: #e2e8f0; color: #64748b; border: none; font-weight: 700; transition: all 0.2s; }
.gsv-tab.active { background: var(--primary); color: white; }
.gsv-tab:hover:not(.active) { background: #cbd5e1; }

.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Enforce Valongo-Green on all Progress Bars */
.progress-bar { background-color: var(--primary) !important; }

/* Enforce Valongo-Green on all Buttons */
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; color: white !important; }
.btn-primary:hover { background-color: #00662c !important; border-color: #00662c !important; }
.btn-outline-primary { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-outline-primary:hover { background-color: var(--primary) !important; color: white !important; }

.silhouette-container { height: 150px; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; }
.silhouette-container svg { max-height: 100%; max-width: 100%; fill: #008037; fill-opacity: 0.15; transition: fill 0.2s; }

/* Loader & Modals */
.loader { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.9); backdrop-filter: blur(4px); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2000; }
.loader-content { text-align: center; max-width: 400px; }

.image-modal { display: none; position: fixed; z-index: 4000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.9); align-items: center; justify-content: center; }
.image-modal-content { margin: auto; display: block; max-width: 95%; max-height: 90vh; border-radius: 8px; }
.image-modal-close { position: absolute; top: 15px; right: 35px; color: #f1f1f1; font-size: 40px; font-weight: bold; cursor: pointer; }

/* Mobile Adjustments */
@media (max-width: 768px) {
    .nav-sidebar { top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: 65px; flex-direction: row; justify-content: space-around; padding-top: 0; border-radius: 20px 20px 0 0; }
    .nav-item { margin-bottom: 0; width: 60px; height: 50px; }
    .app-container, .selection-overlay { margin-left: 0 !important; width: 100% !important; margin-bottom: 0; }
    .selection-overlay { left: 0; top: 0; height: calc(100% - 65px); padding: 20px; justify-content: flex-start; overflow-y: auto; }
    .selection-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
    .subarea-card { padding: 15px; border-radius: 12px; }
    .subarea-card h3 { font-size: 0.9rem; }
    .app-container { flex-direction: column; height: calc(100vh - 65px); }
    .sidebar { width: 100%; height: 45vh; order: 2; border-right: none; }
    .map-view { flex: 1; height: 55vh; order: 1; }
    .map-controls { top: 10px; right: 50px; }
    .eval-card, .point-card { position: fixed; bottom: 65px !important; left: 0 !important; width: 100% !important; border-radius: 24px 24px 0 0; }
    .activate-btn { bottom: 85px; left: 50%; }
    .silhouette-container { height: 80px; }
}
