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

body {
  background-color: #0f1117;
  color: #e0e0e0;
  font-family: 'Segoe UI', sans-serif;
  padding: 20px;
}

header {
  text-align: center;
  padding: 30px 0 20px;
  border-bottom: 1px solid #2a2d3e;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2rem;
  color: #4fc3f7;
}

header p {
  color: #888;
  margin-top: 5px;
}

h2 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: #90caf9;
}

hr {
  border: none;
  border-top: 1px solid #2a2d3e;
  margin: 40px 0;
}

/* SSH FORM */
.ssh-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.ssh-form input {
  background: #1e2130;
  border: 1px solid #2a2d3e;
  color: #e0e0e0;
  padding: 8px 12px;
  border-radius: 6px;
  flex: 1;
  min-width: 150px;
}

.ssh-form input:focus {
  outline: none;
  border-color: #4fc3f7;
}

/* BOTONES */
button {
  background-color: #1565c0;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

button:hover { background-color: #1976d2; }

button.btn-start  { background-color: #2e7d32; }
button.btn-start:hover  { background-color: #388e3c; }

button.btn-stop   { background-color: #b71c1c; }
button.btn-stop:hover   { background-color: #c62828; }

button.btn-restart { background-color: #e65100; }
button.btn-restart:hover { background-color: #ef6c00; }

button.btn-logs   { background-color: #4527a0; }
button.btn-logs:hover   { background-color: #512da8; }

button.btn-remove { background-color: #7b1fa2; }
button.btn-remove:hover { background-color: #8e24aa; }

/* DESHABILITADO */
button:disabled {
  background-color: #2a2a2a !important;
  color: #555 !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* GRID DE CONTENEDORES */
.container-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.container-card {
  background: #1e2130;
  border: 1px solid #2a2d3e;
  border-radius: 10px;
  padding: 16px;
}

.container-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #e0e0e0;
  word-break: break-all;
}

.container-card .meta {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 12px;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: bold;
  margin-bottom: 12px;
}

.status-running { background: #1b5e20; color: #a5d6a7; }
.status-exited  { background: #b71c1c; color: #ef9a9a; }
.status-paused  { background: #e65100; color: #ffcc80; }

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-actions button {
  font-size: 0.8rem;
  padding: 6px 10px;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal.hidden { display: none; }

.modal-content {
  background: #1e2130;
  border: 1px solid #2a2d3e;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2d3e;
}

.modal-header button {
  background: transparent;
  font-size: 1.2rem;
  color: #888;
}

.modal-header button:hover { color: white; background: transparent; }

#log-output {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.8rem;
  color: #a5d6a7;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
}

#confirm-message code {
  background: #2a2d3e;
  padding: 2px 6px;
  border-radius: 4px;
  color: #f48fb1;
}

/* TABS */
.tabs-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #2a2d3e;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  color: #888;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover { color: #e0e0e0; background: transparent; }

.tab.active {
  color: #4fc3f7;
  border-bottom: 3px solid #4fc3f7;
  background: transparent;
}

.tab-group {
  display: flex;
  align-items: center;
}

.tab-close {
  background: transparent;
  color: #555;
  border: none;
  padding: 4px 6px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  margin-left: -6px;
}

.tab-close:hover { color: #ef5350; background: transparent; }

.btn-add-ssh {
  background: #1e2130;
  border: 1px dashed #4fc3f7;
  color: #4fc3f7;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add-ssh:hover { background: #263045; }

/* PANELS */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.host-badge {
  font-size: 0.75rem;
  color: #888;
  font-weight: normal;
  background: #1e2130;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

/* MODAL PEQUEÑO */
.modal-small {
  max-width: 460px;
  width: 90%;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body input {
  background: #0f1117;
  border: 1px solid #2a2d3e;
  color: #e0e0e0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.95rem;
}

.modal-body input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.modal-footer {
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #2a2d3e;
}

/* ─── RESPONSIVE MÓVIL (iPhone 14 Pro Max = 430px) ──────── */

@media (max-width: 480px) {

  body {
    padding: 12px;
  }

  header {
    padding: 20px 0 14px;
    margin-bottom: 16px;
  }

  header h1 {
    font-size: 1.4rem;
  }

  header p {
    font-size: 0.8rem;
  }

  /* TABS */
  .tabs-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 10px;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .tab {
    font-size: 0.85rem;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .btn-add-ssh {
    width: 100%;
    text-align: center;
    padding: 10px;
  }

  /* PANEL HEADER */
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-header button {
    width: 100%;
  }

  .host-badge {
    display: block;
    margin: 4px 0 0 0;
    font-size: 0.7rem;
  }

  /* GRID - una columna en móvil */
  .container-grid {
    grid-template-columns: 1fr;
  }

  /* CARDS */
  .container-card {
    padding: 14px;
  }

  .container-card h3 {
    font-size: 0.95rem;
  }

  .container-card .meta {
    font-size: 0.75rem;
  }

  /* BOTONES DE ACCIONES */
  .card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .card-actions button {
    font-size: 0.8rem;
    padding: 8px 6px;
    text-align: center;
    width: 100%;
  }

  /* MODAL */
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-small {
    width: 95%;
  }

  .modal-body {
    padding: 14px;
    gap: 10px;
  }

  .modal-body input {
    padding: 10px;
    font-size: 1rem; /* más grande para no hacer zoom en iOS */
  }

  .modal-footer {
    flex-direction: column;
    padding: 12px 14px;
  }

  .modal-footer button {
    width: 100%;
    padding: 12px;
  }

  #log-output {
    font-size: 0.75rem;
    padding: 14px;
  }

}
/* ── METRICAS ─────────────────────────────────────────── */
.metrics-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: #12151f;
  border: 1px solid #2a2d3e;
  border-radius: 10px;
  padding: 0;
  margin-bottom: 24px;
  overflow: hidden;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 160px;
  padding: 14px 20px;
  border-right: 1px solid #2a2d3e;
}

.metric-item:last-child {
  border-right: none;
}

.metric-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #555c7a;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-bar-wrap {
  width: 100%;
  background: #1e2235;
  border-radius: 99px;
  height: 5px;
  overflow: hidden;
}

.metric-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}

.metric-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: #c8cde8;
  white-space: nowrap;
}

.metrics-error {
  color: #ef5350;
  font-size: 0.85rem;
  padding: 14px 20px;
}

@media (max-width: 700px) {
  .metric-item {
    min-width: 50%;
    border-right: none;
    border-bottom: 1px solid #2a2d3e;
  }
  .metric-item:last-child { border-bottom: none; }
}
