/* ==================================== */
/* RESOURCES OVERLAY - SHARED           */
/* Base CSS partage entre applications  */
/* ==================================== */

.resource-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background: rgba(26, 18, 12, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 400;
}

.resource-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.resource-overlay-panel {
  position: relative;
  width: min(800px, 100%);
  height: 75vh;
  max-height: 85vh;
  background: var(--bg-canvas);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
  padding: 20px 22px 22px;
  transform: translateY(16px);
  opacity: 0;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Mode etendu pour le PDF viewer */
.resource-overlay.viewer-expanded .resource-overlay-panel {
  width: min(95vw, 1400px);
  height: 95vh;
  max-height: 95vh;
  padding: 16px;
}

.resource-overlay.is-open .resource-overlay-panel {
  transform: translateY(0);
  opacity: 1;
}

.resource-overlay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.resource-overlay-kicker {
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 11px;
  color: var(--accent-secondary);
  font-weight: 700;
}

.resource-overlay-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.resource-overlay-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
}

/* ==================================== */
/* CATEGORY SECTIONS                    */
/* ==================================== */
.resource-category {
  margin-bottom: 20px;
}

.resource-category:last-child {
  margin-bottom: 0;
}

.category-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-secondary);
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* ==================================== */
/* RESPONSIVE                           */
/* ==================================== */
@media (max-width: 768px) {
  .resource-overlay {
    padding: 18px;
  }

  .resource-overlay-panel {
    padding: 18px;
    max-height: 90vh;
  }
}

@media (max-width: 480px) {
  .resource-overlay-panel {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
  }

  .resource-overlay-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==================================== */
/* RESOURCE ITEMS                       */
/* ==================================== */
.resource-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}

.resource-item:last-child {
  margin-bottom: 0;
}

.resource-item:hover {
  background: var(--bg-sidebar-hover);
  border-color: var(--accent-primary);
}

.resource-item.selected {
  background: rgba(217, 119, 87, 0.1);
  border-color: var(--accent-primary);
}

.resource-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.resource-info {
  flex: 1;
  min-width: 0;
}

.resource-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-description {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--border-radius-pill);
  background: var(--accent-primary);
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
}

.resource-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.resource-actions button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  background: var(--bg-canvas);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.resource-actions button svg {
  width: 16px;
  height: 16px;
}

.resource-actions button:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}


/* ==================================== */
/* PDF VIEWER MODAL                     */
/* ==================================== */
.pdf-viewer-modal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 10;
}

.pdf-viewer-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.pdf-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.pdf-viewer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.pdf-viewer-toolbar {
  display: flex;
  gap: 8px;
}

