/* BotCordoba Web Panel — Stylesheet v1.0 */
/* Tipografía: JetBrains Mono + Space Grotesk */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  --bg-base:    #0a0d12;
  --bg-surface: #10151c;
  --bg-card:    #161d27;
  --bg-hover:   #1e2733;
  --border:     #1e2d3d;
  --border-mid: #2a3f55;
  --text-prim:  #e2eaf4;
  --text-sec:   #7a95b0;
  --text-muted: #4a6070;
  --accent:     #1e6feb;
  --accent-glow:#1e6feb44;
  --green:      #2da44e;
  --green-bg:   #0d2318;
  --green-text: #3fb950;
  --red:        #da3633;
  --red-bg:     #2d1117;
  --red-text:   #f85149;
  --amber:      #bb8009;
  --amber-bg:   #2d1f00;
  --amber-text: #e3b341;
  --blue-bg:    #0d1f38;
  --blue-text:  #58a6ff;
  --font-main:  'Space Grotesk', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;
  --radius:     6px;
  --radius-lg:  10px;
}

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

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-prim);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 0;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; color: var(--text-prim);
  margin-right: 24px; white-space: nowrap;
}
.nav-logo-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); display: flex;
  align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  color: #fff; flex-shrink: 0;
}
.nav-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.nav-links { display: flex; flex: 1; }
.nav-link {
  padding: 0 14px; height: 52px;
  display: flex; align-items: center;
  font-size: 13px; color: var(--text-sec);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}
.nav-link:hover { color: var(--text-prim); text-decoration: none; }
.nav-link.active { color: var(--text-prim); border-bottom-color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-sec);
  font-family: var(--font-mono);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  animation: pulse 2s infinite;
}
.status-dot.off { background: var(--red); animation: none; }
@keyframes pulse {
  0%,100% { opacity: 1; } 50% { opacity: .4; }
}

/* ── LAYOUT ── */
.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: 1fr;
  height: 100vh;
  padding-top: 52px;
}
.main { overflow-y: auto; padding: 20px; }
.sidebar {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.stat-label {
  font-size: 10px; font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 24px; font-weight: 600;
  color: var(--text-prim);
  font-family: var(--font-mono);
  line-height: 1;
}
.stat-value.ok  { color: var(--green-text); }
.stat-value.err { color: var(--red-text); }
.stat-value.warn{ color: var(--amber-text); }
.stat-value.info{ color: var(--blue-text); }
.stat-sub {
  font-size: 11px; color: var(--text-muted);
  margin-top: 5px; font-family: var(--font-mono);
}

/* ── CARD ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-size: 13px; font-weight: 500; color: var(--text-prim);
  display: flex; align-items: center; gap: 8px;
}
.card-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.card-body { padding: 16px; }

/* ── MAP ── */
#mapa {
  height: 240px;
  background: var(--bg-base);
}
.leaflet-container { background: var(--bg-base) !important; }
.leaflet-tile { filter: brightness(0.5) saturate(0.6); }

/* ── ALERTS ── */
.alert-list { display: flex; flex-direction: column; gap: 0; }
.alert-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--bg-hover); }
.alert-badge {
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 500; white-space: nowrap;
  font-family: var(--font-mono);
}
.badge-aemet  { background: var(--amber-bg); color: var(--amber-text); }
.badge-infoca { background: var(--red-bg);   color: var(--red-text); }
.badge-ign    { background: var(--blue-bg);  color: var(--blue-text); }
.badge-ree    { background: var(--green-bg); color: var(--green-text); }
.badge-ok     { background: var(--green-bg); color: var(--green-text); }
.badge-warn   { background: var(--amber-bg); color: var(--amber-text); }
.badge-red    { background: var(--red-bg);   color: var(--red-text); }
.badge-info   { background: var(--blue-bg);  color: var(--blue-text); }
.alert-text { font-size: 12px; color: var(--text-prim); flex: 1; }
.alert-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; font-family: var(--font-mono); }

/* ── NODES TABLE ── */
.nodos-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.nodos-table th {
  text-align: left; padding: 8px 12px;
  font-size: 10px; font-weight: 500;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; border-bottom: 1px solid var(--border);
}
.nodos-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  color: var(--text-prim); font-family: var(--font-mono);
}
.nodos-table tr:hover td { background: var(--bg-hover); }
.nodos-table tr:last-child td { border-bottom: none; }
.node-name { font-family: var(--font-main); font-weight: 500; }
.node-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.node-dot.online { background: var(--green); }
.node-dot.offline { background: var(--red); }
.node-dot.warn { background: var(--amber-text); }

