:root {
  color-scheme: light;
  --page-bg: #e8e6da;
  --surface: #f7f6f0;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(0, 105, 62, 0.14);
  --panel-shadow: 0 20px 48px rgba(20, 47, 35, 0.08);
  --text-main: #1c1c1a;
  --text-soft: #5c5b54;
  --brand: #00693e;
  --brand-strong: #005533;
  --brand-soft: #dcecdf;
  --gold-soft: #f5ebbe;
  --gold-text: #6d5a16;
  --red-soft: #f8d9dd;
  --placeholder-bg: #e5e3d7;
  --placeholder-text: #6a685f;
  --line: #d9d6c9;
}

* {
  box-sizing: border-box;
}

button,
input,
select,
textarea,
label,
a {
  font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: inherit;
  font-weight: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0, 105, 62, 0.08), transparent 28%),
    linear-gradient(180deg, #f4f2e8 0%, var(--page-bg) 100%);
  color: var(--text-main);
}

.page-shell {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0.5rem 0.9rem 5.6rem;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 105, 62, 0.04);
}

.hero,
.toolbar,
.results-header,
.catalogue-table-wrapper,
.empty-state {
  animation: fade-up 360ms ease both;
}

.hero {
  position: relative;
  display: grid;
  gap: 0.2rem;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(0, 105, 62, 0.97), rgba(14, 128, 81, 0.93));
  color: #f7fbfc;
  border-radius: 18px;
  padding: 0.58rem 3.5rem 0.58rem 0.8rem;
  box-shadow: var(--panel-shadow);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: #ce1126;
}

.hero::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  inset: auto -70px -100px auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.hero-content {
  display: grid;
  gap: 0;
  position: relative;
  z-index: 1;
}

.hero-logo {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  z-index: 1;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 18px rgba(20, 47, 35, 0.14);
}

.hero h1 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-family: "Amiri", serif;
  font-size: clamp(1.28rem, 4.2vw, 1.75rem);
  line-height: 1;
}

.heading-icon {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 auto;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  font-family: "Tajawal", sans-serif;
  font-size: 0.85rem;
  line-height: 1;
}

.heading-icon.small {
  width: 1.35rem;
  height: 1.35rem;
  margin-inline-end: 0.35rem;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.72rem;
  vertical-align: middle;
}

.heading-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.filters-shell {
  margin-top: 0.4rem;
}

.toolbar {
  display: grid;
  gap: 0.42rem;
  margin-top: 0;
}

.control-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.control-label {
  display: block;
  margin-bottom: 0.18rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-soft);
}

.control-label-icon {
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  margin-inline-end: 0.3rem;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.68rem;
  line-height: 1;
  vertical-align: middle;
}

.search-input,
.category-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.56rem 0.72rem;
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--surface);
}

.search-input:focus,
.category-select:focus {
  outline: 3px solid rgba(0, 105, 62, 0.14);
  border-color: rgba(0, 105, 62, 0.42);
}

.results-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.3rem;
  margin-top: 0.42rem;
}

.results-header h2 {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 0.92rem;
}

.results-summary {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-soft);
}

.pagination-panel {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.5rem;
  justify-items: center;
}

.pagination-summary {
  font-size: 0.76rem;
  color: var(--text-soft);
}

.pagination-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  overflow: hidden;
}

.pagination-button {
  min-height: 34px;
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand);
  font-weight: 800;
  font-size: 0.8rem;
  box-shadow: var(--panel-shadow);
  cursor: pointer;
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-indicator {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.page-number {
  min-width: 32px;
  height: 32px;
  padding: 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.76rem;
  cursor: pointer;
}

.page-number.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.catalogue-grid {
  margin-top: 0.42rem;
}

.catalogue-table-wrapper {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--panel-shadow);
}

.catalogue-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.catalogue-table th,
.catalogue-table td {
  padding: 0.72rem 0.6rem;
  text-align: right;
  vertical-align: middle;
}

.catalogue-table th {
  background: var(--brand);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
}

.catalogue-table tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.sign-cell {
  font-size: 0.9rem;
}

.sign-cell-image {
  width: 82px;
  text-align: right;
}

.sign-cell-meta {
  width: 120px;
}

.sign-thumb-frame {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-right: 0;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f7f6f0, #ffffff);
  overflow: hidden;
}

.sign-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.45rem;
}

.sign-thumb-frame-portrait {
  height: 86px;
}

.sign-thumb-image-portrait {
  padding: 0.25rem;
}

.sign-thumb-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0.25rem;
  text-align: center;
  line-height: 1.2;
  color: var(--placeholder-text);
  background: var(--placeholder-bg);
  font-size: 0.68rem;
  font-weight: 700;
}

