html,
body {
    height: 100%;
    margin: 0;
    font-family: "Helvetica Neue", Arial, sans-serif;
    background: #f8f8f8;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 56px;  /* Sidebar rail width */
    bottom: 0;
    transition: right 0.25s ease;
}

body.analysis-open #map {
    right: 416px; /* rail(56) + analysis(360) */
}

.map-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 14px 16px;
    width: 260px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.map-panel h1 {
    font-size: 16px;
    margin: 0 0 6px 0;
}

.map-panel p {
    font-size: 12px;
    margin: 0 0 12px 0;
    color: #555;
}

.panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 8px;
    gap: 8px;
}

.panel-label {
    color: #666;
    font-weight: 600;
}

.panel-value {
    color: #111;
    text-align: right;
}

.panel-value.error {
    color: #b00020;
}

.panel-value-mono {
    font-family: "SF Mono", Monaco, "Consolas", monospace;
    font-size: 10px;
    color: #666;
    word-break: break-all;
}

.panel-row-small {
    margin-bottom: 4px;
}

.panel-row-small .panel-label {
    font-size: 11px;
    font-weight: 500;
    color: #888;
}

.panel-row-small .panel-value {
    font-size: 11px;
    color: #555;
}

.panel-row-meta {
    margin-bottom: 12px;
    padding-top: 6px;
    border-top: 1px dashed #ddd;
}

.panel-row-meta .panel-label {
    font-size: 10px;
    font-weight: 500;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─────────────────────────────────────────────────────────────
   Search Bar
   ───────────────────────────────────────────────────────────── */

.search-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

#search-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
}

#search-input:focus {
    border-color: #2196f3;
}

#search-input:disabled {
    background: #f5f5f5;
    color: #999;
}

#search-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    background: #2196f3;
    color: #fff;
    cursor: pointer;
}

#search-btn:hover {
    background: #1976d2;
}

#search-btn:disabled {
    background: #bdbdbd;
    cursor: not-allowed;
}

.search-status {
    font-size: 11px;
    margin-bottom: 8px;
    min-height: 16px;
}

.search-status.loading {
    color: #2196f3;
}

.search-status.error {
    color: #c62828;
}

.search-status.success {
    color: #2e7d32;
}

.search-result {
    font-size: 11px;
    color: #555;
    background: #f5f5f5;
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 12px;
    word-break: break-word;
}

#clear-btn {
    width: 100%;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
    background: #111;
    color: #fff;
    cursor: pointer;
}

#clear-btn:hover {
    background: #2b2b2b;
}

/* ─────────────────────────────────────────────────────────────
   Debug Panel
   ───────────────────────────────────────────────────────────── */

.debug-panel {
    position: absolute;
    display: none;
    top: 15%;
    left: 16px;
    z-index: 10;
    background: rgba(30, 30, 35, 0.95);
    border-radius: 8px;
    width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-size: 12px;
    color: #e0e0e0;
    backdrop-filter: blur(8px);
    height: auto;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-title {
    font-weight: 600;
    font-size: 13px;
}

.debug-toggle {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.debug-toggle:hover {
    color: #fff;
}

.debug-content {
    padding: 8px 0;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    height: auto;
}

.debug-section {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.debug-section:last-child {
    border-bottom: none;
}

.debug-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-state {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 8px;
}

.debug-state-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.debug-state-row span:first-child {
    color: #888;
}

.debug-state-row span:last-child {
    font-family: "SF Mono", Monaco, monospace;
    color: #4fc3f7;
}

.debug-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.debug-select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
    font-size: 11px;
}

.debug-button-row {
    display: flex;
    gap: 6px;
}

.debug-btn {
    flex: 1;
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    background: #2196f3;
    color: white;
}

.debug-btn:hover {
    background: #1976d2;
}

.debug-btn-secondary {
    background: #455a64;
}

.debug-btn-secondary:hover {
    background: #37474f;
}

.debug-btn-active {
    background: #4fc3f7 !important;
    color: #1e1e23 !important;
}

.debug-btn-active:hover {
    background: #29b6f6 !important;
}

.debug-btn-iso {
    background: #1565c0;
    width: 100%;
}

.debug-btn-iso:hover {
    background: #0d47a1;
}

.debug-btn-contour {
    background: #37474f;
    font-size: 10px;
    padding: 4px 6px;
}

.debug-btn-outline {
    background: #1565c0;
    width: 100%;
}

.debug-btn-outline:hover:not(:disabled) {
    background: #0d47a1;
}

.debug-btn-outline:disabled {
    background: #455a64;
    opacity: 0.5;
    cursor: not-allowed;
}

.debug-label {
    display: block;
    font-size: 10px;
    color: #90a4ae;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.debug-btn-danger {
    background: #c62828;
}

.debug-btn-danger:hover {
    background: #b71c1c;
}

.debug-btn-small {
    padding: 2px 6px;
    font-size: 9px;
    border-radius: 3px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #888;
    cursor: pointer;
}

.debug-btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.debug-log {
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 6px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 10px;
}

.debug-log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.debug-log-entry:last-child {
    border-bottom: none;
}

.debug-log-time {
    color: #666;
}

.debug-log-type {
    font-weight: 600;
}

.debug-log-cmd .debug-log-type {
    color: #4fc3f7;
}

.debug-log-evt .debug-log-type {
    color: #81c784;
}

.debug-log-warn .debug-log-type {
    color: #ffb74d;
}

/* ─────────────────────────────────────────────────────────────
   Filter Panel Specific Styles
   ───────────────────────────────────────────────────────────── */

.filter-summary {
    font-size: 10px;
    font-weight: 400;
    color: #4fc3f7;
    font-family: "SF Mono", Monaco, monospace;
}

.filter-list {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 6px 8px;
    max-height: 180px;
    overflow-y: auto;
}

.filter-empty {
    color: #666;
    font-style: italic;
    font-size: 11px;
    text-align: center;
    padding: 8px 0;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 3px;
    margin: 0 -4px;
    padding-left: 4px;
    padding-right: 4px;
}

.filter-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.filter-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: #4fc3f7;
}

.filter-label {
    font-size: 11px;
    color: #e0e0e0;
    flex: 1;
}

.filter-item input[type="checkbox"]:not(:checked) + .filter-label {
    color: #888;
    text-decoration: line-through;
}
