:root {
  --primary-color: #2c3e50;
  --bg-color: #f8f9fa;
  --panel-bg: #ffffff;
  --border-color: #dee2e6;
}

/* ==========================================
   LOADING OVERLAY
   ========================================== */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.loading-overlay.active { display: flex; }

.loading-box {
  background: white;
  border-radius: 10px;
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  min-width: 220px;
}
.loading-box p { margin: 0.75rem 0 0; color: #555; font-size: 0.95rem; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   NOTIFICATION TOAST
   ========================================== */
.notification {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #333;
  color: white;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  font-size: 0.9rem;
  z-index: 9998;
  transition: transform 0.3s ease;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.notification.show { transform: translateX(-50%) translateY(0); }
.notification.success { background: #27ae60; }
.notification.error   { background: #c0392b; }
.notification.warn    { background: #e67e22; }

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: #333;
}

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

header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1000;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Control Panel */
.control-panel {
  width: 350px;
  background-color: var(--panel-bg);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
  z-index: 500;
}

.card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--primary-color);
  border-bottom: 2px solid var(--bg-color);
  padding-bottom: 0.5rem;
}

.control-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="range"] {
  width: 100%;
  margin-bottom: 0.5rem;
}

.slider-value {
  text-align: center;
  font-weight: bold;
  color: var(--primary-color);
}

button {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-bottom: 0.75rem;
}

button.btn-primary {
  background-color: #3498db;
  color: white;
}

button.btn-primary:hover {
  background-color: #2980b9;
}

button.btn-success {
  background-color: #2ecc71;
  color: white;
}

button.btn-success:hover {
  background-color: #27ae60;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==========================================
   TEXT INPUT & SELECT
   ========================================== */
input[type="text"],
select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  box-sizing: border-box;
  color: #333;
  background: white;
  transition: border-color 0.2s;
}
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}

.hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: #999;
}

/* File upload input */
input[type="file"] {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1.5px dashed #99d8c9;
  border-radius: 6px;
  background: #f4fdf9;
  color: #2c3e50;
  cursor: pointer;
  box-sizing: border-box;
  margin-top: 4px;
}
input[type="file"]:hover {
  border-color: #2ca25f;
  background: #eaf8f1;
}
.file-name-label {
  margin-top: 6px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Planet NICFI status */
.planet-status {
  font-size: 0.8rem;
  padding: 0.3rem 0;
  color: #888;
  min-height: 1.2em;
}
.planet-status.success { color: #27ae60; font-weight: 600; }
.planet-status.warn    { color: #e67e22; font-weight: 600; }

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.checkbox-group input {
  margin-right: 0.5rem;
}

/* Status Box */
.status-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background-color: var(--bg-color);
  border-radius: 4px;
}

.status-val {
  font-weight: bold;
}

/* Legend */
.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.color-box {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border-radius: 3px;
  border: 2px solid;
}

/* Map Container */
#map {
  flex: 1;
  height: 100%;
  z-index: 100;
}

.popup-data {
  margin-bottom: 5px;
}
.popup-data strong {
  display: inline-block;
  width: 120px;
}
.risk-high {
  color: #e74c3c;
  font-weight: bold;
}
.risk-low {
  color: #27ae60;
  font-weight: bold;
}

/* ==========================================
   LEAFLET POPUP — flush modern card
   ========================================== */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18) !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}
.leaflet-popup-tip-container {
  margin-top: -1px;
}
