/* =========================================================
   Observatorio de Migración — Estilos del sitio
   Identidad de la Alcaldía de Medellín
   ========================================================= */

@font-face {
  font-family: Metropolis;
  src: url('../fonts/files/metropolis-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Metropolis;
  src: url('../fonts/files/metropolis-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: Metropolis;
  src: url('../fonts/files/metropolis-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: Metropolis;
  src: url('../fonts/files/metropolis-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Metropolis;
  src: url('../fonts/files/metropolis-latin-800-normal.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  --accent: #00aeef;
  --masthead-height: 156px;
  --brand: #003a57;
  --brand-dark: #002a2e;
  --brand-light: #eef8fb;
  --brand-soft: #ccebf5;

  --navy: #003a57;
  --navy-2: #003a57;
  --dark-line: rgba(255, 255, 255, .08);
  --dark-text: rgba(255, 255, 255, .68);

  --ink: #231f20;
  --ink-soft: #4b5660;
  --neutral-icon: var(--navy-2);
  --line: #dce6eb;
  --surface: #ffffff;
  --bg: #f5f8fa;
  --ok: #16613b;
  --pending: #854a00;
  --radius: 14px;
  --shadow-sm: 0 2px 8px rgba(0, 58, 87, .07);
  --shadow-md: 0 10px 28px rgba(0, 42, 46, .12);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Metropolis', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

::selection { background: var(--brand); color: #fff; }

/* ---------- Topbar ---------- */
.navbar.app-navbar {
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(0, 42, 46, .06);
  border-bottom: 4px solid var(--accent);
  min-height: var(--masthead-height);
  padding-block: 0;
}

.navbar .navbar-brand {
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.municipal-logo {
  display: block;
  flex: none;
  width: 150px;
  height: auto;
  margin: 23px 24px;
}

.navbar .brand-text {
  white-space: normal;
  line-height: 1.2;
}

.app-navbar .nav-link {
  color: var(--ink) !important;
  font-weight: 600;
  font-size: .92rem;
  padding: .5rem .85rem !important;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}

.app-navbar .nav-link:hover { background: var(--brand-light); color: var(--brand) !important; }

.app-navbar .nav-link.active {
  color: #fff !important;
  background: var(--brand);
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--brand-light);
  border: 1px solid var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  font-size: .85rem;
  border-radius: 8px;
  padding: .4rem .7rem;
}
.sidebar-toggle-btn:hover { background: var(--brand-soft); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 320px;
  height: calc(100dvh - var(--masthead-height));
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: fixed;
  top: var(--masthead-height);
  left: 0;
  overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
  color: var(--ink);
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--brand-soft); border-radius: 8px; }

.sidebar-title {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--brand);
  padding: 0 .4rem;
  margin-bottom: .85rem;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close-btn {
  background: var(--brand-light);
  border: none;
  color: var(--brand);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  margin-bottom: .85rem;
}
.sidebar-close-btn:hover { background: var(--brand-soft); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 42, 46, .45);
  z-index: 1040;
  opacity: 0;
  transition: opacity .25s ease;
}
.sidebar-backdrop.is-open { display: block; opacity: 1; }

/* Search box */
.side-search { position: relative; margin-bottom: 1.1rem; }
.side-search i {
  position: absolute;
  left: .8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-size: .85rem;
  pointer-events: none;
}
.side-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: .84rem;
  border-radius: 10px;
  padding: .55rem .7rem .55rem 2.1rem;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.side-search input::placeholder { color: var(--ink-soft); }
.side-search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(0, 58, 87, .15); }

.side-empty {
  display: none;
  text-align: center;
  color: var(--ink-soft);
  font-size: .82rem;
  padding: 1.5rem .5rem;
}

.side-group + .side-group { margin-top: .3rem; }

.side-group-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  border: none;
  text-align: left;
  padding: .65rem .5rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: .86rem;
  color: var(--ink);
  cursor: pointer;
}

.side-group-btn:hover { background: var(--brand-light); }

.side-group-btn .icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: .92rem;
}

.side-group-btn .count {
  font-size: .68rem;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: 999px;
  padding: .1rem .45rem;
}

.side-group-btn .chevron {
  margin-left: auto;
  transition: transform .2s ease;
  color: var(--ink-soft);
  font-size: .8rem;
}

.side-group-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.side-links { padding: .15rem .25rem .35rem 2.55rem; }

.side-links a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .5rem;
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .85rem;
  line-height: 1.25;
}

.side-links a:hover { background: var(--brand-light); color: var(--brand); }

.side-links a i.bi:first-child { font-size: .8rem; opacity: .55; }

.side-links a .ext {
  margin-left: auto;
  font-size: .7rem;
  opacity: .35;
}

/* Category accent colors for group icon chips */
.icon-edu { background: var(--brand); }
.icon-salud { background: var(--brand-dark); }
.icon-vbg { background: #003a57; }
.icon-otros { background: #4b5660; }

/* ---------- Main content ---------- */
.main-content { margin-left: 340px; padding: 1.75rem 1.5rem 2rem; }

.obs-hero {
  background: var(--navy);
  color: #fff;
  border-radius: 18px;
  border-top: 4px solid var(--accent);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.75rem;
}

.obs-hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  opacity: .85;
  margin-bottom: .5rem;
}

.obs-hero h1 { font-weight: 800; font-size: 1.9rem; margin-bottom: .5rem; letter-spacing: -.3px; }
.obs-hero p { color: rgba(255, 255, 255, .88); max-width: 620px; margin-bottom: 0; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.section-heading h2 {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--ink);
  margin: 0;
}

.section-heading span { color: var(--ink-soft); font-size: .85rem; }

/* ---------- Bento layout ---------- */
.bento-featured {
  background: var(--brand-light);
  border: 1px solid var(--brand-soft);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.6rem 1.8rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-bottom: 1.25rem;
  transition: transform .18s ease, box-shadow .18s ease;
}
.bento-featured:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.bento-featured .icon-badge {
  width: 64px; height: 64px;
  border-radius: 16px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(0, 58, 87, .28);
}

.bento-featured .body { flex-grow: 1; min-width: 0; }
.bento-featured h5 { font-weight: 800; font-size: 1.15rem; margin-bottom: .25rem; color: var(--ink); }
.bento-featured p { color: var(--ink-soft); font-size: .9rem; margin-bottom: 0; }
.bento-featured .cta { flex-shrink: 0; display: inline-flex; align-items: center; gap: .35rem; }

/* Theme cards */
.theme-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem;
  height: 100%;
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex;
  flex-direction: column;
}

.theme-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.theme-card .icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 1rem;
  background: var(--neutral-icon);
}

