:root {
    --bg-color: #0f172a;        /* Deep slate background */
    --panel-bg: #1e293b;        /* Lighter slate for the slide-out panel */
    --input-bg: #0f172a;        /* Dark inputs */
    --text-color: #f8fafc;      /* Crisp white typography text */
    --primary-color: #38bdf8;   /* Sky blue selection highlight color */
    --map-bg: #334155;          /* Default unselected state fill vector color */
    --map-stroke: #1e293b;      /* Clean border lines between states */
    --border-color: #334155;    /* Input area boundary lines */
}

body.dark-theme {
    --bg-color: #121212;
    --panel-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #333333;
    --primary-color: #3b9eff;
    --map-bg: #2d2d2d;
    --map-stroke: #121212;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

/* Two-Panel Workspace Layout */
.app-container {
    display: flex;
    height: 100vh;
}

.panel {
    padding: 24px;
    box-sizing: border-box;
    overflow-y: auto;
}

.map-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#map {
    width: 100%;
    flex-grow: 1;
    min-height: 400px;
}

.details-panel {
    flex: 1.8;
    background-color: var(--panel-bg);
}

.hidden {
    display: none !important;
}

#noSelectionMessage {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    font-style: italic;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 12px;
}

.mode-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
}

.switch-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    color: var(--danger-color);
}

.switch-container input {
    margin-right: 6px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    resize: vertical;
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}


.jvm-region.state-ruled-out {
    fill: #ff3b30 !important;      
    fill-opacity: 0.60 !important; 
    stroke: #ffffff !important;    
    stroke-width: 1.5px !important;
}

.jvm-region.state-ruled-out:hover {
    fill-opacity: 0.75 !important;
}

.jvm-tooltip {
    background: var(--panel-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Core App Layout Workspace */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Map takes up the full structural container */
#map-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    background-color: var(--bg-color, #f8fafc);
}

#map {
    width: 100%;
    height: 100%;
}

.side-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background-color: var(--panel-bg, #ffffff);
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow-y: auto;
    padding: 24px;
    box-sizing: border-box;
    
    /* Smooth CSS Flyout Animation Parameters */
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-panel.open {
    transform: translateX(0);
}

.panel-content textarea {
    width: 100%;
    background-color: var(--input-bg, #f1f5f9);
    color: var(--text-color, #0f172a);
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 6px;
    padding: 10px;
    box-sizing: border-box;
    resize: vertical;
    margin-bottom: 16px;
}

.dark-theme .side-panel {
    --panel-bg: #1e293b;
    --input-bg: #0f172a;
    --border-color: #334155;
}

.save-indicator {
    font-size: 0.85rem;
    color: #10b981;
    opacity: 0;
    transition: opacity 0.2s ease;
    text-align: right;
}
.save-indicator.show {
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.close-btn:hover {
    color: #ef4444;
}

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-box {
    background: #1e293b;
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #334155;
}

.auth-box input {
    display: block;
    margin: 20px auto;
    padding: 10px;
    background: #0f172a;
    border: 1px solid #334155;
    color: white;
    border-radius: 4px;
}