/* ===============================
   RESET & BASE
================================ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', Arial, sans-serif;
  background: #eef1f5;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===============================
   TOP BAR
================================ */
.topbar {
  height: 60px;
  background: #0a2540;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.logo {
  font-weight: 600;
}

.top-actions {
  margin-left: auto;
}

.top-actions .link {
  margin-left: 20px;
  cursor: pointer;
}

/* ===============================
   APP LAYOUT
================================ */
.app {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ===============================
   SIDEBAR
================================ */
.sidebar {
  width: 260px;
  background: #fff;
  padding: 15px;
  border-right: 1px solid #ddd;
  transition: width 0.25s ease, padding 0.25s ease;
}

.sidebar h3 {
  margin-top: 0;
}

.device {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}

.device:hover {
  background: #f0f4ff;
}

/* === SIDEBAR COLLAPSED === */
.sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar.collapsed * {
  display: none;
}

/* === BOTÓN PARA ABRIR/CERRAR SIDEBAR === */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  left: 15px;              /* ancho del sidebar */
  transform: translateY(-50%);
  z-index: 1000;

  background: #0a2540;
  color: #fff;
  border: none;
  border-radius: 0 8px 8px 0;

  width: 26px;
  height: 60px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);

}

.sidebar-toggle:hover {
  background: #163a5f;
}

/* CUANDO EL SIDEBAR ESTÁ COLAPSADO */
.sidebar.collapsed + .main .sidebar-toggle {
  left: 0;
  border-radius: 0 8px 8px 0;
}

/* ===============================
   MAIN CONTENT
================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 15px;
  gap: 12px;
  position: relative;
}

/* ===============================
   INFO BAR
================================ */
.info-bar {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

/* ===============================
   MAP
================================ */
.map-wrapper {
  flex: 1;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  position: relative;
}

#map {
  height: 100%;
  width: 100%;
}

/* === MAP OVERLAY (MENSAJES) === */
.map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  color: #334155;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(2px);
  z-index: 500;
  pointer-events: none;
  text-align: center;
  padding: 20px;
}

/* ===============================
   ACTIONS BAR
================================ */
.actions-bar {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  display: flex;
  justify-content: space-around;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #e5e7eb;
}

.btn.success {
  background: #22c55e;
  color: #fff;
}

.btn.danger {
  background: #ef4444;
  color: #fff;
}

.actions-bar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===============================
   IA PANEL
================================ */
.ia-panel {
  display: none;
  flex-direction: column;
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  height: 100%;
}

.ia-panel textarea {
  height: 80px;
  margin-bottom: 10px;
}

/* ===============================
   EMPTY STATE
================================ */
.empty {
  text-align: center;
  color: #666;
  margin-top: 50px;
}

/* ===============================
   BOTTOM BAR
================================ */
.bottombar {
  height: 60px;
  background: #0a2540;
  color: #fff;
  display: flex;
}

.bottombar div {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.bottombar div:hover {
  background: #163a5f;
}

.bottombar div::after {
  content: "";
  position: absolute;
  bottom: 6px;
  width: 0;
  height: 3px;
  background: #38bdf8;
  transition: width 0.3s;
}

.bottombar div:hover::after {
  width: 40%;
}

.bottombar .active {
  background: #1e3a5f;
}

.bottombar .active::after {
  width: 50%;
}

.bottombar .center {
  font-size: 22px;
}

/* ===============================
   RADAR MARKER
================================ */
.radar-marker {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.radar-marker::before,
.radar-marker::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid;
  animation: radarPulse 2.5s infinite;
}

.radar-marker::after {
  inset: -12px;
  animation-delay: 1.2s;
}

/* === RADAR STATES === */
.radar-online {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.35);
}

.radar-online::before,
.radar-online::after {
  border-color: rgba(34,197,94,0.5);
}

.radar-offline {
  background: #facc15;
  box-shadow: 0 0 0 4px rgba(250,204,21,0.35);
}

.radar-offline::before,
.radar-offline::after {
  border-color: rgba(250,204,21,0.5);
}

.radar-unknown {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,0.35);
}

.radar-unknown::before,
.radar-unknown::after {
  border-color: rgba(239,68,68,0.5);
}

/* === RADAR ANIMATION === */
@keyframes radarPulse {
  0% {
    transform: scale(0.6);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