.theme-card .status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 700;
  padding: .25rem .55rem;
  border-radius: 999px;
  margin-bottom: .6rem;
  width: fit-content;
}

.status.ok { background: #e4f6ec; color: var(--ok); }
.status.pending { background: #fdf0e0; color: var(--pending); }

.theme-card h5 { font-weight: 700; margin-bottom: .4rem; }
.theme-card p { color: var(--ink-soft); font-size: .88rem; flex-grow: 1; }

.theme-card .btn {
  align-self: flex-start;
  border-radius: 8px;
  font-weight: 600;
  font-size: .85rem;
  padding: .5rem 1rem;
}

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* Scroll to top */
.btn-scroll-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 48px;
  height: 48px;
  background: var(--brand);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  box-shadow: var(--shadow-md);
  z-index: 999;
}
.btn-scroll-top:hover { background: var(--brand-dark); }

/* ---------- Detail pages (Power BI embed) ---------- */
.detail-nav {
  background: var(--surface);
  border-bottom: 4px solid var(--accent);
}
.detail-nav .nav-link { color: var(--ink) !important; font-weight: 600; }
.detail-nav .nav-link:hover { color: var(--brand) !important; }

.detail-hero {
  background: var(--navy);
  color: #fff;
  padding: 2.25rem 0 3rem;
}
.detail-hero h1 { font-weight: 800; }
.detail-hero p { color: rgba(255, 255, 255, .88); }
.detail-hero .breadcrumb-link {
  color: rgba(255, 255, 255, .8);
  font-size: .85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .75rem;
}
.detail-hero .breadcrumb-link:hover { color: #fff; }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-top: -2.25rem;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.detail-card .ratio iframe { border: 0; position: relative; z-index: 1; }

.detail-source {
  border-top: 1px solid var(--line);
  padding: .9rem 1.25rem;
  font-size: .82rem;
  color: var(--ink-soft);
  background: #f5f8fa;
}

/* Vista amplia de los informes de Centro Integrate y Territorios */
.report-layout {
  padding-inline: clamp(.5rem, 1.5vw, 1.5rem);
}

.report-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--line);
}

.report-embed iframe {
  display: block;
  width: 100%;
  height: max(32rem, 85svh, min(65vw, 75rem));
  border: 0;
}

@media (max-width: 575.98px) {
  .report-embed iframe { height: max(28rem, 75svh); }
}

/* Loading skeleton for iframes */
.embed-wrap { position: relative; }
.embed-skeleton {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  transition: opacity .35s ease;
}
.embed-skeleton.is-hidden { opacity: 0; pointer-events: none; }
.embed-skeleton .spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
.embed-skeleton .bars { width: 70%; max-width: 320px; }
.embed-skeleton .bar {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef8fb 25%, #dce6eb 37%, #eef8fb 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  margin-bottom: .5rem;
}
.embed-skeleton .bar:nth-child(1) { width: 100%; }
.embed-skeleton .bar:nth-child(2) { width: 80%; }
.embed-skeleton .bar:nth-child(3) { width: 60%; margin-bottom: 0; }
.embed-skeleton small { color: var(--ink-soft); font-size: .8rem; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--ink-soft);
}
.empty-state .icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fdf0e0;
  color: var(--pending);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-bottom: 1rem;
}
.empty-state h5 { color: var(--ink); font-weight: 700; margin-bottom: .4rem; }
.empty-state p { max-width: 420px; font-size: .88rem; }

/* ---------- Footer ---------- */
.app-footer {
  background: var(--navy);
  color: rgba(255, 255, 255, .7);
  padding: 2rem 1rem;
  margin-left: 340px;
  border-top: 3px solid var(--brand);
}
.app-footer.app-footer--flush { margin-left: 0; }
.app-footer .footer-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.app-footer .partner {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--brand);
  padding: .5rem .95rem;
  border-radius: 12px;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.app-footer .partner:hover { background: rgba(0, 58, 87, .18); transform: translateY(-2px); }
.app-footer .partner .label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(255, 255, 255, .78);
  display: block;
}
.app-footer .partner .name { font-weight: 700; color: #fff; font-size: .88rem; }
.app-footer small { color: rgba(255, 255, 255, .78); }
.app-footer a:not(.partner) { color: var(--brand-soft); text-decoration: none; }
.app-footer a:not(.partner):hover { text-decoration: underline; }

@media (max-width: 991.98px) {
  .sidebar {
    top: 0;
    height: 100vh;
    width: min(85vw, 340px);
    z-index: 1050;
    box-shadow: 4px 0 24px rgba(0, 42, 46, .3);
    transform: translateX(-100%);
    transition: transform .28s ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .app-footer { margin-left: 0; }
  .bento-featured { flex-direction: column; text-align: center; }
}

@media (max-width: 575.98px) {
  .navbar .brand-text { display: none; }
  .obs-hero { padding: 1.5rem; }
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
