@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --primary-color: #00755E;
  --primary-dark: #005441;
  --accent-color: #FFB300;
  --bg-color: #F8FAF9;
  --text-dark: #092017;
  --text-muted: #5c6f66;
  --surface: #ffffff;
  --shadow: 0 12px 30px rgba(0, 90, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: var(--bg-color);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

header {
  background: #ffffff;
  border-bottom: 3px solid var(--primary-color);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.container-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo img {
  height: 52px;
}

.main-menu {
  display: flex;
  align-items: center;
  gap: 35px;
}

.main-menu a {
  color: var(--text-dark);
  font-weight: 600;
  text-align: center;
  transition: color 0.3s ease;
}

.main-menu a small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.main-menu a:hover,
.main-menu a.active {
  color: var(--primary-color);
}

.right-menu {
  display: flex;
  align-items: center;
  gap: 15px;
}

.btn-outline {
  padding: 10px 22px;
  border-radius: 30px;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-outline:hover {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 117, 94, 0.25);
}

main {
  flex: 1;
}

.hero {
  background: linear-gradient(140deg, rgba(0, 117, 94, 0.12) 0%, rgba(0, 117, 94, 0.04) 55%, transparent 100%);
  padding: 100px 0 70px;
}

.hero .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  gap: 40px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: center;
}

.hero-content h2 {
  font-size: 2.8rem;
  line-height: 1.2;
  margin: 0 0 18px;
}

.hero-content p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 24px;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.metric-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 20px 24px;
  min-width: 170px;
  box-shadow: var(--shadow);
  text-align: center;
}

.metric-card span {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
}

.metric-card small {
  color: var(--text-muted);
}

.section {
  padding: 40px 0;
}

.section .container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

.section h3 {
  font-size: 2.1rem;
  margin: 0 0 10px;
  color: var(--primary-dark);
}

.section p.lead {
  margin: 0 0 30px;
  color: var(--text-muted);
}

.form-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.admin-tab-content[data-admin-panel="passages"] .form-card {
  padding: 28px 28px 32px;
}

.form-grid {
  display: grid;
  gap: 24px;
}

