/* Feuille de style principale - Espace Pédagogique */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #475569;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --transition: all 0.2s ease-in-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* En-tête / Barre de navigation */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.brand-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  text-decoration: none;
  color: var(--secondary);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* Bouton Cadenas Sécurisé */
.btn-lock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
  padding: 0.45rem 0.85rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
}

.btn-lock svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.btn-lock:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-lock.logged-in {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* Section Hero */
.hero-section {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  color: white;
  padding: 3rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
}

.hero-desc {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

/* Barre de recherche dans le Hero */
.search-container {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  font-size: 1rem;
  border-radius: 50px;
  border: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
}

.search-input:focus {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* Contenu Principal */
.main-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
  width: 100%;
}

/* Filtres de Classes (Onglets horizontaux) */
.class-filters {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  scrollbar-width: thin;
}

.filter-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--secondary);
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.badge-count {
  background: rgba(0, 0, 0, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 12px;
  font-size: 0.75rem;
}

.filter-btn.active .badge-count {
  background: rgba(255, 255, 255, 0.25);
}

/* Filtres de Rubriques (Badges secondaires) */
.rubrique-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.rubrique-tag {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rubrique-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.rubrique-tag:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.rubrique-tag.active {
  background: #1e293b;
  color: white;
  border-color: #1e293b;
}

/* Grille de Documents */
.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.doc-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
}

.doc-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.doc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.doc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.doc-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.doc-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #64748b;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  margin-bottom: 1.25rem;
}

.doc-due-alert {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #b45309;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.doc-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-doc {
  flex: 1;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-preview {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
}

.btn-preview:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-download {
  background: var(--primary);
  color: white;
}

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

/* État Aucun Résultat */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1.5rem;
  background: white;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: #94a3b8;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  color: #334155;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #64748b;
}

/* Modale Lecteur PDF */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-window {
  background: white;
  width: 100%;
  max-width: 1000px;
  height: 90vh;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.modal-body {
  flex: 1;
  background: #525659;
  position: relative;
}

.modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Pied de page & Compteur de visites */
.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-stats-badge {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  gap: 1rem;
  font-size: 0.82rem;
  color: #334155;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-item strong {
  color: var(--primary);
}

.stat-divider {
  color: #cbd5e1;
}

/* Styles Calendrier Interactif */
.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.calendar-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.calendar-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cal-month-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
}

.cal-nav-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-cal-nav {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: #334155;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-cal-nav:hover {
  background: #e2e8f0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-header {
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  text-transform: uppercase;
}

.calendar-day-cell {
  min-height: 90px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  cursor: default;
}

.calendar-day-cell.other-month {
  background: #f8fafc;
  opacity: 0.45;
}

.calendar-day-cell.is-today {
  border-color: var(--primary);
  background: #eff6ff;
}

.calendar-day-cell.has-events {
  cursor: pointer;
  background: #fafafa;
}

.calendar-day-cell.has-events:hover, .calendar-day-cell.selected {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  background: #ffffff;
}

.day-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.25rem;
}

.is-today .day-number {
  color: var(--primary);
}

.day-events-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.cal-event-badge {
  color: white;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-more-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 1px 4px;
}

/* Panneau de détails du calendrier */
.cal-sidebar-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-details-header h4 {
  font-size: 1rem;
  color: #1e293b;
}

.calendar-events-flow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  max-height: 520px;
}

.cal-detail-card {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.85rem;
  border: 1px solid var(--border);
}

.cal-detail-tags {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.cal-detail-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.cal-detail-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.cal-detail-actions {
  display: flex;
  gap: 0.5rem;
}

/* Responsive */
@media (max-width: 900px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 1.6rem;
  }
  .header-container {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .footer-container {
    flex-direction: column;
    text-align: center;
  }
  .documents-grid {
    grid-template-columns: 1fr;
  }
}

