/* Biosimia PNH — formulaire */

.pnh-form {
  --pnh-border: #c8d1dc;
  --pnh-bg: #f0f4f8;
  --pnh-primary: #1a5f4a;
  --pnh-primary-light: #e8f3ef;
  --pnh-primary-hover: #144a3a;
  --pnh-accent: #2d6a4f;
  --pnh-radius: 8px;
  --pnh-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  max-width: 100%;
  font-size: 15px;
  line-height: 1.5;
  color: #1f2933;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pnh-intro {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--pnh-bg);
  border-radius: var(--pnh-radius);
  border: 1px solid var(--pnh-border);
}

.pnh-intro ul {
  margin: 0.5rem 0 0 1.25rem;
}

.pnh-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--pnh-border);
}

.pnh-section__title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  color: var(--pnh-primary);
}

.pnh-section__hint {
  margin: 0 0 1rem;
  color: #57606a;
  font-size: 0.92rem;
}

.pnh-grid {
  display: grid;
  gap: 1rem;
}

.pnh-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.pnh-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pnh-field--full {
  grid-column: 1 / -1;
}

.pnh-field__label {
  font-weight: 600;
  font-size: 0.9rem;
}

.pnh-field input,
.pnh-field select,
.pnh-field textarea,
.pnh-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--pnh-border);
  border-radius: var(--pnh-radius);
  font: inherit;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.pnh-field input:focus,
.pnh-field select:focus,
.pnh-field textarea:focus,
.pnh-input:focus {
  outline: none;
  border-color: var(--pnh-primary);
  box-shadow: 0 0 0 3px rgba(26, 95, 74, 0.15);
}

.pnh-input--xs {
  width: auto;
  min-width: 3.25rem;
  max-width: 4.5rem;
  display: inline-block;
}

.pnh-input--select {
  min-width: 6.5rem;
}

/* Oui / Non dans le tableau */
.pnh-oui-non-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.pnh-oui-non-field__icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  background: #e8eaed;
  color: #9aa5b1;
}

.pnh-oui-non-field__icon::before {
  content: '·';
}

.pnh-oui-non-field--oui .pnh-oui-non-field__icon {
  background: #dafbe1;
  color: #116329;
  box-shadow: inset 0 0 0 1px #9ed9a6;
}

.pnh-oui-non-field--oui .pnh-oui-non-field__icon::before {
  content: '✓';
}

.pnh-oui-non-field--non .pnh-oui-non-field__icon {
  background: #ffebe9;
  color: #cf222e;
  box-shadow: inset 0 0 0 1px #ffb3ad;
}

.pnh-oui-non-field--non .pnh-oui-non-field__icon::before {
  content: '✕';
}

.pnh-oui-non-field--oui .pnh-input--oui-non {
  border-color: #2da44e;
  background: #f6ffed;
}

.pnh-oui-non-field--non .pnh-input--oui-non {
  border-color: #cf222e;
  background: #fff5f5;
}

.pnh-oui-non-field .pnh-input--oui-non {
  flex: 1;
  min-width: 0;
}

.pnh-input--nombre {
  font-weight: 600;
  text-align: center;
  background: #fffef5;
  border-color: #d4a72c;
}

.pnh-input--nombre:focus {
  border-color: var(--pnh-primary);
  background: #fff;
}

.pnh-input--comment {
  margin-top: 0.4rem;
  font-size: 0.88rem;
}

.pnh-input:disabled,
.pnh-input[disabled] {
  cursor: not-allowed;
  opacity: 0.65;
}

/* Bloc espèce */
.pnh-espece-block {
  margin-bottom: 1.75rem;
  border: 1px solid var(--pnh-border);
  border-radius: calc(var(--pnh-radius) + 2px);
  background: #fff;
  box-shadow: var(--pnh-shadow);
  overflow: hidden;
}

.pnh-espece-block__banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--pnh-primary) 0%, var(--pnh-accent) 100%);
  color: #fff;
  flex-wrap: wrap;
}

.pnh-espece-block__banner-main {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: min(100%, 280px);
}

.pnh-espece-block__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
}

.pnh-espece-select-wrap {
  display: block;
}

