/* Protection Civile du Nord — component stylesheet.
   Loaded after tokens.css. Every value comes from a token; the rules are copied
   from the two products' own stylesheets:
   - website-frontend@5f7c2e7  src/css/application.css (@layer components; @apply expanded)
   - portal@d6c5c3a            app/assets/stylesheets/base.css (.portal-* primitives)
   Portal components built from Tailwind utility strings (Shared::ButtonStyles,
   BadgeTones, CalloutComponent, CardStyles) need Tailwind v4: see each
   component's README. */

/* ============ Website — call-to-action pills, cards, panels ============ */

.btn-primary,
.btn-secondary {
  border-radius: 9999px;
  padding: 0.5rem 1.25rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  line-height: 1.75rem;
}

.btn-primary {
  background-color: var(--color-orange);
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--color-orange-dark);
}

.btn-secondary {
  background-color: var(--color-slate-100);
  color: var(--color-blue);
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover {
  background-color: var(--color-slate-200);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.btn-neutral {
  background-color: var(--color-slate-200);
  color: var(--color-slate-700);
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-neutral:hover {
  background-color: var(--color-slate-300);
}

.card-surface {
  border: 1px solid var(--color-slate-300);
  box-shadow: var(--shadow-surface);
}

.card-surface-hover:hover {
  box-shadow: var(--shadow-surface-hover);
}

.card-muted {
  border: 1px solid var(--color-slate-300);
}

.link-accent {
  color: var(--color-blue);
  font-weight: 600;
  transition: color 0.2s ease;
}

.link-accent:hover {
  color: var(--color-blue-hover);
}

.panel-muted {
  background-color: var(--color-slate-50);
  border: 1px solid var(--color-slate-300);
  border-radius: 0.75rem;
}

/* ============ Portal — links ============ */

.portal-link {
  color: var(--color-blue);
}

.portal-link:hover {
  text-decoration: underline;
}

/* Le lien d'accent : une action secondaire écrite comme un lien et non comme un
   bouton — retirer une ligne, ajouter un créneau. Elle était recopiée à l'octet
   près sur quatre formulaires DPS, faute d'un nom qui l'autorise. */
.portal-link-accent {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--link-accent);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.portal-link-accent:hover {
  color: var(--link-accent-hover);
}

/* ============ Portal — form fields ============ */

.portal-field {
  display: grid;
  gap: 0.45rem;
}

.portal-field:has(> label.portal-field__label) {
  position: relative;
  gap: 0.35rem;
  padding-top: 0.55rem;
}

.portal-field--error .portal-field__label {
  color: var(--danger-ink);
}

.portal-field__label {
  color: var(--color-slate-700);
  font-size: 0.9rem;
  font-weight: 700;
}

.portal-field__label--required::after {
  content: " *";
  color: var(--danger-ink);
}


.portal-field > label.portal-field__label {
  position: absolute;
  top: 0;
  left: 0.85rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 1.1rem;
  max-width: calc(100% - 1.7rem);
  padding: 0 0.4rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  color: var(--color-slate-500);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}

.portal-field__hint {
  margin: 0;
  color: var(--color-slate-500);
  font-size: 0.85rem;
}

.portal-field__image-preview {
  max-width: 240px;
  max-height: 160px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card-strong);
  object-fit: contain;
}

.portal-field__control {
  width: 100%;
  /* `height`, pas `min-height` : un select et un input date ont des hauteurs
     intrinsèques différentes, et une barre de filtres les donne à voir toutes. */
  height: var(--control-height);
  box-sizing: border-box;
  /* La frontière d'un champ ACTIF doit se lire (>= 3:1) ; slate-300 était à
     1,49:1. Le désactivé, lui, est exempté et reste plus faible : l'inverse
     inverserait l'affordance. */
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  background: white;
  padding: 0.5rem 0.75rem;
  color: var(--color-slate-900);
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.03);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.portal-field:has(> label.portal-field__label) .portal-field__control {
  height: var(--control-height-labelled);
  padding-top: 0.625rem;
  padding-bottom: 0.25rem;
}

.portal-field:has(> label.portal-field__label) .portal-field__control:disabled {
  background: linear-gradient(180deg, var(--color-slate-50), var(--color-slate-100));
  border-color: var(--border-surface-1);
  color: var(--color-slate-500);
  cursor: not-allowed;
}

.portal-field__control--disabled,
.portal-field__control--disabled:disabled {
  background: linear-gradient(180deg, var(--color-slate-50), var(--color-slate-100));
  border-color: var(--border-surface-1);
  color: var(--color-slate-500);
  cursor: not-allowed;
}

.portal-field__control:focus {
  border-color: var(--border-attention);
  box-shadow: var(--focus-ring);
}

.portal-field__control--textarea {
  min-height: 7rem;
  resize: vertical;
}

.portal-field:has(> label.portal-field__label) .portal-field__control--file {
  min-height: 3.55rem;
  padding-top: 1.45rem;
  padding-bottom: 0.8rem;
}

.portal-field__control--error {
  border-color: var(--border-danger);
  background: #fff8fa;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.08);
}

.portal-field__errors {
  margin: 0;
  color: var(--danger-ink);
  font-size: 0.84rem;
  font-weight: 600;
}

/* ============ Portal — sidebar ============ */

.portal-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 1.35rem 1rem 1rem;
  background: linear-gradient(180deg, var(--color-blue-deep) 0%, var(--color-blue) 68%, #0f2f59 100%);
  color: rgba(255, 255, 255, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-sidebar);
  overflow-y: auto;
  /* Le pouce sombre du reste de l'application disparaîtrait sur ce dégradé. */
  scrollbar-color: var(--scrollbar-thumb-invert) transparent;
}

.portal-sidebar::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb-invert);
}