.form-segment {
  display: grid;
  gap: 20px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.form-segment:first-of-type {
  border-top: none;
  padding-top: 0;
}

.visitor-type-options {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.visitor-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(0, 117, 94, 0.25);
  border-radius: 16px;
  background: #fff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
}

.visitor-option input {
  margin: 0;
}

.visitor-option span {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  line-height: 1.45;
}

.visitor-option span small {
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

.visitor-option.is-active {
  border-color: var(--primary-color);
  box-shadow: 0 14px 28px rgba(0, 117, 94, 0.14);
}

.is-hidden {
  display: none !important;
}

.form-row {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.student-lookup-group {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.student-lookup-group input {
  flex: 1 1 auto;
}

.btn-secondary {
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid var(--primary-color);
  background: rgba(0, 117, 94, 0.08);
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 10px 20px rgba(0, 117, 94, 0.2);
}

.btn-secondary.is-loading {
  cursor: progress;
  opacity: 0.65;
}

.login-alt {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.login-alt .separator {
  font-weight: 600;
  color: var(--text-muted);
}

label {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
  font-family: 'Poppins', sans-serif;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 117, 94, 0.18);
}

textarea {
  resize: vertical;
  min-height: 130px;
}

.helper-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.helper-text.is-error {
  color: #b42318;
}

.helper-text.is-success {
  color: var(--primary-dark);
  font-weight: 600;
}

.passages-header {
  margin-bottom: 16px;
}

.passages-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.passages-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.passages-filter select {
  min-width: 140px;
}

.passages-filter-actions {
  display: flex;
  gap: 12px;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
}

.table-passages {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
}

.table-passages th,
.table-passages td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
}

.table-passages th {
  background: rgba(0, 117, 94, 0.08);
  font-weight: 600;
  color: var(--primary-dark);
}

.table-passages tbody tr:hover {
  background: rgba(0, 117, 94, 0.05);
}

.alert {
  padding: 16px 18px;
  border-radius: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}

.alert.success {
  background: rgba(0, 160, 90, 0.1);
  color: #0a7a47;
}

.alert.error {
  background: rgba(205, 35, 35, 0.12);
  color: #b11d1d;
}

.alert.info {
  background: rgba(0, 117, 94, 0.12);
  color: var(--primary-dark);
}

.admin-tab-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 20px;
}

.admin-tab-link {
  border: 1px solid rgba(0, 117, 94, 0.35);
  background: rgba(0, 117, 94, 0.08);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 10px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.admin-tab-link:hover,
.admin-tab-link:focus {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 10px 20px rgba(0, 117, 94, 0.2);
}

.admin-tab-link.is-active {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 12px 24px rgba(0, 117, 94, 0.24);
}

.admin-tab-panels {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
}

.admin-motifs .form-grid {
  margin-bottom: 20px;
}

.admin-motifs .actions {
  width: 120px;
}

.table-motifs code {
  background: rgba(0, 117, 94, 0.12);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: inline-block;
}

.table-motifs td.actions {
  text-align: right;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.is-active {
  display: block;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  padding: 14px 36px;
  border-radius: 999px;
  border: none;
  background: var(--primary-color);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover,
.btn-primary:focus {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 117, 94, 0.3);
}

.btn-primary.is-loading,
.btn-primary:disabled {
  cursor: progress;
  opacity: 0.7;
  box-shadow: none;
  transform: none;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.badge {
  background: rgba(0, 117, 94, 0.12);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.cards-duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.cards-duo .form-card ul,
.cards-duo .form-card ol {
  padding-left: 16px;
  color: var(--text-muted);
}

.cards-duo .form-card li {
  margin-bottom: 10px;
}

.kpis {
  margin-top: 32px;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.kpis .card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.kpis .card h4 {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 1rem;
}

.kpis .card strong {
  font-size: 1.6rem;
  color: var(--primary-color);
}

/* Tableau de bord administration */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card .label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-card strong {
  font-size: 1.9rem;
  color: var(--primary-color);
}

.stat-card small {
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px 32px;
  margin-top: 8px;
}

.list-stats {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-stats li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 117, 94, 0.06);
  padding: 12px 16px;
  border-radius: 14px;
}

.list-stats strong {
  color: var(--primary-dark);
}

.table-stats {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-dark);
}

.table-stats td {
  padding: 10px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.table-stats tr:last-child td {
  border-bottom: none;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.card-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.link-inline {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

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

.list-recents {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.list-recents li {
  background: rgba(0, 117, 94, 0.05);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.recent-id {
  font-weight: 600;
  color: var(--primary-dark);
}

.recent-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.recent-person {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
}

.recent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.chip-motif {
  background: rgba(0, 117, 94, 0.12);
  color: var(--primary-dark);
}

.list-recents .commentaire {
  margin: 0;
  font-style: italic;
  color: var(--text-muted);
}

.admin-form h4 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.dropdown-results {
  position: absolute;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  margin-top: 6px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
}

.dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(0, 117, 94, 0.08);
}

.ldap-search-block {
  position: relative;
  margin-bottom: 18px;
}

.admin-managers {
  margin-top: 24px;
}

.admin-managers .form-row {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.admin-managers .btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-disabled {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: not-allowed;
  display: inline-block;
}

.table-admins {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 0.95rem;
}

.table-admins th,
.table-admins td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
}

.table-admins th {
  background: rgba(0, 117, 94, 0.08);
  color: var(--primary-dark);
}

.table-admins tr:last-child td {
  border-bottom: none;
}

.admin-add-form {
  margin-top: 10px;
}

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

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

  .table-admins th,
  .table-admins td {
    font-size: 0.85rem;
  }
}

footer {
  background: #0b4737;
  color: rgba(255, 255, 255, 0.78);
  padding: 28px 0;
  margin-top: 60px;
}

footer .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

footer a {
  color: #fff;
  font-weight: 600;
  opacity: 0.85;
}

footer a:hover {
  opacity: 1;
}

@media (max-width: 992px) {
  .container-header {
    flex-direction: column;
    gap: 20px;
  }

  .main-menu {
    flex-wrap: wrap;
    justify-content: center;
  }

  .right-menu {
    flex-direction: column;
  }

  .hero .container {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .form-card {
    padding: 24px;
  }

  header {
    position: static;
  }
}
