/* ============================================================
   Monitor Telfo — Stylesheet v1.0
   CSS propio, sin dependencias externas
   ============================================================ */

/* ---- Variables ------------------------------------------- */
:root {
  --brand-900: #1e3a5f;
  --brand-800: #1e4a7a;
  --brand-700: #1d5fa3;
  --brand-600: #2563eb;
  --brand-500: #3b82f6;
  --brand-100: #dbeafe;
  --brand-50:  #eff6ff;

  --green-600: #16a34a;
  --green-100: #dcfce7;
  --green-700: #15803d;

  --red-600:   #dc2626;
  --red-100:   #fee2e2;
  --red-700:   #b91c1c;

  --yellow-500: #eab308;
  --yellow-100: #fef9c3;
  --yellow-700: #a16207;

  --gray-900: #111827;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --white:    #ffffff;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 1px 4px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Monaco', monospace;
}

/* ---- Reset básico ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 15px; }
body { height: 100%; font-family: var(--font); color: var(--gray-700); background: var(--gray-100); line-height: 1.5; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ---- Layout ---------------------------------------------- */
.app-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 24px 20px; }
.app-footer { background: var(--white); border-top: 1px solid var(--gray-200); padding: 12px 20px; text-align: center; font-size: 12px; color: var(--gray-400); }

/* ---- Navbar ---------------------------------------------- */
.navbar {
  background: var(--brand-900);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 100;
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 20px;
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  color: var(--white); font-weight: 700; font-size: 16px;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.navbar-brand:hover { text-decoration: none; color: var(--white); }
.navbar-nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
  color: rgba(255,255,255,0.75);
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: var(--white); text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,0.15); color: var(--white); }
.navbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.navbar-user span { color: rgba(255,255,255,0.6); }
.navbar-user a { color: rgba(255,255,255,0.75); }
.navbar-user a:hover { color: var(--white); text-decoration: none; }

/* ---- Cards ----------------------------------------------- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--gray-900); margin-bottom: 16px; }

/* ---- Stat cards ------------------------------------------ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 768px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { border-color: var(--brand-500); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.stat-number { font-size: 36px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-number.blue   { color: var(--brand-600); }
.stat-number.green  { color: var(--green-600); }
.stat-number.red    { color: var(--red-600); }
.stat-number.yellow { color: var(--yellow-500); }

/* ---- Badges ---------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-ok      { background: var(--green-100); color: var(--green-700); }
.badge-warning { background: var(--yellow-100); color: var(--yellow-700); }
.badge-down    { background: var(--red-100); color: var(--red-700); }
.badge-info    { background: var(--brand-100); color: var(--brand-700); }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-critical { background: var(--red-100); color: var(--red-700); }

/* Status dot */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-ok      { background: var(--green-600); }
.dot-warning { background: var(--yellow-500); }
.dot-down    { background: var(--red-600); }
.dot-gray    { background: var(--gray-400); }

/* ---- Buttons --------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--brand-600); color: var(--white); border-color: var(--brand-600); }
.btn-primary:hover  { background: var(--brand-700); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); color: var(--gray-900); }
.btn-danger   { background: var(--red-600); color: var(--white); border-color: var(--red-600); }
.btn-danger:hover { background: var(--red-700); color: var(--white); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--brand-600); border-color: transparent; padding: 4px 8px; }
.btn-ghost:hover { background: var(--brand-50); }

/* ---- Forms ----------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  display: block; width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px; color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-input:disabled { background: var(--gray-50); color: var(--gray-500); cursor: not-allowed; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.form-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand-600); }

/* ---- Alerts ---------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; border: 1px solid; margin-bottom: 16px; }
.alert-error   { background: var(--red-100); border-color: #fca5a5; color: var(--red-700); }
.alert-success { background: var(--green-100); border-color: #86efac; color: var(--green-700); }
.alert-info    { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.alert-warning { background: var(--yellow-100); border-color: #fde047; color: var(--yellow-700); }

/* ---- Tables ---------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead tr { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); }
.data-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .td-action { text-align: right; white-space: nowrap; }

/* ---- Page header ----------------------------------------- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-400); margin-bottom: 12px; flex-wrap: wrap; }
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--brand-600); }
.breadcrumb-sep { color: var(--gray-300); }

/* ---- Site cards (grid) ----------------------------------- */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.site-card {
  display: block; padding: 16px;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  text-decoration: none; color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}
.site-card:hover { border-color: var(--brand-400); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; color: inherit; }
.site-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.site-card-name { font-weight: 600; font-size: 14px; color: var(--gray-900); }
.site-card-domain { font-size: 12px; color: var(--gray-400); }
.site-card-meta { font-size: 11px; color: var(--gray-400); margin-top: 6px; display: flex; gap: 8px; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; background: var(--gray-100); color: var(--gray-600); }