.portal-sidebar::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-invert-hover);
}

.portal-sidebar__brand-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.05);
}

.portal-sidebar__brand-image {
  width: 2.9rem;
  height: 2.9rem;
  object-fit: contain;
  border-radius: var(--radius-button);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.35rem;
}


.portal-sidebar__nav {
  display: grid;
  gap: 1.25rem;
}

.portal-sidebar__section {
  display: grid;
  gap: 0.4rem;
}

.portal-sidebar__section-label {
  margin: 0 0 0.3rem;
  padding: 0 0.55rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.portal-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.95rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.portal-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.portal-sidebar__link.is-active {
  background: linear-gradient(135deg, rgba(217, 117, 0, 0.94), rgba(244, 159, 44, 0.96));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-brand-orange);
}

.portal-sidebar__link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  opacity: 0.92;
}


/* ============ Portal — topbar ============ */

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(18, 65, 126, 0.08);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-topbar);
}

.portal-topbar__intro {
  display: grid;
  gap: 0.3rem;
}

.portal-topbar__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-slate-500);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.portal-topbar__eyebrow-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.65rem;
  background: rgba(18, 65, 126, 0.08);
  color: var(--color-blue);
}

.portal-topbar__title {
  margin: 0;
  color: var(--color-slate-900);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
}

.portal-topbar__count {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--border-surface-1);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--color-slate-700);
  font-size: 0.8rem;
  font-weight: 700;
  vertical-align: middle;
}

.portal-topbar__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-topbar__profile {
  position: relative;
  padding-bottom: 0.35rem;
  margin-bottom: -0.35rem;
}

.portal-topbar__chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(18, 65, 126, 0.08);
  border-radius: var(--radius-button);
  background: rgba(255, 255, 255, 0.78);
  color: var(--color-slate-700);
  font-size: 0.92rem;
  font-weight: 600;
}

.portal-topbar__chip--profile {
  gap: 0.7rem;
  padding-right: 0.8rem;
  cursor: pointer;
}

.portal-topbar__avatar,
.portal-topbar__chip-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.portal-topbar__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  background: rgba(18, 65, 126, 0.08);
  color: var(--color-blue);
}

.portal-topbar__chip-copy {
  display: grid;
  gap: 0.1rem;
  text-align: left;
}

.portal-topbar__chip-label {
  color: var(--color-slate-900);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.1;
}

.portal-topbar__chip-meta {
  color: var(--color-slate-500);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.1;
}


/* ============ Portal — surface cards ============ */

.portal-surface-card {
  border-radius: var(--radius-2xl);
  border-color: var(--border-card);
  box-shadow: var(--shadow-card);
}

.portal-surface-card {
  border: 1px solid var(--border-card);
  background: var(--surface-raised);
}

.portal-surface-card--compact {
  padding: 1.5rem;
}

.portal-surface-card--dense {
  padding: 0.75rem;
}

/* Une carte imbriquée dans une autre : l'aplat seul ne la sépare pas (blanc contre
   #f8fafc = 1,05:1) et l'ombre lui est retirée pour ne pas empiler deux reliefs —
   son trait est donc le seul qui reste, et il monte d'un cran. */
.portal-surface-card--muted {
  background: var(--surface-sunken);
  border-color: var(--border-card-strong);
  box-shadow: none;
}