/* ── SOS ── */
.sos-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.sos-item:last-child { border-bottom: none; }
.sos-header { display: flex; align-items: center; justify-content: space-between; }
.sos-badge {
  padding: 3px 10px; border-radius: 4px;
  font-size: 11px; font-weight: 500;
}
.sos-pendiente { background: var(--red-bg); color: var(--red-text); }
.sos-confirmado{ background: var(--amber-bg); color: var(--amber-text); }
.sos-cancelado { background: var(--bg-hover); color: var(--text-muted); }
.sos-nodo { font-size: 13px; font-weight: 500; }
.sos-msg  { font-size: 12px; color: var(--text-sec); }
.sos-time { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.sos-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ── FEED ── */
.feed-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.feed-tab {
  padding: 10px 14px;
  font-size: 12px; color: var(--text-sec);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.feed-tab:hover { color: var(--text-prim); }
.feed-tab.active { color: var(--text-prim); border-bottom-color: var(--accent); }
.feed-body { flex: 1; overflow-y: auto; }
.msg-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
  transition: background .1s;
}
.msg-item:hover { background: var(--bg-hover); }
.msg-header { display: flex; align-items: center; justify-content: space-between; }
.msg-from { font-size: 12px; font-weight: 500; color: var(--blue-text); }
.msg-from.bot-msg { color: var(--green-text); }
.msg-from.alert-msg { color: var(--amber-text); }
.msg-time { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.msg-text {
  font-size: 12px; color: var(--text-prim);
  font-family: var(--font-mono); white-space: pre-wrap; word-break: break-word;
}
.feed-bar {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
}
.feed-live {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text-muted);
  font-family: var(--font-mono); margin-bottom: 6px;
}
.feed-input-row { display: flex; gap: 8px; }
.feed-inp {
  flex: 1; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 10px; font-size: 12px; font-family: var(--font-mono);
  color: var(--text-prim); outline: none;
  transition: border-color .15s;
}
.feed-inp:focus { border-color: var(--accent); }
.feed-inp:disabled { opacity: .4; cursor: not-allowed; }

/* ── BUTTONS ── */
.btn {
  padding: 6px 14px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-hover);
  color: var(--text-prim); transition: all .15s; font-family: var(--font-main);
}
.btn:hover { border-color: var(--border-mid); background: var(--bg-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .85; }
.btn-green { background: var(--green-bg); border-color: var(--green); color: var(--green-text); }
.btn-red   { background: var(--red-bg);   border-color: var(--red);   color: var(--red-text); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ── BADGES DE ROL ── */
.role-badge {
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 500; font-family: var(--font-mono);
}
.role-pub  { background: var(--blue-bg);  color: var(--blue-text); }
.role-op   { background: var(--green-bg); color: var(--green-text); }
.role-adm  { background: var(--red-bg);   color: var(--red-text); }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg-base);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px; width: 340px;
}
.login-title {
  font-size: 18px; font-weight: 600;
  color: var(--text-prim); margin-bottom: 4px;
}
.login-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 24px; }
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 11px; font-weight: 500;
  color: var(--text-sec); margin-bottom: 5px; text-transform: uppercase;
  letter-spacing: .5px;
}
.form-input {
  width: 100%; background: var(--bg-base);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 13px; font-family: var(--font-mono);
  color: var(--text-prim); outline: none; transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }
.form-error { font-size: 11px; color: var(--red-text); margin-top: 4px; }

/* ── FOOTER ── */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 8px 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── UTILITIES ── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.text-green { color: var(--green-text); }
.text-red   { color: var(--red-text); }
.text-amber { color: var(--amber-text); }
.text-blue  { color: var(--blue-text); }
.text-muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

/* ── TOAST ── */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 999;
}
.toast {
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 12px; color: var(--text-prim);
  border: 1px solid var(--border);
  background: var(--bg-card);
  animation: slideIn .2s ease;
}
.toast.ok  { border-color: var(--green); }
.toast.err { border-color: var(--red); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
