/* ═══════════════════════════════════════════════════════
   NandaNicNoc PWA — Design System
   Dark mode clínico · Inter · Cyan/Teal accent
═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Tokens ─────────────────────────────────────────── */
:root {
  --bg:        #080d1a;
  --bg2:       #0d1526;
  --bg3:       #111d33;
  --surface:   #141e35;
  --surface2:  #1a2540;
  --border:    #1e2f50;
  --border2:   #263550;

  --cyan:      #00d4ff;
  --cyan-dim:  #00a8cc;
  --teal:      #00e5b0;
  --teal-dim:  #00b88d;
  --violet:    #8b5cf6;
  --amber:     #f59e0b;
  --rose:      #f43f5e;

  --nanda:     #4f8ef7;
  --nic:       #00e5b0;
  --noc:       #a78bfa;

  --text:      #e8edf8;
  --text2:     #9aa8c4;
  --text3:     #5a6c8a;

  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.6);

  --nav-h:     64px;
  --header-h:  56px;
  --trans:      .22s cubic-bezier(.4,0,.2,1);
}

/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ─── App Shell ──────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ─── Header ─────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(8, 13, 26, .85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.app-header .back-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--text2);
  transition: background var(--trans), color var(--trans);
}
.app-header .back-btn:hover { background: var(--surface2); color: var(--text); }
.header-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-tag {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
}
.tag-nanda { background: rgba(79,142,247,.15); color: var(--nanda); border: 1px solid rgba(79,142,247,.3); }
.tag-nic   { background: rgba(0,229,176,.15);  color: var(--nic);   border: 1px solid rgba(0,229,176,.3); }
.tag-noc   { background: rgba(167,139,250,.15); color: var(--noc);  border: 1px solid rgba(167,139,250,.3); }

/* ─── Main content ───────────────────────────────────── */
#view {
  flex: 1;
  padding-bottom: calc(var(--nav-h) + 8px);
  overflow-y: auto;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Bottom Nav ─────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: rgba(13, 21, 38, .92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 4px;
  z-index: 200;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 52px;
  border-radius: 12px;
  color: var(--text3);
  transition: color var(--trans), background var(--trans);
  position: relative;
}
.nav-btn svg { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-btn span { font-size: .62rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.nav-btn.active { color: var(--cyan); }
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 2px;
  background: var(--cyan);
  border-radius: 0 0 2px 2px;
}
.nav-btn:hover:not(.active) { color: var(--text2); background: var(--surface); }

/* ─── Search Bar ─────────────────────────────────────── */
.search-wrap {
  padding: 14px 16px 8px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 14px;
  width: 18px; height: 18px;
  color: var(--text3);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  padding: 12px 16px 12px 44px;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.search-box input::placeholder { color: var(--text3); }
.search-box input:focus {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, .12);
}
.search-clear {
  position: absolute;
  right: 10px;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  transition: background var(--trans), color var(--trans);
  opacity: 0;
  pointer-events: none;
}
.search-clear.visible { opacity: 1; pointer-events: all; }
.search-clear:hover { background: var(--surface2); color: var(--text); }

/* ─── Section Label ──────────────────────────────────── */
.section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 16px 16px 8px;
}