.sign-title {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.35;
}

.sign-detail-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.sign-detail-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.related-sign-reference {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  margin-top: 0.55rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f6f0;
}

.related-sign-image {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: contain;
}

.related-sign-text {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.related-sign-text small {
  color: var(--text-soft);
  font-size: 0.68rem;
}

.related-sign-text strong {
  font-size: 0.76rem;
}

.sign-category {
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.35;
}

.empty-state {
  background: var(--panel-bg);
  border: 1px dashed rgba(0, 105, 62, 0.3);
  border-radius: 18px;
  padding: 1.35rem 1rem;
  text-align: center;
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state p {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(460px, 100vw);
  padding: 0 0.9rem calc(0.65rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.45rem;
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -10px 24px rgba(20, 47, 35, 0.08);
}

.bottom-nav-link {
  display: grid;
  justify-items: center;
  gap: 0.12rem;
  min-height: 44px;
  padding: 0.35rem 0.2rem;
  border-radius: 14px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
}

.bottom-nav-link.active {
  background: #eaf4ed;
  color: var(--brand);
}

.bottom-nav-icon {
  font-size: 1rem;
  line-height: 1;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 700px) {
  body {
    padding-inline: 1rem;
  }

  .hero {
    grid-template-columns: 1.5fr auto;
    align-items: end;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .page-shell {
    border-radius: 28px;
    margin-block: 1rem;
    min-height: calc(100vh - 2rem);
    padding: 0.6rem 1rem 5.6rem;
    box-shadow:
      0 24px 60px rgba(20, 47, 35, 0.12),
      0 0 0 1px rgba(0, 105, 62, 0.06);
  }
}

@media (max-width: 699px) {
  .page-shell {
    max-width: none;
    padding-inline: 0.9rem;
  }

  .hero,
  .catalogue-table-wrapper,
  .empty-state {
    border-radius: 18px;
  }

  .results-header,
  .pagination-controls {
    align-items: center;
  }

  .page-indicator,
  .results-summary {
    width: auto;
  }

  .page-number {
    min-width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.76rem;
  }

  .catalogue-table th,
  .catalogue-table td {
    padding: 0.64rem 0.5rem;
  }

  .sign-cell-image {
    width: 74px;
  }

  .sign-cell-meta {
    width: 106px;
  }

  .sign-thumb-frame {
    width: 56px;
    height: 56px;
  }

  .sign-thumb-frame-portrait {
    height: 78px;
  }

  .sign-title {
    font-size: 0.9rem;
  }

  .sign-category,
  .catalogue-table th {
    font-size: 0.76rem;
  }
}

@media (max-width: 420px) {
  .page-shell {
    padding-inline: 0.85rem;
  }

  .bottom-nav {
    padding-inline: 0.85rem;
  }
}

/* Identité visuelle alignée sur la page d'accueil */
:root {
  --page-bg: #fbfaf4;
  --surface: #f4f3eb;
  --panel-bg: rgba(255, 254, 250, 0.96);
  --panel-border: rgba(12, 95, 56, 0.16);
  --panel-shadow: 0 10px 26px rgba(35, 53, 38, 0.09);
  --text-main: #193528;
  --text-soft: #686960;
  --brand: #0c5f38;
  --brand-strong: #073d27;
  --brand-soft: #e9efe2;
  --line: #d8ddc9;
}
body { background: #f2f1e9; }
.page-shell { background: var(--page-bg); }
.hero { border: 1px solid var(--line); background: var(--panel-bg); color: var(--brand-strong); border-radius: 20px; box-shadow: var(--panel-shadow); }
.hero::before { background: #e8aa35; }
.hero::after { background: rgba(12, 95, 56, 0.05); }
.hero h1 { color: var(--brand-strong); }
.toolbar, .catalogue-table-wrapper, .empty-state, .sign-card { background: var(--panel-bg); border-color: var(--line); box-shadow: var(--panel-shadow); }
.search-input, .category-select { background: #fffefa; border-color: var(--line); }
.pagination-button { background: #fffefa; border-color: var(--line); color: var(--brand); }
.bottom-nav { padding-inline: 0.6rem; }
.bottom-nav-inner { border: 1px solid rgba(28, 58, 40, 0.08); border-radius: 28px 28px 18px 18px; background: rgba(255, 255, 255, 0.97); box-shadow: 0 -6px 20px rgba(35, 53, 38, 0.12); }
.bottom-nav-link { position: relative; color: #414740; }
.bottom-nav-link.active { background: transparent; color: var(--brand); }
.bottom-nav-link.active::before { content: ""; position: absolute; top: -0.45rem; width: 26px; height: 4px; border-radius: 4px; background: var(--brand); }
.bottom-nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
