/* ==========================================================================
   Panel VPS Hostinger — estilos propios sobre Bootstrap 5
   ========================================================================== */

:root {
  --pc-sidebar-w: 236px;
  --pc-sidebar-bg: #12181f;
  --pc-sidebar-bg2: #0c1116;
  --pc-accent: #2f6bff;
  --pc-radius: .7rem;
}

body {
  font-size: 15px;
  background: var(--bs-body-tertiary-bg, #f4f6f9);
  overflow-x: hidden;
}

/* ---------- Estructura ---------- */
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1 1 auto;
  min-width: 0;                       /* que las tablas anchas no empujen el layout */
  display: flex;
  flex-direction: column;
}

.content { padding: 1.25rem; flex: 1 1 auto; }

/* ---------- Barra lateral ---------- */
.sidebar {
  width: var(--pc-sidebar-w);
  flex: 0 0 var(--pc-sidebar-w);
  background: linear-gradient(180deg, var(--pc-sidebar-bg) 0%, var(--pc-sidebar-bg2) 100%);
  color: #dfe6ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-logo {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--pc-accent);
  color: #fff; font-size: 1.1rem;
}

.brand-name { font-weight: 600; line-height: 1.1; }
.brand-sub  { font-size: .74rem; color: #8c9bab; }

.sidebar-nav { padding: .75rem .6rem; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }

.nav-item-btn {
  display: flex; align-items: center; gap: .7rem;
  width: 100%;
  padding: .58rem .75rem;
  border: 0; border-radius: .5rem;
  background: transparent;
  color: #b9c4d0;
  font-size: .92rem;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-item-btn i { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-item-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item-btn.active { background: var(--pc-accent); color: #fff; font-weight: 500; }

.sidebar-foot { padding: .8rem; border-top: 1px solid rgba(255, 255, 255, .07); }

.vps-mini {
  display: flex; align-items: center; gap: .45rem;
  font-size: .78rem; color: #8c9bab;
  margin-bottom: .6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vps-mini .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6c757d; flex: 0 0 8px;
}
.vps-mini .dot.on  { background: #28a745; box-shadow: 0 0 0 3px rgba(40, 167, 69, .18); }
.vps-mini .dot.off { background: #dc3545; box-shadow: 0 0 0 3px rgba(220, 53, 69, .18); }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1.25rem;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.topbar-actions .form-select { min-width: 190px; }

/* ---------- Tarjetas ---------- */
.card {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--pc-radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: transparent;
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600; font-size: .93rem;
  padding: .7rem 1rem;
}

/* ---------- Tarjetas de estado ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
}
.stat .card-body { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; }
.stat-icon {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.1rem;
}
.stat-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--bs-secondary-color);
}
.stat-value { font-size: 1.05rem; font-weight: 600; line-height: 1.3; word-break: break-word; }

/* ---------- Métricas ---------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .75rem;
}
.metric {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--pc-radius);
  padding: .8rem .9rem;
}
.metric-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.metric-name {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--bs-secondary-color);
}
.metric-pct { font-size: .78rem; font-weight: 600; }
.metric-value { font-size: 1.35rem; font-weight: 600; line-height: 1.25; }
.metric-unit { font-size: .8rem; font-weight: 400; color: var(--bs-secondary-color); }
.metric-foot { font-size: .74rem; color: var(--bs-secondary-color); margin-top: .4rem; }

/* Meter: la pista es el mismo color de la barra, más claro */
.meter {
  height: 6px; border-radius: 3px; overflow: hidden; margin-top: .55rem;
}
.meter span { display: block; height: 100%; border-radius: 3px; transition: width .3s ease; }

/* Sparkline */
.spark { position: relative; margin-top: .55rem; height: 34px; }
.spark svg { width: 100%; height: 34px; display: block; overflow: visible; }

.spark-dot, .spark-cursor {
  position: absolute;
  width: 8px; height: 8px; border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--bs-body-bg);   /* anillo del color de la superficie */
  pointer-events: none;
}
.spark-cursor { opacity: 0; transition: opacity .12s; }
.spark-cursor.visible { opacity: 1; }

.spark-tip {
  position: absolute; bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--bs-emphasis-color);
  color: var(--bs-body-bg);
  font-size: .72rem; white-space: nowrap;
  padding: .15rem .45rem; border-radius: .3rem;
  opacity: 0; transition: opacity .12s;
  pointer-events: none; z-index: 5;
}
.spark-tip.visible { opacity: .95; }

/* ---------- Varios ---------- */
.raw {
  background: var(--bs-body-tertiary-bg, #f8f9fa);
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  padding: .75rem;
  font-size: .78rem;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0;
}

.table td, .table th { vertical-align: middle; }
.table > :not(caption) > * > * { padding: .55rem .6rem; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--bs-secondary-color); font-weight: 600;
}

.vacio { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color); }
.vacio i { font-size: 2rem; opacity: .35; display: block; margin-bottom: .6rem; }
.vacio p { margin: 0; font-size: .9rem; }

.list-group-item-action.active { background: var(--pc-accent); border-color: var(--pc-accent); }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, #12181f 0%, #1d2a3d 100%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bs-body-bg);
  border-radius: 1rem;
  padding: 1.9rem 1.6rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .3);
}
.login-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.4rem; }
.login-logo {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  border-radius: 12px; background: var(--pc-accent); color: #fff; font-size: 1.25rem;
}
.login-title { font-weight: 600; font-size: 1.1rem; line-height: 1.1; }
.login-sub { font-size: .78rem; color: var(--bs-secondary-color); }

