/* ==========================================================================
   HCABORCA SYNC — HOJA DE ESTILOS PREMIUM
   Paleta: Dark Tech Glassmorphism / Cyberpunk NOC / Alta Legibilidad
   ========================================================================== */

:root {
  --bg-main: #090c15;
  --bg-card: rgba(16, 22, 38, 0.75);
  --bg-card-hover: rgba(22, 30, 52, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 229, 255, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #00e5ff;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-purple: #8b5cf6;

  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow-cyan: 0 0 20px rgba(0, 229, 255, 0.25);
  --shadow-glow-red: 0 0 20px rgba(244, 63, 94, 0.3);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Fondo con efecto degradado dinámico */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(circle at 15% 15%, rgba(0, 229, 255, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   HEADER Y NAVEGACIÓN
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 12, 21, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #000;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
  box-shadow: var(--shadow-glow-cyan);
}

.brand-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}

.brand-title span {
  color: var(--accent-cyan);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #050b14;
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: var(--shadow-glow-cyan);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.nav-tabs-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.tabs-wrapper {
  display: flex;
  gap: 4px;
  border-top: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.04);
}

.tab-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 700;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */

.main-content {
  max-width: 1560px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  position: relative;
  z-index: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   KPI CARDS
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}

@media (max-width: 1300px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

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

.kpi-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-icon-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  white-space: nowrap;
}

.kpi-value {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-footer {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.kpi-highlight {
  border-color: rgba(0, 229, 255, 0.3);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.08) 0%, rgba(16, 22, 38, 0.8) 100%);
}

.kpi-highlight .kpi-value {
  color: var(--accent-cyan);
}

.kpi-alert {
  border-color: rgba(244, 63, 94, 0.3);
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.08) 0%, rgba(16, 22, 38, 0.8) 100%);
}

.kpi-alert .kpi-value {
  color: var(--accent-red);
}

/* ==========================================================================
   SECCIONES Y TABLAS
   ========================================================================== */

.section-box {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-card);
}

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

.section-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.table-loading {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
}

/* Badges e Insignias */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.badge-score-high {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-score-med {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-sev-high {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-sev-med {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-sev-low {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-status-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.badge-status-suspended {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-red);
}

.badge-status-disconnected {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Badges UISP y Sincronización */
.badge-uisp-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-uisp-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-uisp-none {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-synced {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-mismatch {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-red {
  background: rgba(244, 63, 94, 0.25) !important;
  color: #f43f5e !important;
  border: 1px solid rgba(244, 63, 94, 0.4) !important;
}

.btn-sync-action {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-sync-action:hover {
  background: var(--accent-cyan);
  color: #0b0f19;
  box-shadow: var(--shadow-glow-cyan);
}

/* ==========================================================================
   FILTROS DE DISCREPANCIAS
   ========================================================================== */

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.filter-btn.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

.filter-sectorial-off {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

.filter-sectorial-on {
  background: rgba(245, 158, 11, 0.18) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  font-weight: 600;
}

.badge-truth-mikrotik {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  font-weight: 600;
  font-size: 11px;
}

.badge-name-update {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-size: 10px;
}

/* ==========================================================================
   COMPARADOR LADO A LADO
   ========================================================================== */

.comparator-search-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px 12px 42px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}

.comparator-stats {
  font-size: 13px;
  color: var(--text-muted);
}

.comparator-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comparator-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.comparator-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.client-title {
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.client-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.split-columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.split-col {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.split-col-header {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.col-wisphub .split-col-header { color: var(--accent-cyan); }
.col-aircontrol .split-col-header { color: var(--accent-blue); }
.col-uisp .split-col-header { color: var(--accent-purple); }
.col-mikrotik .split-col-header { color: #f59e0b; }

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(244, 63, 94, 0.4);
}
.btn-danger:hover {
  background: rgba(244, 63, 94, 0.3);
  color: #fff;
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.btn-success:hover {
  background: rgba(16, 185, 129, 0.3);
  color: #fff;
}

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.field-label {
  color: var(--text-muted);
}

.field-val {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.field-val-diff {
  color: var(--accent-red);
  background: rgba(244, 63, 94, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.field-val-match {
  color: var(--accent-green);
  font-weight: 600;
}

/* ==========================================================================
   TARJETAS DE SALUD
   ========================================================================== */

.health-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.health-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.health-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.health-name {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
}

.health-latency {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-green);
}

.health-endpoint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: 14px;
}

.security-policy-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.policy-title {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}

.policy-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.policy-list li {
  position: relative;
  padding-left: 20px;
}

.policy-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
  font-size: 16px;
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: #111728;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 90%;
  box-shadow: var(--shadow-card);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   PAGINACIÓN Y CONTROLES DE RENDIMIENTO
   ========================================================================== */

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(16, 22, 38, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 14px;
  margin-bottom: 14px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-current {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  min-width: 100px;
  text-align: center;
}

.comparator-controls-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-size-label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.select-page-size {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

.select-page-size:focus {
  border-color: var(--accent-cyan);
}
