/* ═══════════════════════════════════════════════════════════
   Ibermutua UI Audit — Stylesheet
   ═══════════════════════════════════════════════════════════ */

:root {
  --blue-700: #004799;
  --blue-600: #0056a7;
  --blue-500: #0065b7;
  --blue-400: #0075c9;
  --blue-50:  #ecf6fe;
  --gray-900: #262d33;
  --gray-600: #566673;
  --gray-400: #738aa0;
  --gray-200: #ebeff2;
  --gray-100: #f5f8fa;
  --white:    #ffffff;
  --radius:   8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 200px; }

body {
  font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-100);
}

/* ── HEADER ────────────────────────────────────────────── */
.audit-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 0 32px;
  display: flex; align-items: center; gap: 24px;
  height: 64px;
}
.audit-header h1 {
  font-size: 18px; font-weight: 600; color: var(--blue-500);
  white-space: nowrap;
}
.audit-header h1 span { color: var(--gray-600); font-weight: 400; }

.global-search {
  flex: 1; max-width: 420px;
  padding: 8px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.global-search:focus { border-color: var(--blue-400); }

.header-meta {
  margin-left: auto;
  font-size: 12px; color: var(--gray-400);
  white-space: nowrap;
}

/* ── TABS ──────────────────────────────────────────────── */
.tabs-nav {
  display: flex; gap: 0;
  background: var(--white);
  border-bottom: 2px solid var(--gray-200);
  padding: 0 32px;
  position: sticky; top: 64px; z-index: 99;
}
.tab-btn {
  padding: 14px 24px;
  font-size: 14px; font-weight: 500;
  color: var(--gray-600);
  background: none; border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.tab-btn:hover { color: var(--blue-400); }
.tab-btn.active {
  color: var(--blue-400);
  border-bottom-color: var(--blue-400);
  font-weight: 600;
}

.tab-panel { display: none; padding: 32px; max-width: 1400px; margin: 0 auto; }
.tab-panel.active { display: block; }

/* ── SUB-NAVIGATION ───────────────────────────────────── */
.sub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  position: sticky;
  top: 128px;
  z-index: 50;
}
.sub-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.sub-nav-btn:hover {
  background: var(--blue-400);
  color: var(--white);
  border-color: var(--blue-400);
  box-shadow: var(--shadow-sm);
}

/* ── SECTION / CARD ────────────────────────────────────── */
.section-title {
  font-size: 22px; font-weight: 600; color: var(--gray-900);
  margin: 0 0 6px;
}
.section-desc {
  font-size: 14px; color: var(--gray-400); margin-bottom: 24px;
}
.panel-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}
.panel-card h3 {
  font-size: 15px; font-weight: 600; color: var(--blue-500);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

/* ── PALETTE TABS ──────────────────────────────────────── */
.palette-tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.palette-tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.palette-tab-btn:hover { color: var(--blue-400); }
.palette-tab-btn.palette-tab-active {
  color: var(--blue-400);
  border-bottom-color: var(--blue-400);
  font-weight: 600;
}
.palette-tab-count {
  font-size: 10px;
  background: var(--gray-100);
  color: var(--gray-400);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.palette-tab-active .palette-tab-count {
  background: var(--blue-50);
  color: var(--blue-400);
}

/* ── COLOR SWATCHES ────────────────────────────────────── */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
}
.swatch {
  text-align: center;
}
.swatch-box {
  width: 100%; aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s;
}
.swatch:hover .swatch-box { transform: scale(1.05); }
.swatch-label {
  font-size: 12px; font-weight: 600; color: var(--gray-900);
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.swatch-meta {
  font-size: 11px; color: var(--gray-400);
}
.swatch-role {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 2px;
  line-height: 1.3;
}

/* ── TABLES ────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--gray-200);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--gray-100); }
.color-dot {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
  vertical-align: middle;
  margin-right: 8px;
}
.mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

/* ── TYPOGRAPHY CARDS ──────────────────────────────────── */
.type-scale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.type-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow .2s;
}
.type-card:hover { box-shadow: var(--shadow-md); }
.type-sample {
  margin-bottom: 12px;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.type-meta {
  font-size: 12px; color: var(--gray-400);
  display: flex; flex-wrap: wrap; gap: 6px 16px;
}
.type-meta strong { color: var(--gray-600); }
.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px; font-weight: 500;
  background: var(--blue-50);
  color: var(--blue-500);
}

/* ── REM SCALE ─────────────────────────────────────────── */
/* ── REM SCALE — clean list ────────────────────────────── */
.rem-scale-clean {
  display: flex;
  flex-direction: column;
}
.rem-row-clean {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  transition: background .15s;
}
.rem-row-clean:nth-child(odd) {
  background: var(--gray-50, #fafbfc);
}
.rem-row-clean:hover {
  background: #eef4ff;
}
.rem-row-clean:last-child {
  border-bottom: none;
}
.rem-badge {
  flex-shrink: 0;
  min-width: 72px;
  padding: 4px 10px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-family: 'SF Mono', 'Fira Code', 'Lucida Console', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  text-align: center;
  white-space: nowrap;
}
.rem-label {
  color: var(--gray-900);
  font-family: 'Noto Sans', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .rem-row-clean {
    gap: 12px;
    padding: 12px 14px;
  }
  .rem-badge {
    min-width: 56px;
    font-size: 10px;
  }
  .rem-label {
    font-size: 14px !important;
  }
}

/* ── ICON GRID ─────────────────────────────────────────── */
.icon-filters {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  font-size: 13px; cursor: pointer;
  transition: all .2s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--blue-400);
  color: var(--white);
  border-color: var(--blue-400);
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}
.icon-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  transition: box-shadow .2s;
}
.icon-item:hover { box-shadow: var(--shadow-md); }
.icon-item img {
  max-width: 48px; max-height: 48px;
  image-rendering: auto;
  margin-bottom: 8px;
}
.icon-item .icon-count {
  font-size: 20px; font-weight: 700; color: var(--blue-400);
}
.icon-item .icon-label {
  font-size: 11px; color: var(--gray-400);
  word-break: break-all;
  margin-top: 4px;
}
.icon-item .icon-type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px; font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-600);
  margin-top: 4px;
}

