/* ============================================================
   APP.CSS  — Thème TP Jaune / Noir  —  Version aérée v2
   ============================================================ */

:root {
  --tp-yellow:     #F5A800;
  --tp-yellow-d:   #d48f00;
  --tp-yellow-lt:  #fff8e6;
  --tp-black:      #1a1a1a;
  --tp-bg:         #f0f2f5;
  --tp-white:      #ffffff;
  --tp-border:     #e0e4ea;
  --tp-muted:      #6c757d;
  --tp-text:       #2c2c2c;
  --tp-radius:     12px;
  --tp-radius-sm:  8px;
  --tp-shadow:     0 2px 12px rgba(0,0,0,.07);
  --tp-shadow-lg:  0 6px 28px rgba(0,0,0,.12);
  --pad-card:      1.75rem;
  --gap-section:   1.75rem;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--tp-bg);
  color: var(--tp-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

/* ══════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════ */
.tp-navbar {
  background-color: var(--tp-black);
  border-bottom: 3px solid var(--tp-yellow);
  padding: .9rem 2rem;
}
.tp-navbar .navbar-brand {
  color: var(--tp-yellow) !important;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .3px;
}
.tp-navbar .navbar-brand i { font-size: 1.25rem; }

/* ══════════════════════════════════════════
   PAGE WRAPPER
══════════════════════════════════════════ */
.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2rem 7rem;
}
@media (max-width: 992px) { .page-wrapper { padding: 2rem 1.5rem 7rem; } }
@media (max-width: 576px)  { .page-wrapper { padding: 1.25rem 1rem 7rem; } }

/* ══════════════════════════════════════════
   EN-TÊTE DE PAGE
══════════════════════════════════════════ */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--tp-border);
}
.page-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  color: var(--tp-black);
  line-height: 1.2;
}
.page-header .page-subtitle {
  color: var(--tp-muted);
  font-size: .875rem;
  margin: .35rem 0 0;
}

/* ══════════════════════════════════════════
   CARD-SECTION (bandeau jaune + corps blanc)
══════════════════════════════════════════ */
.card-section {
  background: var(--tp-white);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  overflow: hidden;
  margin-bottom: var(--gap-section);
  box-shadow: var(--tp-shadow);
  transition: box-shadow .25s;
}
.card-section:hover { box-shadow: var(--tp-shadow-lg); }

