/* ============================================================
 *  NIS2 Radar — Entity register styles
 *  deploy/register/app.css
 * ============================================================ */

:root {
  --ink: #0f172a;
  --mute: #64748b;
  --accent: #1e40af;
  --accent-dark: #1e3a8a;
  --accent-light: #dbeafe;
  --line: #e2e8f0;
  --bg: #fafaf9;
  --card: #ffffff;
  --ok: #047857;
  --ok-light: #ecfdf5;
  --warn: #d97706;
  --warn-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
}

/* ---- Reset / Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---- Register Container ---- */
.register-container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ---- Brand Bar ---- */
.brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.brand {
  font-size: .78rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.brand a {
  color: inherit;
  text-decoration: none;
}
.brand a:hover {
  text-decoration: underline;
}
.lang-toggle {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.lang-toggle-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .2rem .5rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--mute);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .05em;
  text-decoration: none;
  display: inline-block;
}
.lang-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.lang-toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: default;
}
.lang-toggle-sep {
  color: var(--line);
  font-size: .75rem;
  user-select: none;
}

/* ---- Page Title ---- */
.page-title {
  font-size: 1.55rem;
  margin: 0 0 .4rem;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.page-subtitle {
  color: var(--mute);
  font-size: .95rem;
  margin: 0 0 1.6rem;
  line-height: 1.55;
}

/* ---- Search Bar ---- */
.search-bar {
  position: relative;
  margin-bottom: 1rem;
}
.search-bar input {
  width: 100%;
  padding: .85rem 1.1rem .85rem 2.8rem;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-bar input::placeholder {
  color: #94a3b8;
}
.search-bar .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mute);
  font-size: 1.1rem;
  pointer-events: none;
  line-height: 1;
}

/* ---- Filters ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}
.country-filters {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.filter-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: .35rem .85rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, color .15s;
}
.filter-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.filter-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: var(--bg);
  color: var(--mute);
}
.sector-filter-wrap {
  margin-left: auto;
}
.sector-filter-wrap select {
  padding: .4rem .8rem;
  font-size: .85rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  min-width: 12rem;
}
.sector-filter-wrap select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* ---- Stats ---- */
.stats {
  font-size: .88rem;
  color: var(--mute);
  margin-bottom: 1rem;
}

/* ---- Entity Cards ---- */
.entity-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.entity-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  transition: box-shadow .15s, border-color .15s;
}
.entity-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.entity-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .4rem;
}
.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .35rem;
}
.tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 12px;
  line-height: 1.4;
}
.tag-sector {
  background: var(--accent-light);
  color: var(--accent);
}
.tag-classification.essential {
  background: var(--danger-light);
  color: var(--danger);
}
.tag-classification.important {
  background: var(--warn-light);
  color: var(--warn);
}
.tag-classification.out_of_scope {
  background: var(--ok-light);
  color: var(--ok);
}
.tag-country {
  background: #f1f5f9;
  color: var(--mute);
}
.entity-location {
  font-size: .88rem;
  color: var(--mute);
  margin-bottom: .2rem;
}
.entity-source {
  font-size: .8rem;
  color: #94a3b8;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
.pagination .btn-page {
  display: inline-block;
  padding: .6rem 1.3rem;
  font-size: .92rem;
  font-weight: 600;
  background: var(--card);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.pagination .btn-page:hover {
  background: var(--accent-light);
}
.pagination .page-info {
  font-size: .85rem;
  color: var(--mute);
}

/* ---- Empty & Loading States ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--mute);
  font-size: 1rem;
}
.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--mute);
  font-size: 1rem;
}
.error-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--danger);
  font-size: .95rem;
}

/* ---- Noscript ---- */
.noscript-msg {
  max-width: 40rem;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--mute);
  font-size: 1rem;
}

/* ---- Footer ---- */
.register-footer {
  margin-top: 2.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: .85rem;
  color: var(--mute);
  line-height: 1.6;
}
.register-footer a {
  color: var(--accent);
  text-decoration: none;
}
.register-footer a:hover {
  text-decoration: underline;
}
.footer-links {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: .8rem;
  margin-bottom: .6rem;
}
.footer-attribution {
  font-size: .8rem;
  color: #94a3b8;
}

/* ============================================================
 *  Print Styles
 * ============================================================ */
@media print {
  body {
    background: #fff;
    font-size: 11pt;
  }
  .register-container {
    max-width: 100%;
    padding: 0;
  }
  .search-bar,
  .filters,
  .pagination,
  .register-footer,
  .lang-toggle {
    display: none !important;
  }
  .entity-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none !important;
  }
  .entity-card:hover {
    box-shadow: none;
  }
}

/* ============================================================
 *  Responsive Styles
 * ============================================================ */
@media (max-width: 600px) {
  .register-container {
    padding: 1.2rem 1rem 3rem;
  }
  .page-title {
    font-size: 1.3rem;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .sector-filter-wrap {
    margin-left: 0;
  }
  .sector-filter-wrap select {
    width: 100%;
    min-width: 0;
  }
  .country-filters {
    flex-wrap: wrap;
  }
  .entity-card {
    padding: .9rem 1rem;
  }
  .entity-name {
    font-size: .97rem;
  }
  .entity-meta {
    gap: .25rem;
  }
  .pagination {
    flex-direction: column;
    gap: .6rem;
  }
  .pagination .btn-page {
    width: 100%;
    text-align: center;
  }
}

/* ---- Entity Detail View ---- */
.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: .9rem;
  margin-bottom: 1rem;
}
.back-link:hover { text-decoration: underline; }
.detail-header { margin-bottom: 1.5rem; }
.detail-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 .6rem 0;
  line-height: 1.2;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.detail-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
}
.detail-card h2 {
  font-size: 1.1rem;
  margin: 0 0 .8rem 0;
  color: var(--ink);
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
}
.detail-table th {
  text-align: left;
  color: var(--mute);
  font-weight: 500;
  padding: .45rem .8rem .45rem 0;
  white-space: nowrap;
  width: 1%;
  vertical-align: top;
  font-size: .92rem;
}
.detail-table td {
  padding: .45rem 0;
  font-size: .95rem;
}
.detail-table tr + tr { border-top: 1px solid var(--line); }
.detail-table a { color: var(--accent); text-decoration: none; }
.detail-table a:hover { text-decoration: underline; }
.detail-obligations {
  list-style: none;
  padding: 0;
  margin: 0;
}
.detail-obligations li {
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .93rem;
  line-height: 1.5;
}
.detail-obligations li:last-child { border-bottom: none; }
.detail-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.detail-links li { margin-bottom: .5rem; }
.detail-links a { color: var(--accent); text-decoration: none; }
.detail-links a:hover { text-decoration: underline; }
.detail-cta {
  text-align: center;
  margin: 2rem 0 1rem;
}
.detail-cta .btn-primary {
  display: inline-block;
  padding: .75rem 1.8rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
}
.detail-cta .btn-primary:hover { background: var(--accent-dark, #1e3a8a); }
.entity-arrow {
  color: var(--mute);
  float: right;
  font-size: 1.3rem;
}
@media (max-width: 600px) {
  .detail-name { font-size: 1.4rem; }
  .detail-table th { display: block; padding-bottom: 0; }
  .detail-table td { display: block; padding-top: .1rem; padding-bottom: .6rem; }
}