/* ── COMPONENT SECTIONS ────────────────────────────────── */
.comp-category {
  margin-bottom: 32px;
}
.comp-category-title {
  font-size: 16px; font-weight: 600; color: var(--blue-700);
  margin-bottom: 16px;
  text-transform: capitalize;
}
.comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.comp-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s;
}
.comp-card:hover { box-shadow: var(--shadow-md); }
.comp-screenshot {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  object-position: left top;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  image-rendering: auto;
}
.comp-info {
  padding: 14px 16px;
}
.comp-info h4 {
  font-size: 13px; font-weight: 600; color: var(--gray-900);
  margin-bottom: 4px;
}
.comp-info .comp-pages {
  font-size: 11px; color: var(--gray-400);
}
.comp-info .comp-occur {
  font-size: 20px; font-weight: 700; color: var(--blue-400);
  float: right; margin-top: -22px;
}

/* ── SHOWCASE ─────────────────────────────────────────── */
.showcase-frame {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.showcase-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 16px;
  position: sticky;
  top: 128px;
  z-index: 50;
  background: var(--white);
  padding-top: 4px;
}
.showcase-counter {
  margin-bottom: 16px;
}
.showcase-active-count {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}
.showcase-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.showcase-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 22px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.showcase-filter-btn:hover {
  border-color: var(--blue-400);
  color: var(--blue-500);
  background: #eef4ff;
}
.showcase-filter-btn.active {
  background: var(--blue-400);
  color: var(--white);
  border-color: var(--blue-400);
  box-shadow: 0 2px 8px rgba(0,100,200,.18);
}
.showcase-filter-count {
  background: rgba(0,0,0,.08);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}
.showcase-filter-btn.active .showcase-filter-count {
  background: rgba(255,255,255,.25);
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.showcase-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}
.showcase-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.1);
  transform: translateY(-2px);
}

.showcase-card-img {
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  max-height: 180px;
  overflow: hidden;
  border-bottom: 1px solid var(--gray-200);
  padding: 8px;
}
.showcase-img {
  max-width: 100%;
  max-height: 170px;
  object-fit: contain;
  image-rendering: auto;
}
.showcase-no-img {
  color: var(--gray-400);
  font-size: 12px;
  font-style: italic;
  padding: 30px 0;
}

.showcase-card-body {
  padding: 12px 14px 14px;
}
.showcase-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.showcase-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #eef4ff;
  color: var(--blue-500);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}
.showcase-variant {
  display: inline-block;
  background: #fff3e0;
  color: #e65100;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.showcase-instances {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.showcase-selector {
  font-family: 'Lucida Console', Monaco, monospace;
  font-size: 11px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
.showcase-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}
.showcase-stat {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}
.showcase-stat::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue-400);
  margin-right: 5px;
  vertical-align: middle;
}
.showcase-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.showcase-page-pill {
  display: inline-block;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 8px;
}

/* (category sections removed — single frame layout) */

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

/* ── BADGES / PILLS ────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px; font-weight: 500;
  margin-right: 4px; margin-bottom: 4px;
}
.pill-blue  { background: var(--blue-50); color: var(--blue-500); }
.pill-gray  { background: var(--gray-100); color: var(--gray-600); }
.pill-count { background: var(--blue-400); color: white; font-weight: 700; }

/* ── BAR CHART ─────────────────────────────────────────── */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bar-label { width: 80px; font-size: 12px; color: var(--gray-600); text-align: right; }
.bar-track { flex: 1; height: 22px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; background: var(--blue-400); min-width: 2px; transition: width .3s; }
.bar-value { width: 50px; font-size: 12px; color: var(--gray-400); }

/* ── ROLE-BASED COLOR GRID ─────────────────────────────── */
/* role-section/header styles removed – now using flat merged grid */
.role-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.role-color-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}
.role-color-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.role-color-swatch {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 6px 10px;
  position: relative;
}
.role-color-hex {
  font-size: 12px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: .3px;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.role-color-info {
  padding: 8px 10px 6px;
}
.role-color-count {
  font-size: 13px;
  color: var(--gray-900);
}
.role-color-pages {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}
.role-color-sample {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  font-style: italic;
}
.role-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}
.role-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 400;
  background: var(--gray-100);
  color: var(--gray-600);
  white-space: nowrap;
  line-height: 1.5;
}
.role-pill strong {
  color: var(--blue-400);
  font-weight: 700;
  margin-left: 2px;
}
.role-color-bar {
  height: 3px;
  background: var(--gray-100);
}
.role-color-bar-fill {
  height: 100%;
  min-width: 2px;
  transition: width .3s;
}

/* ── CONTRAST PAIRS ────────────────────────────────────── */
.contrast-pair {
  transition: transform .15s;
}
.contrast-pair:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── SEARCH HIGHLIGHT ──────────────────────────────────── */
.search-hidden { display: none !important; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .audit-header { padding: 0 16px; }
  .tabs-nav { padding: 0 16px; overflow-x: auto; }
  .tab-panel { padding: 16px; }
  .swatch-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .comp-grid { grid-template-columns: 1fr; }
}