.section-banner {
  background-color: var(--tp-yellow);
  color: var(--tp-black);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.section-banner i { font-size: 1rem; opacity: .8; }

.card-section .card-body {
  padding: var(--pad-card);
}

/* Espace entre les champs dans un card-body */
.card-section .card-body .mb-3 { margin-bottom: 1.4rem !important; }
.card-section .card-body .mb-4 { margin-bottom: 1.75rem !important; }

/* ══════════════════════════════════════════
   CARD BOOTSTRAP OVERRIDE
══════════════════════════════════════════ */
.card {
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
}
.card-body { padding: var(--pad-card); }

/* ══════════════════════════════════════════
   FORM LABELS
══════════════════════════════════════════ */
.form-label {
  font-weight: 600;
  font-size: .82rem;
  color: var(--tp-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .5rem;
  display: block;
}

/* ══════════════════════════════════════════
   INPUTS / TEXTAREA / SELECT
══════════════════════════════════════════ */
.form-control, .form-select {
  border: 1.5px solid var(--tp-border);
  border-radius: var(--tp-radius-sm);
  padding: .65rem 1rem;
  font-size: .95rem;
  background: #fafbfc;
  transition: border-color .2s, box-shadow .2s, background .2s;
  color: var(--tp-text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--tp-yellow);
  box-shadow: 0 0 0 3px rgba(245,168,0,.2);
  background: #fff;
  outline: none;
}
.form-control::placeholder { color: #adb5bd; }

textarea.form-control {
  min-height: 110px;
  resize: vertical;
  line-height: 1.65;
}

.input-group-text {
  border: 1.5px solid var(--tp-border);
  border-left: none;
  background: #f4f6f8;
  color: var(--tp-muted);
  font-size: .9rem;
  border-radius: 0 var(--tp-radius-sm) var(--tp-radius-sm) 0;
}
.input-group .form-control { border-radius: var(--tp-radius-sm) 0 0 var(--tp-radius-sm); }

/* ══════════════════════════════════════════
   CHECKBOXES & SWITCHES
══════════════════════════════════════════ */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .5rem 1rem;
}
.form-check {
  padding: .6rem .9rem .6rem 2.2rem;
  border-radius: var(--tp-radius-sm);
  transition: background .15s;
  margin: 0;
}
.form-check:hover { background: var(--tp-yellow-lt); }
.form-check-input {
  width: 1.15em;
  height: 1.15em;
  margin-top: .2em;
  cursor: pointer;
}
.form-check-input:checked {
  background-color: var(--tp-yellow);
  border-color: var(--tp-yellow);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(245,168,0,.25); border-color: var(--tp-yellow); }
.form-check-label {
  font-size: .925rem;
  font-weight: 500;
  cursor: pointer;
}

.form-switch .form-check-input {
  width: 2.4em;
  height: 1.3em;
  border-radius: 2em;
}
.form-switch .form-check-input:checked {
  background-color: var(--tp-yellow);
  border-color: var(--tp-yellow);
}

/* ══════════════════════════════════════════
   BOUTONS
══════════════════════════════════════════ */
.btn-tp {
  background-color: var(--tp-yellow);
  border-color: var(--tp-yellow);
  color: var(--tp-black);
  font-weight: 700;
  border-radius: var(--tp-radius-sm);
  padding: .6rem 1.5rem;
  transition: background .2s, transform .1s, box-shadow .2s;
}
.btn-tp:hover {
  background-color: var(--tp-yellow-d);
  border-color: var(--tp-yellow-d);
  color: var(--tp-black);
  box-shadow: 0 4px 14px rgba(245,168,0,.45);
}
.btn-tp:active { transform: scale(.97); }
.btn-tp:focus  { box-shadow: 0 0 0 3px rgba(245,168,0,.35); color: var(--tp-black); }

/* ══════════════════════════════════════════
   FILTRE BAR (index.php)
══════════════════════════════════════════ */
.filter-bar {
  background: #fff;
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--tp-shadow);
}

/* ══════════════════════════════════════════
   TABLE LISTE FICHES
══════════════════════════════════════════ */
.table-fiches {
  margin: 0;
  font-size: .93rem;
}
.table-fiches thead th {
  background: var(--tp-black);
  color: #fff;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 1rem 1.25rem;
  border: none;
  font-weight: 700;
  white-space: nowrap;
}
.table-fiches tbody td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  border-color: #f2f4f7;
}
.table-fiches tbody tr { transition: background .15s; }
.table-fiches tbody tr:hover td { background: var(--tp-yellow-lt); }

/* ══════════════════════════════════════════
   TABLE ACTIONS CORRECTIVES
══════════════════════════════════════════ */
.table-actions { font-size: .9rem; }
.table-actions thead th {
  background-color: var(--tp-yellow);
  color: var(--tp-black);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  border: none;
  padding: .85rem 1.25rem;
}
.table-actions tbody tr { transition: background .15s; }
.table-actions tbody tr:hover td { background: var(--tp-yellow-lt); }
.table-actions td {
  vertical-align: middle;
  padding: .65rem .75rem;
  border-color: #f2f4f7;
}
.table-actions .form-control-sm {
  border: 1.5px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: .45rem .65rem;
  font-size: .9rem;
}
.table-actions .form-control-sm:focus {
  border-color: var(--tp-yellow);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(245,168,0,.2);
}
.add-action-wrapper {
  padding: 1.1rem 1.25rem;
  background: #fafbfc;
  border-top: 1px solid var(--tp-border);
}