/* ─── Cards Grid (Home) ──────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 8px 16px 16px;
}
.hero-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #0d1f4a 0%, #1a1060 100%);
  border: 1px solid rgba(0,212,255,.2);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(0,212,255,.18) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-card .hero-title {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--cyan), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.hero-card .hero-sub {
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.5;
}
.hero-stats {
  display: flex;
  gap: 20px;
  margin-top: 16px;
}
.hero-stat .num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.hero-stat .lbl {
  font-size: .68rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color var(--trans), transform var(--trans), box-shadow var(--trans);
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--trans);
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.module-card:hover::before { opacity: 1; }
.module-card:active { transform: scale(.97); }

.module-card.nanda { border-top: 2px solid var(--nanda); }
.module-card.nanda::before { background: linear-gradient(135deg, rgba(79,142,247,.06) 0%, transparent 60%); }
.module-card.nic   { border-top: 2px solid var(--nic); }
.module-card.nic::before   { background: linear-gradient(135deg, rgba(0,229,176,.06) 0%, transparent 60%); }
.module-card.noc   { border-top: 2px solid var(--noc); }
.module-card.noc::before   { background: linear-gradient(135deg, rgba(167,139,250,.06) 0%, transparent 60%); }

.module-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  font-weight: 800;
}
.module-card.nanda .module-icon { background: rgba(79,142,247,.15); color: var(--nanda); }
.module-card.nic   .module-icon { background: rgba(0,229,176,.15);  color: var(--nic); }
.module-card.noc   .module-icon { background: rgba(167,139,250,.15); color: var(--noc); }

.module-title { font-size: .95rem; font-weight: 700; }
.module-count { font-size: .75rem; color: var(--text3); }

/* ─── List Items ─────────────────────────────────────── */
.list-group { padding: 0 16px 8px; display: flex; flex-direction: column; gap: 6px; }
.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color var(--trans), background var(--trans), transform var(--trans);
}
.list-item:hover { border-color: var(--border2); background: var(--surface2); transform: translateX(2px); }
.list-item:active { transform: scale(.98); }
.list-item .li-icon {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}
.li-nanda { background: rgba(79,142,247,.15); color: var(--nanda); }
.li-nic   { background: rgba(0,229,176,.15);  color: var(--nic); }
.li-noc   { background: rgba(167,139,250,.15); color: var(--noc); }
.li-body { flex: 1; min-width: 0; }
.li-title {
  font-size: .88rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.li-sub {
  font-size: .73rem;
  color: var(--text3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.li-arrow {
  color: var(--text3);
  width: 16px; height: 16px; min-width: 16px;
}

/* ─── Detail View ────────────────────────────────────── */
.detail-wrap { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.detail-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.detail-code {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  margin-bottom: 6px;
}
.detail-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 10px;
}
.detail-desc {
  font-size: .88rem;
  color: var(--text2);
  line-height: 1.6;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.meta-chip {
  font-size: .68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface2);
  color: var(--text3);
  border: 1px solid var(--border);
}

.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.detail-section-header {
  padding: 13px 16px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-section-header .count-badge {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 20px;
}

.factor-group-header {
  padding: 8px 14px 4px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
}
.factor-item {
  padding: 9px 14px;
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.factor-item::before {
  content: '•';
  color: var(--text3);
  margin-top: 1px;
  flex-shrink: 0;
}

.activity-item {
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.55;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.activity-num {
  min-width: 20px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text3);
  padding-top: 2px;
}

.indicator-item {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.indicator-title { font-size: .85rem; color: var(--text2); }
.indicator-scale {
  font-size: .7rem;
  color: var(--text3);
  font-style: italic;
}

/* ─── Relation Chips ─────────────────────────────────── */
.rel-list { display: flex; flex-direction: column; gap: 0; }
.rel-item {
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background var(--trans);
}
.rel-item:hover { background: var(--surface2); }
.rel-item .rel-body { flex: 1; min-width: 0; }
.rel-item .rel-title {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rel-item .rel-priority {
  font-size: .68rem;
  color: var(--text3);
  margin-top: 2px;
}
.priority-dot {
  width: 8px; height: 8px; min-width: 8px;
  border-radius: 50%;
}
.p1 { background: var(--rose); }
.p2 { background: var(--amber); }
.p3 { background: var(--teal); }
.p4, .p5, .p6, .p7, .p8, .p9, .p10, .p11, .p12, .p13 { background: var(--text3); }

/* ─── Breadcrumb ─────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px 0;
  flex-wrap: wrap;
}
.breadcrumb-item {
  font-size: .72rem;
  color: var(--text3);
  cursor: pointer;
}
.breadcrumb-item:hover { color: var(--text2); }
.breadcrumb-sep { font-size: .65rem; color: var(--text3); }
.breadcrumb-item.current { color: var(--text2); cursor: default; }

/* ─── Empty / Loading ────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 12px;
  text-align: center;
}
.empty-state svg { width: 48px; height: 48px; color: var(--text3); opacity: .5; }
.empty-state p { font-size: .9rem; color: var(--text3); line-height: 1.5; }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-item { height: 62px; margin: 6px 16px; }

/* ─── Search Results ─────────────────────────────────── */
.search-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.search-tabs::-webkit-scrollbar { display: none; }
.search-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text3);
  background: var(--surface);
  transition: all var(--trans);
}
.search-tab.active-nanda { border-color: var(--nanda); color: var(--nanda); background: rgba(79,142,247,.1); }
.search-tab.active-nic   { border-color: var(--nic);   color: var(--nic);   background: rgba(0,229,176,.1); }
.search-tab.active-noc   { border-color: var(--noc);   color: var(--noc);   background: rgba(167,139,250,.1); }
.search-tab.active-all   { border-color: var(--cyan);  color: var(--cyan);  background: rgba(0,212,255,.1); }

.results-count {
  font-size: .73rem;
  color: var(--text3);
  padding: 0 16px 8px;
}

/* ─── Highlight ──────────────────────────────────────── */
mark {
  background: rgba(0,212,255,.25);
  color: var(--cyan);
  border-radius: 2px;
  padding: 0 1px;
}

/* ─── Responsive: desktop centering ─────────────────── */
@media (min-width: 480px) {
  .bottom-nav { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
