/* ============================================================
   IAE-CNAE.online — Global Styles
   IAE + CNAE 2026 Reference Site
   ============================================================ */

:root {
  --primary: #1a4d8f;
  --primary-dark: #0f2f5a;
  --primary-light: #2e6bc2;
  --accent: #e85d04;
  --accent-light: #f48c06;
  --success: #2d9c4e;
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.65; }

/* ── Typography ─────────────────────────────────────────── */
h1 { font-size: clamp(1.6rem,4vw,2.4rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(1.25rem,3vw,1.75rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 650; }
p  { margin-bottom: .9rem; }
a  { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }
code { font-family: var(--mono); background: #eef2ff; padding: .15em .45em; border-radius: 4px; font-size: .88em; color: var(--primary); }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff;
  padding: 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: .8rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.site-logo { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.site-logo .logo-text { color: #fff; font-size: 1.25rem; font-weight: 800; letter-spacing: -.5px; }
.site-logo .logo-tag { background: var(--accent); color: #fff; font-size: .65rem; padding: .15em .5em; border-radius: 4px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.site-nav { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.site-nav a { color: rgba(255,255,255,.85); padding: .4rem .85rem; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; transition: all var(--transition); }
.site-nav a:hover, .site-nav a.active { background: rgba(255,255,255,.18); color: #fff; }

/* ── Global Search Bar ──────────────────────────────────── */
.global-search-wrap { padding: .5rem 1.5rem; background: var(--primary-dark); display: flex; justify-content: center; }
.global-search { position: relative; max-width: 600px; width: 100%; }
.global-search input {
  width: 100%; padding: .65rem 2.8rem .65rem 1rem;
  border: none; border-radius: var(--radius-sm);
  font-size: .9rem; background: rgba(255,255,255,.12);
  color: #fff; outline: none;
  transition: background var(--transition);
}
.global-search input::placeholder { color: rgba(255,255,255,.55); }
.global-search input:focus { background: rgba(255,255,255,.22); }
.global-search .search-icon { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.6); pointer-events: none; font-size: 1rem; }
#search-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 340px; overflow-y: auto; z-index: 200;
  display: none;
}
#search-suggestions.active { display: block; }
.suggestion-item { padding: .65rem 1rem; cursor: pointer; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: .75rem; }
.suggestion-item:hover { background: var(--bg); }
.suggestion-item .tag { font-size: .7rem; padding: .15em .5em; border-radius: 3px; font-weight: 700; text-transform: uppercase; }
.tag-cnae { background: #dbeafe; color: #1d4ed8; }
.tag-iae { background: #fef3c7; color: #d97706; }
.suggestion-item .name { color: var(--text); font-size: .875rem; flex: 1; }
.suggestion-item .code { color: var(--text-muted); font-size: .8rem; font-family: var(--mono); }

/* ── Layout Container ───────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.page-wrap { padding: 2rem 0 3rem; }

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb { font-size: .82rem; color: var(--text-muted); margin-bottom: 1.2rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.breadcrumb a { color: var(--primary-light); }
.breadcrumb span { color: var(--text-muted); }

/* ── Hero / Page Title ──────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, #1a4d8f15 0%, #2e6bc210 100%);
  border: 1px solid #1a4d8f20;
  border-radius: var(--radius-lg); padding: 2rem 2.5rem; margin-bottom: 2rem;
}
.page-hero .code-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--primary); color: #fff;
  padding: .3em .8em; border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .9rem; font-weight: 700;
  margin-bottom: .75rem;
}
.page-hero h1 { color: var(--primary-dark); margin-bottom: .5rem; }
.page-hero .meta { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: .8rem; }
.meta-item { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-muted); }
.meta-item svg { width: 16px; height: 16px; }

/* ── Cards ──────────────────────────────────────────────── */
.card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.5rem; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), transform var(--transition); }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card h3 { margin-bottom: .6rem; color: var(--primary-dark); }

/* ── Two column layout ──────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
@media (max-width: 900px) { .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── Cross-reference table ──────────────────────────────── */
.xref-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.xref-table th { background: var(--primary); color: #fff; padding: .65rem 1rem; text-align: left; font-weight: 600; }
.xref-table td { padding: .6rem 1rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.xref-table tr:hover td { background: #f8fafc; }
.xref-table a { font-weight: 500; }
.code-cell { font-family: var(--mono); font-weight: 700; color: var(--primary); white-space: nowrap; }

/* ── Info boxes ─────────────────────────────────────────── */
.info-box { border-left: 4px solid var(--primary-light); background: #eff6ff; padding: 1rem 1.25rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.2rem 0; }
.info-box.warning { border-color: var(--accent-light); background: #fff7ed; }
.info-box.success { border-color: var(--success); background: #f0fdf4; }
.info-box strong { display: block; margin-bottom: .3rem; }

/* ── Badge / pill ───────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2em .65em; border-radius: 100px; font-size: .78rem; font-weight: 600; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-amber { background: #fef3c7; color: #d97706; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-red { background: #fee2e2; color: #dc2626; }

/* ── Level tree (CNAE hierarchy) ────────────────────────── */
.level-tree { margin: 1.2rem 0; }
.level-tree .level-row { display: flex; align-items: flex-start; gap: .8rem; padding: .55rem .8rem; border-radius: var(--radius-sm); transition: background var(--transition); }
.level-tree .level-row:hover { background: var(--bg); }
.level-tree .level-indent-1 { padding-left: 1.8rem; }
.level-tree .level-indent-2 { padding-left: 3.2rem; }
.level-tree .level-indent-3 { padding-left: 4.6rem; }
.level-tree .level-code { font-family: var(--mono); font-weight: 700; color: var(--primary); min-width: 60px; }
.level-tree .level-name { color: var(--text); font-size: .88rem; flex: 1; }
.level-tree .level-badge { font-size: .7rem; padding: .15em .5em; border-radius: 3px; background: var(--border-light); color: var(--text-muted); text-transform: uppercase; font-weight: 600; }

/* ── Conversor tool ─────────────────────────────────────── */
.conversor-box { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 2rem; box-shadow: var(--shadow-md); }
.conversor-inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: end; margin-bottom: 1.5rem; }
@media (max-width: 650px) { .conversor-inputs { grid-template-columns: 1fr; } }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .5px; }
.form-group select, .form-group input {
  width: 100%; padding: .7rem .9rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: .9rem; background: var(--bg);
  color: var(--text); outline: none; transition: border-color var(--transition);
  appearance: none;
}
.form-group select:focus, .form-group input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px #2e6bc220; }
.swap-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 1.1rem; transition: all var(--transition); flex-shrink: 0; }
.swap-btn:hover { background: var(--primary-dark); transform: rotate(180deg); }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .65rem 1.4rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600; border: none; cursor: pointer; transition: all var(--transition); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.conversor-result { border-top: 1px solid var(--border); padding-top: 1.5rem; min-height: 80px; }

/* ── Index / listing page ───────────────────────────────── */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1rem; }
.listing-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; transition: all var(--transition); display: flex; flex-direction: column; gap: .4rem; }
.listing-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); transform: translateY(-2px); }
.listing-card .lc-code { font-family: var(--mono); font-size: .85rem; color: var(--primary); font-weight: 700; }
.listing-card .lc-name { font-size: .875rem; color: var(--text); line-height: 1.4; }
.listing-card .lc-meta { font-size: .78rem; color: var(--text-muted); margin-top: auto; padding-top: .4rem; }

/* ── Section cards (homepage) ───────────────────────────── */
.section-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1rem; margin-top: 1.5rem; }
.section-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; transition: all var(--transition); cursor: pointer; }
.section-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.section-card .sc-letter { font-size: 2rem; font-weight: 900; color: var(--primary); font-family: var(--mono); line-height: 1; margin-bottom: .5rem; }
.section-card .sc-name { font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: .3rem; }
.section-card .sc-count { font-size: .75rem; color: var(--text-muted); }

/* ── Stats bar ──────────────────────────────────────────── */
.stats-bar { background: var(--primary-dark); color: #fff; padding: .8rem 1.5rem; }
.stats-inner { max-width: 1280px; margin: 0 auto; display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center; }
.stat-item { text-align: center; }
.stat-item .num { font-size: 1.5rem; font-weight: 800; color: var(--accent-light); }
.stat-item .label { font-size: .75rem; color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .5px; }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { background: var(--primary-dark); color: rgba(255,255,255,.7); padding: 2.5rem 1.5rem 1.5rem; margin-top: 4rem; }
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-brand .logo-text { font-size: 1.2rem; font-weight: 800; color: #fff; }
.footer-brand p { font-size: .82rem; margin-top: .5rem; line-height: 1.6; }
.footer-col h4 { color: #fff; font-size: .85rem; font-weight: 700; margin-bottom: .75rem; text-transform: uppercase; letter-spacing: .5px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.footer-col ul a { font-size: .82rem; color: rgba(255,255,255,.6); transition: color var(--transition); }
.footer-col ul a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-top: 1.2rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .78rem; }

/* ── Table of contents (sidebar) ─────────────────────────── */
.page-layout { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; align-items: start; }
@media (max-width: 1024px) { .page-layout { grid-template-columns: 1fr; } .sidebar { display: none; } }
.sidebar { position: sticky; top: 100px; }
.sidebar .card { padding: 1.25rem; }
.sidebar h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: .75rem; font-weight: 700; }
.toc-list { list-style: none; display: flex; flex-direction: column; gap: .2rem; }
.toc-list a { font-size: .83rem; color: var(--text-muted); padding: .3rem .6rem; border-radius: 4px; display: block; transition: all var(--transition); border-left: 2px solid transparent; }
.toc-list a:hover, .toc-list a.active { color: var(--primary); background: #eff6ff; border-left-color: var(--primary); }

/* ── Cuota highlight ────────────────────────────────────── */
.cuota-box { background: linear-gradient(135deg, #fff7ed, #fef3c7); border: 1px solid #fcd34d; border-radius: var(--radius); padding: 1.2rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.cuota-box .cuota-icon { font-size: 2rem; }
.cuota-box .cuota-value { font-size: 1.8rem; font-weight: 800; color: #d97706; }
.cuota-box .cuota-label { font-size: .82rem; color: var(--text-muted); }

/* ── Mobile menu ────────────────────────────────────────── */
.mobile-menu-btn { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; padding: .2rem; }
@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.open { display: flex; flex-direction: column; background: var(--primary-dark); padding: .5rem; border-radius: var(--radius-sm); }
  .header-inner { padding: .6rem 1rem; }
  .page-hero { padding: 1.25rem; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .45s ease both; }
.fade-up-2 { animation: fadeUp .45s .1s ease both; }
.fade-up-3 { animation: fadeUp .45s .2s ease both; }

/* ── Highlight current code ─────────────────────────────── */
.highlight { background: #fef9c3; border-radius: 3px; padding: 0 2px; }

/* ── Generic content / trust pages ──────────────────────── */
.generic-content { padding: 1.6rem; }
.generic-content h2, .generic-content h3 { margin: 1.2rem 0 .7rem; color: var(--primary-dark); }
.generic-content ul, .generic-content ol { margin: 0 0 1rem 1.2rem; }
.generic-content li { margin-bottom: .45rem; }
.legal-list { margin-left: 1.2rem; }
.blog-content p, .generic-content p { font-size: .98rem; }

/* ── Cookie banner ──────────────────────────────────────── */
.cookie-banner {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 300;
}
.cookie-banner__inner {
  max-width: 1080px; margin: 0 auto; background: rgba(15,47,90,.98); color: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1rem 1.2rem;
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
}
.cookie-banner__inner p { margin: .35rem 0 0; color: rgba(255,255,255,.82); font-size: .9rem; }
.cookie-banner__inner a { color: #fff; text-decoration: underline; }
.cookie-banner__actions { display: flex; gap: .75rem; flex-wrap: wrap; }
@media (max-width: 768px) {
  .cookie-banner__inner { flex-direction: column; align-items: flex-start; }
}

/* ── Rich snippet FAQ ───────────────────────────────────── */
.faq-list { margin-top: 1rem; display: flex; flex-direction: column; gap: .8rem; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq-q { padding: .9rem 1.1rem; font-weight: 600; cursor: pointer; background: var(--bg); display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }
.faq-q::after { content: "+"; font-size: 1.2rem; color: var(--primary); }
.faq-q.open::after { content: "−"; }
.faq-a { padding: 0 1.1rem; max-height: 0; overflow: hidden; transition: max-height .3s ease, padding .3s ease; font-size: .875rem; color: var(--text-muted); }
.faq-a.open { max-height: 300px; padding: .8rem 1.1rem; }

/* Roles / professions */
.applicability-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}
.applicability-intro {
  color: var(--text-muted);
  font-size: .92rem;
  margin: .45rem 0 1rem;
}
.app-role-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}
.app-role-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: .55rem .9rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--primary-dark);
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}
.app-role-chip.linked:hover {
  border-color: var(--primary);
  background: #eff6ff;
}
.app-related-wrap {
  margin-top: 1rem;
}
.app-related-title {
  margin-bottom: .7rem;
  font-size: .92rem;
  color: var(--text-muted);
}
.applicability-trust-note {
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--text-muted);
}
.hub-code-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-left: 1.1rem;
}
.hub-index-list {
  columns: 2;
  column-gap: 2rem;
  margin-left: 1.1rem;
}
.hub-index-list li,
.hub-code-list li {
  break-inside: avoid;
  margin-bottom: .45rem;
}
@media (max-width: 768px) {
  .hub-index-list {
    columns: 1;
  }
}
