/* shared.css — Common styles for PowerGrid public + admin */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#map {
  width: 100%;
  height: 100vh;
}

/* Status bar */
.status-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 16px;
  font-size: 12px;
  color: #555;
  display: flex;
  gap: 20px;
  border-top: 1px solid #ddd;
  align-items: center;
}

.status-bar .legend {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-bar .legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-bar .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
}

/* Info panel */
.info-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: none;
  min-width: 280px;
  max-width: 340px;
  font-size: 13px;
}

.info-panel.visible {
  display: block;
}

.info-panel h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.info-panel .close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  cursor: pointer;
  font-size: 18px;
  color: #999;
  background: none;
  border: none;
}

.info-panel .close-btn:hover {
  color: #333;
}

.info-panel .field {
  margin-bottom: 6px;
}

.info-panel .field span.label {
  font-weight: 600;
  color: #555;
}

.info-panel .status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

.info-panel .actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-panel .actions button {
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.info-panel .actions button:active {
  transform: scale(0.97);
}

/* Button classes */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  background: #007bff;
  color: #fff;
  font-family: inherit;
}

.btn:hover {
  background: #0056b3;
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-warning {
  background: #ffc107;
  color: #333;
}

.btn-warning:hover {
  background: #e0a800;
}

.btn-info {
  background: #17a2b8;
  color: #fff;
}

.btn-info:hover {
  background: #138496;
}

.btn-success {
  background: #28a745;
  color: #fff;
}

.btn-success:hover {
  background: #218838;
}

.btn-secondary {
  background: #6c757d;
  color: #fff;
}

.btn-secondary:hover {
  background: #5a6268;
}

/* Flashing outage animation */
@keyframes outage-flash {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.outage-flash {
  animation: outage-flash 0.8s ease-in-out infinite;
}

/* Alt-mode connection indicator */
@keyframes connect-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(70, 184, 218, 0.6);
  }

  50% {
    box-shadow: 0 0 0 12px rgba(70, 184, 218, 0);
  }
}

/* ============================================================
   RESPONSIVE — status bar & info panel
   ============================================================ */
@media (max-width: 768px) {
  .status-bar {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
  }

  .status-bar .legend {
    flex-wrap: wrap;
    gap: 8px;
  }

  .info-panel {
    left: 10px;
    right: 10px;
    max-width: none;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .status-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .status-bar .legend {
    display: none;
  }
}