.pdf-viewer-toolbar button {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--border-radius-pill);
  border: 1px solid var(--border-light);
  background: var(--bg-sidebar);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pdf-viewer-toolbar button:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.pdf-viewer-toolbar .btn-close-viewer {
  background: transparent;
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.pdf-viewer-toolbar .btn-close-viewer:hover {
  background: var(--text-muted);
  color: white;
}

.pdf-viewer-frame {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 0 0 16px 16px;
  background: #f5f5f5;
}

/* PDF Viewer error state */
.pdf-viewer-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

.pdf-viewer-error p {
  margin: 0 0 16px 0;
  font-size: 14px;
}

.pdf-viewer-error .btn-open-fallback {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--border-radius-pill);
  border: none;
  background: var(--accent-primary);
  color: white;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pdf-viewer-error .btn-open-fallback:hover {
  background: var(--accent-primary-hover, #c5654a);
}

/* ==================================== */
/* EMPTY STATE                          */
/* ==================================== */
.resource-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.resource-empty p {
  margin: 0;
  font-size: 14px;
}

/* ==================================== */
/* RESPONSIVE - ITEMS                   */
/* ==================================== */
@media (max-width: 768px) {
  .resource-item {
    flex-wrap: wrap;
  }

  .resource-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
  }

  .pdf-viewer-title {
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .pdf-viewer-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .pdf-viewer-title {
    max-width: 100%;
  }

  .pdf-viewer-toolbar {
    justify-content: stretch;
  }

  .pdf-viewer-toolbar button {
    flex: 1;
  }
}

/* ==================================== */
/* TABS SYSTEM - SEGMENTED CONTROL      */
/* ==================================== */
.resource-tabs {
  display: flex;
  position: relative;
  gap: 0;
  padding: 4px;
  background: var(--bg-sidebar);
  border-radius: var(--border-radius-pill);
  margin-bottom: 16px;
  flex-shrink: 0;
}

/* Indicateur coulissant */
.tabs-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(20% - 2px); /* 5 onglets = 20% chacun */
  height: calc(100% - 8px);
  background: var(--bg-canvas);
  border-radius: calc(var(--border-radius-pill) - 2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 0;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.resource-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: calc(var(--border-radius-pill) - 2px);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast);
  position: relative;
  z-index: 1;
}

.resource-tab:hover {
  color: var(--text-primary);
}

.resource-tab.active {
  color: var(--text-primary);
}

.resource-tab .tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.resource-tab .tab-icon svg {
  width: 18px;
  height: 18px;
}

.resource-tab .tab-label {
  white-space: nowrap;
}

/* Tab favoris actif - indicateur dore */
.resource-tabs:has(.resource-tab[data-tab="favoris"].active) .tabs-indicator {
  background: linear-gradient(135deg, #fef3cd 0%, #ffeaa7 100%);
}

.resource-tab[data-tab="favoris"].active {
  color: #856404;
}

.resource-tab[data-tab="favoris"]:hover:not(.active) {
  color: #d4a200;
}

/* ==================================== */
/* TAB PANELS - SLIDING ANIMATION       */
/* ==================================== */
.tab-panels-container {
  position: relative;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.tab-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.2s ease-out;
  pointer-events: none;
  overflow-y: auto;
  padding-right: 4px;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.tab-panel.active {
  /* Garder position: absolute pour eviter le reflow */
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 1;
}

/* Animation sortie vers la gauche */
.tab-panel.slide-out-left {
  transform: translateX(-30%);
  opacity: 0;
  z-index: 0;
}

/* Animation sortie vers la droite */
.tab-panel.slide-out-right {
  transform: translateX(30%);
  opacity: 0;
  z-index: 0;
}

/* Position initiale pour entree depuis la gauche */
.tab-panel.enter-from-left {
  transform: translateX(-30%);
  opacity: 0;
  transition: none;
}

/* Position initiale pour entree depuis la droite */
.tab-panel.enter-from-right {
  transform: translateX(30%);
  opacity: 0;
  transition: none;
}

/* ==================================== */
/* RESOURCE DATE                        */
/* ==================================== */
.resource-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  white-space: nowrap;
}

.resource-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.resource-meta .resource-description {
  margin-top: 0;
}

/* ==================================== */
/* FAVORITES                            */
/* ==================================== */
.btn-favorite {
  background: transparent !important;
  border-color: #d4a200 !important;
  color: #d4a200 !important;
  width: 32px;
  height: 32px;
  padding: 0 !important;
}

.btn-favorite svg {
  width: 16px;
  height: 16px;
}

.btn-favorite:hover {
  background: #fef3cd !important;
}

.btn-favorite.is-favorite {
  background: #fef3cd !important;
  color: #d4a200 !important;
}

/* Bouton favori dans le PDF viewer */
.pdf-viewer-toolbar .btn-toggle-favorite {
  background: transparent;
  border-color: #d4a200;
  color: #d4a200;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-viewer-toolbar .btn-toggle-favorite:hover {
  background: #fef3cd;
}

.pdf-viewer-toolbar .btn-toggle-favorite.is-favorite {
  background: #fef3cd;
}

.pdf-viewer-toolbar .btn-toggle-favorite svg {
  width: 18px;
  height: 18px;
}

/* Message favoris vide */
.favorites-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.favorites-empty .empty-icon {
  margin-bottom: 16px;
  opacity: 0.5;
  color: var(--text-muted);
}

.favorites-empty .empty-icon svg {
  width: 48px;
  height: 48px;
}

.favorites-empty p {
  margin: 0;
  font-size: 14px;
}

/* ==================================== */
/* RESPONSIVE - TABS                    */
/* ==================================== */
@media (max-width: 768px) {
  .resource-tab {
    padding: 8px 12px;
  }

  .resource-tab .tab-label {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .resource-tab .tab-label {
    display: none;
  }

  .resource-tab {
    padding: 10px 14px;
  }

  .resource-tab .tab-icon svg {
    width: 20px;
    height: 20px;
  }

  .resource-overlay.viewer-expanded .resource-overlay-panel {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  /* Animations plus rapides sur mobile */
  .tabs-indicator {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tab-panel {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
  }
}

/* ==================================== */
/* MINIATURES                           */
/* ==================================== */
.resource-thumbnail {
  width: 60px;
  height: 45px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-secondary, #f0f0f0);
  margin-right: 12px;
}

.resource-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  transition: background 0.2s ease;
}

.resource-item:hover .thumbnail-play-icon {
  background: rgba(0, 0, 0, 0.6);
}

.thumbnail-play-icon svg {
  fill: currentColor;
  stroke: none;
}

/* ==================================== */
/* BADGES PAR TYPE                      */
/* ==================================== */
.resource-badge.badge-pdf {
  background: #e53935;
  color: white;
}

.resource-badge.badge-video {
  background: #1e88e5;
  color: white;
}

.resource-badge.badge-image {
  background: #43a047;
  color: white;
}

.resource-badge.badge-gallery {
  background: #8e24aa;
  color: white;
}

.resource-badge.badge-link {
  background: #fb8c00;
  color: white;
}

/* ==================================== */
/* MEDIA VIEWER                         */
/* ==================================== */
.pdf-viewer-content {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: #1a1a1a;
  overflow: hidden;
  width: 100%;
}

/* iframe pour PDF et videos embed */
.pdf-viewer-content iframe,
.pdf-viewer-content .pdf-viewer-frame,
.media-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
}

.media-video {
  max-width: 100%;
  max-height: 100%;
  background: #000;
}

.media-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ==================================== */
/* IFRAME WRAPPER & FALLBACK            */
/* ==================================== */
.iframe-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  height: 100%;
}

.iframe-wrapper iframe {
  flex: 1;
  width: 100%;
  border: none;
}

.iframe-fallback-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-sidebar, #f5f5f5);
  border-top: 1px solid var(--border-light, #ddd);
  flex-shrink: 0;
}

.iframe-fallback-hint span {
  font-size: 13px;
  color: var(--text-secondary, #666);
}

.iframe-fallback-hint button {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--border-radius-pill, 20px);
  border: 1px solid var(--accent-primary, #d97757);
  background: transparent;
  color: var(--accent-primary, #d97757);
  cursor: pointer;
  transition: all 0.2s ease;
}

.iframe-fallback-hint button:hover {
  background: var(--accent-primary, #d97757);
  color: white;
}

/* Fallback complet (erreur de chargement) */
.viewer-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px;
  text-align: center;
  background: var(--bg-sidebar, #f5f5f5);
}

.viewer-fallback .fallback-icon {
  margin-bottom: 16px;
  opacity: 0.5;
  color: var(--text-muted, #999);
}

.viewer-fallback .fallback-icon svg {
  width: 48px;
  height: 48px;
}

.viewer-fallback p {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: var(--text-secondary, #666);
}


/* ===== SCORES TAB - HYBRID LAYOUT ===== */
.scores-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.interactive-calculators {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scores-resources {
  /* Utilise les styles existants des resource-category */
}