/* ---- Incident list --------------------------------------- */
.incident-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.incident-row:last-child { border-bottom: none; }
.incident-info { flex: 1; min-width: 0; }
.incident-title { font-size: 13px; font-weight: 500; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.incident-meta { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.incident-time { font-size: 11px; color: var(--gray-400); white-space: nowrap; }

/* ---- Timeline de eventos --------------------------------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -17px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-500); border: 2px solid var(--white); box-shadow: 0 0 0 2px var(--brand-200, #bfdbfe); }
.timeline-msg { font-size: 13px; color: var(--gray-700); }
.timeline-time { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ---- Empty state ----------------------------------------- */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state-icon { font-size: 36px; margin-bottom: 10px; }
.empty-state-text { font-size: 14px; color: var(--gray-400); }

/* ---- Check results mini bar ------------------------------ */
.uptime-bar { display: flex; gap: 2px; height: 20px; align-items: flex-end; }
.uptime-bar span { width: 6px; border-radius: 2px; min-height: 4px; }
.uptime-bar .u-ok   { background: var(--green-600); height: 20px; }
.uptime-bar .u-warn { background: var(--yellow-500); height: 14px; }
.uptime-bar .u-down { background: var(--red-600); height: 8px; }
.uptime-bar .u-none { background: var(--gray-200); height: 20px; }

/* ---- Login page ------------------------------------------ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-100); padding: 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { font-size: 40px; }
.login-logo-title { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-top: 8px; }
.login-logo-sub { font-size: 13px; color: var(--gray-400); margin-top: 2px; }
.login-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 32px; }
.login-footer { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 16px; }

/* ---- Misc utils ------------------------------------------ */
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-muted { color: var(--gray-400); }
.text-right { text-align: right; }
.font-mono  { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-gap { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media(max-width:600px) { .grid-2,.grid-3 { grid-template-columns: 1fr; } }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }
.danger-zone { border: 1px solid #fca5a5; border-radius: var(--radius); padding: 14px; background: #fff5f5; margin-top: 20px; }
.dl-table { width: 100%; }
.dl-table tr td:first-child { color: var(--gray-400); font-size: 12px; width: 140px; padding: 6px 8px; }
.dl-table tr td:last-child { font-size: 13px; font-weight: 500; padding: 6px 8px; }
.dl-table tr { border-bottom: 1px solid var(--gray-100); }
.dl-table tr:last-child { border-bottom: none; }

/* ---- Responsive nav -------------------------------------- */
@media (max-width: 768px) {
  .navbar-nav { display: none; }
  .main-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
}

/* ---- Logo en navbar ------------------------------------ */
.navbar-logo {
  height: 54px;
  width: auto;
  display: block;
  filter: brightness(1.05);
}
.navbar-brand { padding: 4px 0; }

/* ---- Iconos en nav ------------------------------------- */
.nav-icon { font-size: 13px; margin-right: 2px; }
.nav-link { display: inline-flex; align-items: center; gap: 4px; }

/* ---- User area derecha --------------------------------- */
.navbar-username {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  padding: 0 4px;
  border-right: 1px solid rgba(255,255,255,0.15);
  margin-right: 4px;
}
.nav-link-user {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 3px;
  transition: background 0.15s, color 0.15s;
}
.nav-link-user:hover { background: rgba(255,255,255,0.1); color: var(--white); text-decoration: none; }
.nav-link-logout:hover { background: rgba(220,38,38,0.3); color: #fca5a5; }

/* ---- Botones inline en tabla (editar/duplicar) --------- */
.btn-table-group { display: flex; gap: 4px; justify-content: flex-end; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-900); text-decoration: none; }
.btn-icon-primary:hover { background: var(--brand-50); border-color: var(--brand-300, #93c5fd); color: var(--brand-700); }
.btn-icon-dupe:hover { background: #f0fdf4; border-color: #86efac; color: var(--green-700); }
.btn-icon-danger:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

/* Hamburguesa oculta en escritorio (se muestra solo en móvil vía media query) */
.nav-hamburger { display: none; }

/* ============================================================
   RESPONSIVE MÓVIL — solo afecta a pantallas < 768px
   En PC/escritorio no cambia absolutamente nada
   ============================================================ */

@media (max-width: 768px) {

  /* Hamburguesa solo visible en móvil */

  /* ---- Navbar móvil ---- */
  .navbar-inner {
    height: auto;
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .navbar-logo { height: 36px; }
  .navbar-nav {
    display: none; /* oculto por defecto, se muestra con .nav-open */
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 6px 0 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .navbar-nav.nav-open { display: flex; }
  .nav-link { padding: 10px 12px; font-size: 15px; width: 100%; }
  .navbar-user {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 6px 0 4px;
  }
  .navbar-user.nav-open { display: flex; }
  .navbar-username { border-right: none; padding: 8px 12px; font-size: 13px; }
  .nav-link-user { padding: 10px 12px; font-size: 14px; width: 100%; }

  /* ---- Botón hamburguesa ---- */
  .nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px; height: 36px;
    padding: 6px;
    cursor: pointer;
    background: none;
    border: none;
    margin-left: auto;
  }
  .nav-hamburger span {
    display: block;
    width: 22px; height: 2px;
    background: rgba(255,255,255,0.85);
    border-radius: 2px;
    transition: all 0.2s;
  }
  .nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-hamburger.open span:nth-child(2) { opacity: 0; }
  .nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* ---- Layout ---- */
  .main-content { padding: 14px 12px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-header .btn { width: 100%; justify-content: center; }

  /* ---- Cards ---- */
  .card { padding: 14px 12px; border-radius: var(--radius); }

  /* ---- Tablas ---- */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table th, .data-table td { padding: 10px 10px; }
  .btn-table-group { gap: 6px; }
  .btn-icon { width: 34px; height: 34px; font-size: 16px; }

  /* ---- Formularios ---- */
  .form-row { grid-template-columns: 1fr; }
  .card[style*="max-width"] { max-width: 100% !important; }
  .flex-gap { flex-direction: column; }
  .flex-gap .btn { width: 100%; justify-content: center; }

  /* ---- Dashboard grid ---- */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-number { font-size: 28px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* ---- Incidentes ---- */
  .incident-row { flex-wrap: wrap; }
  .incident-title { white-space: normal; }

  /* ---- Login ---- */
  .login-card { padding: 24px 18px; }
}


/* ---- Dashboard grid ------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ---- Visibilidad por dispositivo ----------------------- */
.hide-mobile { /* visible en escritorio, oculto en móvil — ver media query */ }
.show-mobile { display: none; } /* oculto en escritorio */

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block; }
}