/* ══════════════════════════════════════════
   PHOTOS
══════════════════════════════════════════ */
.photo-upload-area {
  border: 2px dashed var(--tp-border);
  border-radius: var(--tp-radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
  background: #fafbfc;
  transition: border-color .2s, background .2s;
  margin-bottom: 1rem;
}
.photo-upload-area:hover { border-color: var(--tp-yellow); background: var(--tp-yellow-lt); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  margin-top: .75rem;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--tp-border);
  transition: border-color .2s, transform .2s;
}
.photo-thumb:hover { border-color: var(--tp-yellow); transform: scale(1.04); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .btn-remove-photo {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,.72);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px; height: 24px;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background .15s;
}
.photo-thumb .btn-remove-photo:hover { background: #c00; }

/* ══════════════════════════════════════════
   LOGIN
══════════════════════════════════════════ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tp-black);
  background-image: repeating-linear-gradient(
    45deg, rgba(245,168,0,.035) 0, rgba(245,168,0,.035) 1px,
    transparent 1px, transparent 42px
  );
}
.login-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.login-header {
  background: var(--tp-yellow);
  color: var(--tp-black);
  padding: 2.75rem 2rem 2.25rem;
  text-align: center;
}
.login-header .login-icon { font-size: 3.25rem; display: block; margin-bottom: .75rem; line-height: 1; }
.login-header h1 { font-size: 1.5rem; font-weight: 800; margin: 0; }
.login-header p  { margin: .4rem 0 0; font-size: .875rem; opacity: .65; }
.login-body { padding: 2.25rem 2rem; background: #fff; }

/* ══════════════════════════════════════════
   BADGES STATUT
══════════════════════════════════════════ */
.badge-cloture-non { background-color: #ffc107; color: #000; font-weight: 600; padding: .35em .65em; }
.badge-cloture-oui { background-color: #198754; font-weight: 600; padding: .35em .65em; }

/* ══════════════════════════════════════════
   BARRE SUBMIT STICKY
══════════════════════════════════════════ */
.submit-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(26,26,26,.97);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  gap: .85rem;
  border-top: 3px solid var(--tp-yellow);
  box-shadow: 0 -4px 24px rgba(0,0,0,.3);
}
.submit-bar .btn { padding: .65rem 2rem; font-size: .95rem; border-radius: var(--tp-radius-sm); }

/* ══════════════════════════════════════════
   SCORE COTATION
══════════════════════════════════════════ */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 800;
  border: 3px solid;
}
.score-low    { color: #198754; border-color: #198754; background: #d1e7dd; }
.score-medium { color: #856404; border-color: #ffc107; background: #fff3cd; }
.score-high   { color: #dc3545; border-color: #dc3545; background: #f8d7da; }

/* ══════════════════════════════════════════
   VUE DETAIL (voir_fiche.php)
══════════════════════════════════════════ */
.detail-dl dt {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--tp-muted);
  font-weight: 600;
  padding-top: .3rem;
}
.detail-dl dd {
  font-size: 1rem;
  padding-bottom: .6rem;
  margin-bottom: .5rem;
  border-bottom: 1px solid #f2f4f7;
}
.detail-dl dd:last-of-type { border-bottom: none; }

.content-block {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--tp-text);
  font-size: .97rem;
}

/* ══════════════════════════════════════════
   ALERTES
══════════════════════════════════════════ */
.alert { border-radius: var(--tp-radius); padding: 1.1rem 1.5rem; font-size: .93rem; }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 576px) {
  :root {
    --pad-card:    1.25rem;
    --gap-section: 1.25rem;
  }
  .tp-navbar { padding: .75rem 1rem; }
  .section-banner { font-size: .8rem; padding: .75rem 1.1rem; }
  .submit-bar { padding: .8rem 1rem; }
  .submit-bar .btn { padding: .6rem 1.25rem; }
  .table-fiches thead th,
  .table-fiches tbody td { padding: .75rem .75rem; }
  .check-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { padding: 1.1rem 1.1rem; }
}

/* ══════════════════════════════════════════
   IMPRESSION
══════════════════════════════════════════ */
@media print {
  .tp-navbar, .submit-bar, .btn, .add-action-wrapper,
  .photo-upload-area, #toast-container { display: none !important; }
  .card-section { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .section-banner { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .page-wrapper { padding: 0; }
}
