/* ============================================================
   GLOBAL POPUP + HARDWARE MODAL REFINEMENT
   Unifies style and layout for node/device popups and hardware modal
   ============================================================ */

/* ===== Shared aesthetic ===== */
.popup,
#hwModal .content {
  font-family: system-ui, sans-serif;
  background: #0b111a;
  border: 1px solid #1e293b;
  border-radius: 12px;
  color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.55);
  padding: 16px 18px;
  box-sizing: border-box;
}

/* Subtle fade animation for popup/modal */
.popup,
#hwModal {
  animation: fadeInPopup 0.25s ease;
}
@keyframes fadeInPopup {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Popup (Device details modal) ===== */
#deviceBody .popup {
  max-width: 100% !important;
  width: 100%;
  box-sizing: border-box;
}

.popup-header {
  font-size: 1.15rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 10px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 6px;
}

.popup-section {
  margin-bottom: 10px;
  width: 100%;
}

.popup-field {
  width: 100%;
  margin-bottom: 8px;
}

.popup-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 2px;
}

.popup-value {
  background: rgba(255,255,255,0.04);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.9rem;
  word-break: break-word;
  width: 100%;
}

.popup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 10px;
}

.key-block {
  font-family: monospace;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 5px 7px;
  border-radius: 6px;
  word-break: break-all;
  width: 100%;
}

/* Popup buttons */
.btn.small {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn.small:hover {
  background: #334155;
  color: #fff;
}

/* ===== Hardware Modal ===== */
#hwModal {
  overflow-x: hidden;
}
#hwModal .content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  align-items: flex-start;
  text-align: left;
}

/* Labels */
#hwModal label {
  display: block;
  width: 100%;
  text-align: left;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

/* Inputs, selects, textarea */
#hwModal input,
#hwModal select,
#hwModal textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid #1e293b;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.9rem;
  padding: 6px 8px;
  box-sizing: border-box;
  resize: vertical;
  transition: border 0.15s ease, background 0.15s ease;
}
#hwModal input:focus,
#hwModal select:focus,
#hwModal textarea:focus {
  border-color: #334155;
  background: rgba(255,255,255,0.07);
  outline: none;
}

/* Nested rows/grids alignment */
#hwModal .row,
#hwModal .kv,
#hwModal .kv-span-2,
#hwModal .kv > div,
#hwModal .hardware-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  width: 100%;
  text-align: left;
  gap: 6px;
}

/* Hardware modal buttons */
#hwModal .actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  width: 100%;
}
#hwModal .actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  cursor: pointer;
  transition: background 0.15s ease;
}
#hwModal .actions button:hover {
  background: #334155;
  color: #fff;
}

/* ===== Section Headers / Dividers ===== */
#hwModal h3,
#deviceBody .popup-header {
  border-bottom: 1px solid #1e293b;
  padding-bottom: 6px;
  margin-bottom: 10px;
  font-weight: 600;
  color: #f1f5f9;
}

/* ===== Toast Message ===== */
#toast {
  transition: opacity 0.25s ease;
  background: #17324d;
  color: #cbe0f5;
  border: 1px solid #274863;
  border-radius: 8px;
  padding: 8px 12px;
  position: fixed;
  bottom: 8px;
  left: 8px;
  font: 12px/1.3 system-ui;
  z-index: 99999;
}

/* ===== Responsive behavior ===== */
@media (max-width: 768px) {
  .popup,
  #hwModal .content {
    max-width: 95%;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .popup,
  #hwModal .content {
    gap: 8px;
    font-size: 0.85rem;
  }
  .popup-value,
  #hwModal input,
  #hwModal select,
  #hwModal textarea {
    font-size: 0.85rem;
    padding: 5px 7px;
  }
}

/* ===== Final Hardware Modal Sticky Footer (Cross-browser safe) ===== */
#hwModal .actions {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0b111a;
  border-top: 1px solid #1e293b;
  padding: 10px 28px 12px 28px; /* slightly more right padding */
  display: flex;
  justify-content: flex-end;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);
  border-radius: 0 0 12px 12px;
  box-sizing: border-box;
}

/* Adjust the button to never clip against the scrollbar edge */
#hwModal .actions button {
  border-radius: 8px;
  margin-right: 0;
  padding: 8px 16px;
  max-width: calc(100% - 12px);
}


/* ===== Dark Theme Dropdown Styling ===== */

/* Base select style for all modals */
#hwModal select,
#deviceModal select {
  background-color: #0d141d;
  color: #e5eef5;
  border: 1px solid #223346;
  border-radius: 8px;
  padding: 8px 10px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}

/* Add subtle focus glow */
#hwModal select:focus,
#deviceModal select:focus {
  outline: none;
  border-color: #2b6cb0;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

/* Ensure dropdown arrow is visible and styled */
#hwModal select::-ms-expand,
#deviceModal select::-ms-expand {
  display: none;
}

/* For browsers that support option theming */
#hwModal option,
#deviceModal option {
  background-color: #0d141d;
  color: #e5eef5;
}

/* Handle hover + active item highlight */
#hwModal select option:hover,
#deviceModal select option:hover {
  background-color: #1b2636;
  color: #ffffff;
}

/* Prevent color inversion on Windows */
select:-internal-list-box,
select:-internal-list-box option {
  background-color: #0d141d !important;
  color: #e5eef5 !important;
}


.mini-map {
  border: 1px solid #223346;
  border-radius: 10px;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}

                                                                                                    