/* ---------- Responsive: la barra lateral se vuelve cajón ---------- */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.abierta { transform: translateX(0); }
  .sidebar-backdrop.visible { display: block; }
  .content { padding: 1rem .85rem; }
  .topbar { padding: .7rem .85rem; }
  .topbar-actions .form-select { min-width: 130px; }
  .topbar-title { font-size: .98rem; }
}

/* ---------- Modo oscuro ---------- */
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] {
  --pc-sidebar-bg: #0d1117;
  --pc-sidebar-bg2: #090d12;
}
[data-bs-theme="dark"] .card { box-shadow: none; }

/* ---------- Avisos ---------- */
.campana { position: relative; }

.campana-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  font-size: .68rem; font-weight: 700; line-height: 17px;
  color: #fff;
  border: 2px solid var(--bs-body-bg);
  text-align: center;
}

.aviso-item {
  display: flex; gap: .75rem; align-items: flex-start;
  padding-top: .7rem; padding-bottom: .7rem;
}

.aviso-icono { font-size: 1.05rem; line-height: 1.35; flex: 0 0 auto; }

.aviso-cuerpo { min-width: 0; flex: 1 1 auto; }

.aviso-titulo {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline;
  font-weight: 600;
}

/* El estado va escrito, no solo pintado: el color por sí solo no se lee. */
.aviso-estado {
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}

.aviso-detalle {
  color: var(--bs-secondary-color);
  font-size: .875rem; margin-top: .1rem;
  overflow-wrap: anywhere;
}

.aviso-consejo {
  margin-top: .35rem; padding: .4rem .6rem;
  border-radius: .4rem;
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
  font-size: .82rem;
}

/* ---------- Datos para el cliente de correo ---------- */
.cfg-grid {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.cfg-caja {
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  padding: .6rem .75rem;
  background: var(--bs-body-bg);
}

.cfg-cab {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--bs-secondary-color);
  margin-bottom: .4rem;
}

.cfg-fila {
  display: flex; gap: .6rem; align-items: baseline;
  padding: .18rem 0;
  font-size: .9rem;
}

.cfg-et { color: var(--bs-secondary-color); flex: 0 0 5.6rem; }

.cfg-val { font-weight: 600; overflow-wrap: anywhere; }

.cfg-mono { font-family: var(--bs-font-monospace); font-size: .86rem; }

.cfg-nota, .cfg-aviso {
  font-size: .8rem;
  color: var(--bs-secondary-color);
  line-height: 1.4;
}

.cfg-nota { margin: .25rem 0 .5rem; }

.cfg-aviso {
  background: var(--bs-secondary-bg);
  border-radius: .45rem;
  padding: .45rem .6rem;
}

.cfg-acciones {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-top: .9rem; padding-top: .8rem;
  border-top: 1px solid var(--bs-border-color);
}

/* Confirmación dentro del modal: un toast de SweetAlert lo reemplazaría. */
.cfg-hecho {
  font-size: .82rem; font-weight: 600;
  color: #0ca30c;
  opacity: 0; transition: opacity .18s ease;
}
.cfg-hecho.visible { opacity: 1; }
.cfg-hecho.mal { color: #d03b3b; }
