/* GEDSuite Control Center – Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg: #0A1628;
  --sidebar-active: #1E3A5F;
  --sidebar-text: #94A3B8;
  --sidebar-text-active: #FFFFFF;
  --brand: #2563EB;
  --brand-dark: #1D4ED8;
  --accent: #0EA5E9;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #64748B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
#app { height: 100%; }
a { color: var(--brand); text-decoration: none; }
button { cursor: pointer; font-family: inherit; font-size: 14px; border: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo-title { color: #fff; font-weight: 800; font-size: 15px; line-height: 1.2; }
.sidebar-logo-sub   { color: var(--sidebar-text); font-size: 11px; margin-top: 2px; }
.sidebar-logo-badge {
  display: inline-block; margin-top: 6px;
  background: var(--brand); color: #fff;
  font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  letter-spacing: .05em; text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  color: rgba(148,163,184,.5); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 16px 16px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: var(--sidebar-text);
  cursor: pointer; border-radius: 0;
  transition: background .15s, color .15s;
  font-size: 13px; font-weight: 500;
  position: relative;
}
.nav-item:hover  { background: rgba(255,255,255,.06); color: #cbd5e1; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--brand); border-radius: 0 2px 2px 0;
}
.nav-item .icon { opacity: .7; flex-shrink: 0; }
.nav-item.active .icon { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-user-name  { color: #fff; font-size: 12px; font-weight: 600; }
.sidebar-user-role  { color: var(--sidebar-text); font-size: 11px; }
.sidebar-logout {
  margin-left: auto; color: var(--sidebar-text); background: none;
  padding: 4px; border-radius: 4px; transition: color .15s;
}
.sidebar-logout:hover { color: #fff; }

/* ── Main ───────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: var(--header-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 12px;
  flex-shrink: 0;
}
.topbar-title { font-weight: 700; font-size: 16px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.page { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Cards / Surfaces ───────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-title { font-weight: 700; font-size: 14px; flex: 1; }
.card-body  { padding: 20px; }

/* ── Stats Grid ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow);
}
.stat-card.critical { border-left: 4px solid var(--danger); }
.stat-card.warning  { border-left: 4px solid var(--warning); }
.stat-card.success  { border-left: 4px solid var(--success); }
.stat-card.info     { border-left: 4px solid var(--info); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--text-muted); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 14px;
  background: #F8FAFC; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 12px; color: var(--text-muted);
  white-space: nowrap;
}
td {
  padding: 11px 14px; border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F8FAFC; }

/* ── Status 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-healthy, .badge-active, .badge-resolved, .badge-stable { background: #DCFCE7; color: #15803D; }
.badge-warning, .badge-acknowledged                           { background: #FEF9C3; color: #A16207; }
.badge-critical, .badge-offline, .badge-suspended             { background: #FEE2E2; color: #B91C1C; }
.badge-inactive, .badge-ignored                               { background: #F1F5F9; color: #64748B; }
.badge-beta                                                    { background: #E0F2FE; color: #0369A1; }
.badge-deprecated                                              { background: #F5F3FF; color: #7C3AED; }
.badge-info                                                    { background: #DBEAFE; color: #1D4ED8; }
.badge-open                                                    { background: #FEE2E2; color: #B91C1C; }
.badge-low                                                     { background: #F0FDF4; color: #15803D; }
.badge-medium                                                   { background: #FEF9C3; color: #A16207; }
.badge-high                                                     { background: #FEF3C7; color: #D97706; }

/* Dot indicator */
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-healthy, .dot-active   { background: var(--success); }
.dot-warning                { background: var(--warning); }
.dot-critical, .dot-offline { background: var(--danger); }
.dot-inactive               { background: #CBD5E1; }

/* Semáforo large */
.semaphore {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
}
.semaphore .dot { width: 10px; height: 10px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-weight: 600;
  font-size: 13px; transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #DC2626; }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover   { background: var(--bg); }
.btn-sm        { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon      { padding: 6px; border-radius: 6px; background: transparent; color: var(--text-muted); }
.btn-icon:hover    { background: var(--bg); color: var(--text); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-label  { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row    { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
  animation: fade-in .15s;
}
.modal {
  background: var(--surface); border-radius: 14px;
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: slide-up .2s;
}
.modal-lg  { max-width: 720px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-title   { font-weight: 700; font-size: 16px; flex: 1; }
.modal-body    { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer  { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Search bar ─────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface);
  min-width: 220px;
}
.search-bar input {
  border: none; outline: none; background: none;
  font-size: 13px; color: var(--text); flex: 1;
}
.search-bar .icon { color: var(--text-muted); flex-shrink: 0; }

/* ── Filters bar ────────────────────────────────────────── */
.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── Alert list ─────────────────────────────────────────── */
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 8px;
  border: 1px solid var(--border); margin-bottom: 8px;
  background: var(--surface);
}
.alert-item.critical { border-left: 4px solid var(--danger); }
.alert-item.warning  { border-left: 4px solid var(--warning); }
.alert-item.info     { border-left: 4px solid var(--info); }
.alert-icon { margin-top: 2px; flex-shrink: 0; }
.alert-title { font-weight: 600; font-size: 13px; }
.alert-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.alert-meta  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.alert-actions { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }

/* ── Monitoring grid ────────────────────────────────────── */
.monitoring-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.monitor-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); transition: box-shadow .15s;
}
.monitor-card:hover { box-shadow: var(--shadow-md); }
.monitor-card.healthy { border-top: 3px solid var(--success); }
.monitor-card.warning { border-top: 3px solid var(--warning); }
.monitor-card.critical, .monitor-card.offline { border-top: 3px solid var(--danger); }
.monitor-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.monitor-card-name   { font-weight: 700; font-size: 13px; flex: 1; }
.monitor-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.monitor-metric  { background: var(--bg); border-radius: 6px; padding: 8px 10px; }
.monitor-metric-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.monitor-metric-value { font-size: 14px; font-weight: 700; margin-top: 2px; }

/* ── Bar chart (CSS only) ───────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 80px; }
.bar { flex: 1; background: var(--brand); opacity: .8; border-radius: 3px 3px 0 0; min-width: 6px; }
.bar:hover { opacity: 1; }

/* ── Login ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0A1628 0%, #1E3A5F 100%);
  padding: 16px;
}
.login-card {
  background: var(--surface); border-radius: 16px;
  padding: 40px 36px; width: 100%; max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,.3);
}
.login-logo   { text-align: center; margin-bottom: 28px; }
.login-logo-title  { font-size: 20px; font-weight: 800; color: var(--text); }
.login-logo-sub    { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form   { display: flex; flex-direction: column; gap: 16px; }
.login-error  { background: #FEE2E2; border: 1px solid #FECACA; color: #B91C1C; padding: 10px 14px; border-radius: 8px; font-size: 13px; }

/* ── Empty state ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-title { font-weight: 600; font-size: 15px; margin-top: 12px; color: var(--text); }
.empty-state-desc  { font-size: 13px; margin-top: 4px; }

/* ── Toast ──────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--text); color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  font-size: 13px; font-weight: 500;
  animation: slide-up .2s;
  min-width: 260px; max-width: 380px;
}
.toast.success { background: #065F46; }
.toast.error   { background: #991B1B; }
.toast.warning { background: #92400E; }

/* ── Detail panel ───────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item { background: var(--bg); border-radius: 8px; padding: 10px 14px; }
.detail-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.detail-value { font-size: 13px; font-weight: 600; margin-top: 2px; word-break: break-all; }

/* ── Key box ────────────────────────────────────────────── */
.key-box {
  background: #0F172A; color: #7DD3FC;
  font-family: 'Courier New', monospace; font-size: 12px;
  padding: 10px 14px; border-radius: 8px; word-break: break-all;
}

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab {
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s; background: none;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab:hover  { color: var(--text); }

/* ── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: center; padding-top: 16px; }
.page-btn {
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--text-muted);
}
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:hover:not(.active) { background: var(--bg); }

/* ── Loader ─────────────────────────────────────────────── */
.loader {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; align-items: center; justify-content: center; height: 200px; }

/* ── Misc ────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-16  { margin-top: 16px; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.text-sm    { font-size: 12px; }
.font-bold  { font-weight: 700; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full     { width: 100%; }
.mono       { font-family: 'Courier New', monospace; font-size: 12px; }
.icon { width: 18px; height: 18px; display: inline-block; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }
hr { border: none; border-top: 1px solid var(--border); }
