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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
#sidebar {
  width: 380px;
  min-width: 380px;
  background: #1a1a1a;
  border-right: 1px solid #2a2a2a;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #2a2a2a;
  background: #111;
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.subtitle {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* Panels */
.panel {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
}

.panel h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 12px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}

.stat {
  background: #222;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  display: block;
  font-size: 10px;
  color: #888;
  margin-top: 2px;
  text-transform: uppercase;
}

.stat-closed .stat-value { color: #ef4444; }
.stat-temp .stat-value { color: #f59e0b; }
.stat-open .stat-value { color: #22c55e; }

/* Forms */
.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.form-row:last-child {
  margin-bottom: 0;
}

input[type="text"],
input[type="number"],
select {
  flex: 1;
  padding: 8px 12px;
  background: #222;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: #555;
}

select:focus {
  border-color: #555;
}

.form-label {
  flex: 0 0 92px;
  font-size: 12px;
  color: #888;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-primary:disabled {
  background: #1e3a5f;
  cursor: not-allowed;
}

.btn-secondary {
  background: #333;
  color: #e0e0e0;
}

.btn-secondary:hover {
  background: #444;
}

.help-text {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}

.status-msg {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.status-msg.loading {
  background: #1e3a5f;
  color: #60a5fa;
}

.status-msg.success {
  background: #14532d;
  color: #4ade80;
}

.status-msg.error {
  background: #450a0a;
  color: #f87171;
}

.hidden {
  display: none !important;
}

/* Checkboxes */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
  accent-color: #3b82f6;
}

/* Results List */
#results-list {
  max-height: 400px;
  overflow-y: auto;
}

.result-item {
  padding: 10px;
  margin-bottom: 6px;
  background: #222;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.result-item:hover {
  background: #2a2a2a;
}

.result-item.closed {
  border-left-color: #ef4444;
}

.result-item.temp-closed {
  border-left-color: #f59e0b;
}

.result-item.operational {
  border-left-color: #22c55e;
}

.result-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.result-address {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.result-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.result-status.closed { color: #ef4444; }
.result-status.temp-closed { color: #f59e0b; }
.result-status.operational { color: #22c55e; }

.badge {
  background: #333;
  color: #888;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* Map */
#map {
  flex: 1;
  z-index: 1;
}

/* Detail Panel */
#detail-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 360px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 24px;
  z-index: 1000;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.btn-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #333;
  border: none;
  color: #888;
  font-size: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-close:hover {
  background: #444;
  color: #fff;
}

.detail-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  padding-right: 30px;
}

.detail-address {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
}

.detail-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.detail-status-badge.closed {
  background: #450a0a;
  color: #f87171;
}

.detail-status-badge.temp-closed {
  background: #451a03;
  color: #fbbf24;
}

.detail-status-badge.operational {
  background: #052e16;
  color: #4ade80;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #222;
}

.detail-row .label {
  color: #888;
}

.detail-row .value {
  color: #e0e0e0;
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.detail-row .value a {
  color: #60a5fa;
  text-decoration: none;
}

.detail-row .value a:hover {
  text-decoration: underline;
}

.detail-vacancy {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.detail-vacancy .vacancy-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.detail-vacancy .vacancy-value {
  font-size: 16px;
  font-weight: 700;
  color: #f59e0b;
}

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
  background: #1a1a1a;
  color: #e0e0e0;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}

.leaflet-popup-tip {
  background: #1a1a1a;
}

.leaflet-popup-content {
  font-size: 13px;
  line-height: 1.4;
}

.popup-name {
  font-weight: 700;
  color: #fff;
  font-size: 14px;
}

.popup-status {
  font-weight: 600;
  font-size: 12px;
  margin-top: 2px;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #333;
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scan circle on map */
.scan-circle {
  stroke: #3b82f6;
  fill: #3b82f6;
  fill-opacity: 0.1;
  stroke-opacity: 0.6;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 320px;
  max-width: 440px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #1a1a1a;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  font-size: 13px;
  line-height: 1.4;
  pointer-events: auto;
  animation: toastIn 0.3s ease-out;
}

.toast.removing {
  animation: toastOut 0.25s ease-in forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.toast-message {
  color: #aaa;
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #555;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}

.toast-close:hover {
  color: #aaa;
}

/* Toast types */
.toast.error {
  border-color: #ef44441a;
  background: linear-gradient(135deg, #1a1111, #1a1a1a);
}

.toast.error .toast-icon {
  background: #ef44442a;
  color: #ef4444;
}

.toast.success {
  border-color: #22c55e1a;
  background: linear-gradient(135deg, #111a14, #1a1a1a);
}

.toast.success .toast-icon {
  background: #22c55e2a;
  color: #22c55e;
}

.toast.warning {
  border-color: #f59e0b1a;
  background: linear-gradient(135deg, #1a1711, #1a1a1a);
}

.toast.warning .toast-icon {
  background: #f59e0b2a;
  color: #f59e0b;
}

.toast.info {
  border-color: #3b82f61a;
  background: linear-gradient(135deg, #11141a, #1a1a1a);
}

.toast.info .toast-icon {
  background: #3b82f62a;
  color: #3b82f6;
}

/* Progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 10px 10px;
  animation: toastProgress linear forwards;
}

.toast.error .toast-progress { background: #ef4444; }
.toast.success .toast-progress { background: #22c55e; }
.toast.warning .toast-progress { background: #f59e0b; }
.toast.info .toast-progress { background: #3b82f6; }

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}