.pnh-espece-select {
  width: 100%;
  max-width: 420px;
  padding: 0.7rem 2.5rem 0.7rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--pnh-radius);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231a5f4a' d='M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2z'/%3E%3C/svg%3E") no-repeat right 1rem center;
  appearance: none;
  color: var(--pnh-primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.pnh-espece-select:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.pnh-espece-select option {
  color: #1f2933;
  font-weight: 500;
}

.pnh-espece-block__badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.pnh-espece-block__badge--selected {
  background: #fff;
  color: var(--pnh-primary);
  border-color: #fff;
}

.pnh-espece-block .pnh-btn--text {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.pnh-espece-block .pnh-btn--text:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Tableau */
.pnh-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.5rem 0.5rem;
}

.pnh-matrix {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

.pnh-matrix th,
.pnh-matrix td {
  border: 1px solid var(--pnh-border);
  padding: 0.5rem 0.55rem;
  vertical-align: middle;
}

.pnh-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #dfe8f0;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 0.65rem 0.5rem;
  color: #243b53;
}

.pnh-matrix__corner {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 240px;
  max-width: 280px;
  text-align: left !important;
  background: #cfd9e3 !important;
}

.pnh-matrix__row-label {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 240px;
  max-width: 280px;
  background: #f7f9fb;
  font-weight: 600;
  text-align: left;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #334e68;
}

.pnh-matrix tbody tr:nth-child(even) .pnh-matrix__row-label {
  background: #f0f4f8;
}

.pnh-matrix__row--nombre .pnh-matrix__row-label {
  background: #fff8e6;
  color: #8a6d1d;
  font-weight: 700;
}

.pnh-matrix__row--nombre .pnh-matrix__cell {
  background: #fffdf5;
}

.pnh-matrix__cell {
  min-width: 118px;
  background: #fff;
  transition: background 0.2s, opacity 0.2s;
}

.pnh-matrix tbody tr:nth-child(even) .pnh-matrix__cell:not(.pnh-matrix__col--inactive) {
  background: #fafbfc;
}

.pnh-matrix thead th.pnh-matrix__col--inactive {
  background: #c5ccd3 !important;
  color: #6b7280;
}

.pnh-matrix__col--inactive {
  background: #e4e8ec !important;
  opacity: 0.92;
}

.pnh-matrix__col--inactive .pnh-cell {
  position: relative;
}

.pnh-matrix__col--inactive .pnh-cell::after {
  content: "—";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #9aa5b1;
  font-weight: 600;
  pointer-events: none;
  background: rgba(228, 232, 236, 0.75);
}

.pnh-matrix__col--inactive .pnh-cell--nombre::after {
  display: none;
}

.pnh-matrix__col--inactive input:not(.pnh-input--nombre),
.pnh-matrix__col--inactive select:not(.pnh-input--nombre),
.pnh-matrix__col--inactive textarea {
  visibility: hidden;
}

.pnh-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pnh-cell--nombre {
  align-items: stretch;
}

.pnh-cell textarea {
  min-height: 2.5rem;
  resize: vertical;
}

.pnh-cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pnh-poids-range {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.pnh-age-range {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.pnh-age-range__sep {
  color: #829ab1;
  font-size: 0.8rem;
}

.pnh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: var(--pnh-radius);
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pnh-btn--primary {
  background: var(--pnh-primary);
  color: #fff;
}

.pnh-btn--primary:hover {
  background: var(--pnh-primary-hover);
}

.pnh-btn--secondary {
  background: #fff;
  border-color: var(--pnh-border);
  color: var(--pnh-primary);
  font-weight: 600;
}

.pnh-btn--secondary:hover {
  background: var(--pnh-primary-light);
  border-color: var(--pnh-primary);
}

.pnh-btn--secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f0f4f8;
  border-color: var(--pnh-border);
  color: #829ab1;
}

.pnh-btn--text {
  background: transparent;
  color: #b42318;
  padding: 0.35rem 0.65rem;
  font-size: 0.88rem;
}

.pnh-form__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}

.pnh-form__feedback {
  margin: 0;
  padding: 0.65rem 0.9rem;
  border-radius: var(--pnh-radius);
  background: #dafbe1;
  color: #116329;
}

.pnh-form__feedback--error {
  background: #ffebe9;
  color: #82071e;
}

.pnh-notice {
  padding: 1rem;
  border-radius: var(--pnh-radius);
}

.pnh-notice--warning {
  background: #fff8c5;
  border: 1px solid #d4a72c;
}

/* Admin */
#pnh-admin-form-wrap .pnh-form__actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 1rem 0;
  border-top: 1px solid var(--pnh-border);
  z-index: 10;
}

@media (max-width: 768px) {
  .pnh-grid--2 {
    grid-template-columns: 1fr;
  }

  .pnh-matrix {
    min-width: 760px;
  }

  .pnh-espece-block__banner {
    flex-direction: column;
  }

  .pnh-espece-select {
    max-width: 100%;
  }
}

/* Page de confirmation */
.pnh-confirmation__message {
  margin-bottom: 1.75rem;
  padding: 1.1rem 1.35rem;
  background: #e8f3ef;
  border: 1px solid #9ec9b5;
  border-radius: var(--pnh-radius);
  font-size: 1.02rem;
}

.pnh-confirmation-notice p {
  margin: 0 0 0.5rem;
}

.pnh-confirmation-notice p:last-child {
  margin-bottom: 0;
}

.pnh-confirmation__recap-title {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  color: var(--pnh-primary);
}

/* Compte-rendu */
.pnh-summary__meta {
  margin: 0 0 1.25rem;
  padding: 0.65rem 0.9rem;
  background: var(--pnh-bg);
  border-radius: var(--pnh-radius);
  font-size: 0.92rem;
}

.pnh-summary__section {
  margin-bottom: 2rem;
}

.pnh-summary__title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--pnh-primary);
}

.pnh-summary__dl {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.pnh-summary__row {
  display: grid;
  grid-template-columns: minmax(140px, 240px) 1fr;
  gap: 0.75rem 1rem;
  padding: 0.55rem 0.75rem;
  background: #fafbfc;
  border: 1px solid var(--pnh-border);
  border-radius: var(--pnh-radius);
}

.pnh-summary__row dt {
  margin: 0;
  font-weight: 600;
  color: #486581;
}

.pnh-summary__row dd {
  margin: 0;
}

.pnh-matrix--readonly .pnh-matrix__cell {
  background: #fff;
  color: #243b53;
}

.pnh-matrix--readonly input,
.pnh-matrix--readonly select,
.pnh-matrix--readonly textarea {
  display: none;
}

@media (max-width: 640px) {
  .pnh-summary__row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}
