/* =====================================================
   VARIABLES & RESET
===================================================== */
:root {
  font-size: 16px;
  --ratio: 1.333;
  --font-size-h1: calc(1.5rem * var(--ratio));
  --font-size-h2: calc(1.25rem * var(--ratio));
  --font-size-h3: calc(1rem * var(--ratio));
  --font-size-h4: calc(0.875rem * var(--ratio));
  --font-size-body: 1rem;
  --font-size-small: 0.875rem;
  --mobile-factor: 0.85;
  --tablet-factor: 0.9;
  --color-primary: #9F9FA9;
  --color-dark: #171717;
  --color-red: #FF2800;
  --metal-gradient: linear-gradient(145deg,#b0b0b8 0%,#9898a0 25%,#808088 50%,#686870 75%,#505058 100%);
  --metal-gradient-hover: linear-gradient(145deg,#b8b8c0 0%,#a0a0a8 25%,#888890 50%,#707078 75%,#585860 100%);
}

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

body {
  font-family: 'Source Code Pro', monospace;
  background: url("./commun/fond.png") center/cover no-repeat,
              linear-gradient(135deg, #9F9FA9 0%, #171717 100%);
  color: #000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 10px 5px;
  overflow-x: hidden;
  font-size: var(--font-size-body);
  line-height: 1.5;
}

/* =====================================================
   STRUCTURE
===================================================== */
.compact-container {
  width: 100%;
  max-width: 1030px;
  margin: 0 auto;
}

.main-content {
  background: white;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  overflow: hidden;
  padding: 15px 15px 25px;
  position: relative;
}

h1, h2, h3, h4 {
  font-family: 'Source Code Pro', monospace;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5em;
  color: #000;
}

h2 {
  font-size: clamp(1.3rem, 3vw, var(--font-size-h2));
  text-shadow: 2px 2px 4px rgba(255,255,255,0.9);
}

h3 {
  font-size: clamp(1.15rem, 2.5vw, var(--font-size-h3));
}

/* =====================================================
   ENTÊTE CATÉGORIE
===================================================== */
.integrated-header-category {
  margin-bottom: 10px;
  text-align: center;
}

.header-visual-category {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border: 2px groove black;
  background: linear-gradient(135deg, #9F9FA9 0%, #171717 100%);
  padding: 10px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-text-overlay-category h2 {
  color: #ffffff !important;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  margin: 0;
  line-height: 1.3;
}

/* =====================================================
   TUILES
===================================================== */
.tile-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  margin-top: 15px;
}

.tile {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

.tile-header {
  padding: 0 20px;
  height: 60px;
  background: linear-gradient(135deg, #9F9FA9 0%, #171717 100%);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  position: relative;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  font-family: 'Source Code Pro', monospace;
  transition: background 0.2s;
}

.tile-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 12px 12px 0 0;
}

.tile-header h2 {
  margin: 0;
  font-size: var(--font-size-h3);
  color: white !important;
  font-weight: 300 !important;
  text-shadow: none !important;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

.tile-header.active {
  background: linear-gradient(135deg, #AFAFB9 0%, #272727 100%);
  border-bottom: 3px solid var(--color-red);
}

.tile-header.active h2 {
  font-weight: 400 !important;
}

.tile-icon {
  font-size: 1.2em;
  color: white !important;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.tile-header.active .tile-icon {
  transform: rotate(180deg);
  color: var(--color-red) !important;
}

.tile-body {
  display: none;
  padding: 16px 20px 20px;
  background: white;
}

.tile-body.open {
  display: block;
}

/* =====================================================
   RÉFÉRENCE LÉGALE
===================================================== */
.legal-reference {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 14px auto;
  padding: 6px 15px;
  background: linear-gradient(135deg, rgba(159,159,169,0.08) 0%, rgba(255,255,255,0.15) 100%);
  border-left: 4px solid #9F9FA9;
  border-right: 4px solid #9F9FA9;
  border-radius: 40px;
  max-width: 600px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.5);
  font-family: 'Source Code Pro', monospace;
}

.legal-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #9F9FA9 0%, #171717 100%);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.3);
  border: 1px solid rgba(255,255,255,0.2);
  overflow: hidden;
}

.legal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.legal-text {
  font-size: 0.9rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  flex-wrap: wrap;
}

.legal-text a {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(159,159,169,0.1);
  border-radius: 30px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.legal-text a:hover {
  background: rgba(159,159,169,0.2);
  border-color: rgba(159,159,169,0.3);
  color: #000;
  transform: translateY(-1px);
}

.legal-text a::after {
  content: none;
}

.legifrance-badge {
  background: linear-gradient(145deg, #b0b0b8 0%, #808088 100%);
  color: white;
  padding: 2px 10px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =====================================================
   CARROUSEL — structure FLEXBOX
===================================================== */
.carousel-wrapper {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.nav-arrow {
  flex-shrink: 0;
  width: 54px;
  align-self: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid #9F9FA9;
  background: white;
  color: #9F9FA9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 5;
}

.nav-arrow:hover {
  background: #9F9FA9;
  color: white;
  transform: scale(1.12);
  box-shadow: 0 8px 25px rgba(159,159,169,0.35);
}

.nav-arrow svg {
  width: 26px;
  height: 26px;
}

.slides-container {
  flex: 1;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.slides-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slide {
  flex: 0 0 100%;
  min-width: 100%;
  padding: 10px;
  opacity: 0.4;
  transform: scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.slide.active {
  opacity: 1;
  transform: scale(1);
}

/* =====================================================
   CARTE
===================================================== */
.choice-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 1px solid rgba(159,159,169,0.15);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

.choice-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.22);
  border-color: #9F9FA9;
}

.card-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weapon-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  filter: drop-shadow(0 8px 15px rgba(0,0,0,0.25));
  transition: transform 0.4s ease, filter 0.4s ease;
  cursor: zoom-in;
  position: relative;
  z-index: 2;
}

.choice-card:hover .weapon-image {
  transform: scale(1.1);
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.3));
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, rgba(159,159,169,0.05) 0%, rgba(255,255,255,0.08) 100%);
  z-index: 1;
  pointer-events: none;
}

.card-info {
  padding: 12px 20px;
  text-align: center;
  background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
  border-top: 3px solid #9F9FA9;
}

.card-info p {
  font-size: 0.9rem;
  color: #333;
  margin: 0;
  line-height: 1.3;
}

/* =====================================================
   BOUTONS ACTION
===================================================== */
.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.card-actions .action-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
  padding: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.card-actions .action-btn.info-btn {
  background: linear-gradient(145deg,#a8a8b0 0%,#909098 25%,#787880 50%,#606068 75%,#484850 100%);
}

.card-actions .action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25) 0%, transparent 100%);
  border-radius: 8px 8px 0 0;
  z-index: 1;
}

.card-actions .action-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to top, rgba(0,0,0,0.15) 0%, transparent 100%);
  border-radius: 0 0 8px 8px;
  z-index: 1;
}

.card-actions .action-btn .btn-icon {
  font-size: 0.95rem;
  position: relative;
  z-index: 2;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.card-actions .action-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

/* =====================================================
   PAGINATION DANS L'IMAGE
===================================================== */
.image-pagination {
  position: absolute !important;
  bottom: 10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: rgba(0,0,0,0.7) !important;
  backdrop-filter: blur(4px) !important;
  color: white !important;
  padding: 5px 16px !important;
  border-radius: 30px !important;
  font-size: 0.9rem !important;
  font-family: 'Source Code Pro', monospace !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  box-shadow: 0 3px 12px rgba(0,0,0,0.5) !important;
  z-index: 100 !important;
  pointer-events: none !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6) !important;
  line-height: 1.3 !important;
}

/* =====================================================
   TOOLTIP
===================================================== */
.tooltip-popup {
  display: none;
  position: fixed;
  background: linear-gradient(135deg, #9F9FA9 0%, #171717 100%);
  color: white;
  padding: 14px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.4);
  font-family: 'Source Code Pro', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 260px;
  z-index: 9000;
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(5px);
  pointer-events: none;
}

.tooltip-popup.visible {
  display: block;
}

/* =====================================================
   MODALE ZOOM IMAGE
===================================================== */
.modal {
  display: none;
  position: fixed;
  z-index: 20000;
  inset: 0;
  background: rgba(0,0,0,0.92);
  overflow: auto;
}

.modal-content {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 30px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

#modalCaption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #ccc;
  text-align: center;
  width: 80%;
  max-width: 700px;
  padding: 10px 0;
}

body.modal-open .close-popup-btn,
body.modal-open .nav-btn,
body.modal-open .scroll-top-btn {
  display: none !important;
}


.back-button-container {
  display: none;
}

.note {
  font-size: 0.82rem;
  color: #aaa;
  text-align: right;
  margin-top: 6px;
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 1024px) {
  .nav-arrow {
    width: 46px;
  }
  .nav-arrow svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 768px) {
  :root {
    font-size: 15px;
  }
  body {
    padding: 8px 4px;
  }
  .main-content {
    padding: 10px 10px 18px;
    border-radius: 14px;
  }
  .nav-arrow {
    width: 40px;
  }
  .nav-arrow svg {
    width: 20px;
    height: 20px;
  }
  .card-info p {
    font-size: 0.82rem;
  }
  .card-actions .action-btn {
    width: 30px;
    height: 30px;
  }
  .tile-header {
    height: 55px;
    padding: 0 16px;
    border-radius: 10px;
  }
  .tile-header h2 {
    font-size: calc(var(--font-size-h3) * 0.9);
  }
  .tile-body {
    padding: 12px 14px 16px;
  }
  .image-pagination {
    bottom: 6px !important;
    padding: 4px 12px !important;
    font-size: 0.78rem !important;
  }
  .legal-reference {
    padding: 4px 10px;
    gap: 8px;
  }
  .legal-image-container {
    width: 34px;
    height: 34px;
  }
  .legal-text {
    font-size: 0.78rem;
  }
  .close-popup-btn, .scroll-top-btn, .nav-btn {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  :root {
    font-size: 14px;
  }
  body {
    padding: 5px 2px;
  }
  .main-content {
    border-radius: 12px;
  }
  .nav-arrow {
    width: 34px;
  }
  .tile-header {
    height: 50px;
  }
  .image-pagination {
    font-size: 0.7rem !important;
    padding: 3px 10px !important;
  }
  .legal-reference {
    flex-direction: column;
    gap: 5px;
    border-left-width: 2px;
    border-right-width: 2px;
  }
  .legal-text {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .card-visual {
    aspect-ratio: 16 / 9;
  }
}

@media (hover: none) and (pointer: coarse) {
  .choice-card:hover {
    transform: none;
  }
  .nav-arrow:hover {
    transform: scale(1);
    background: white;
    color: #9F9FA9;
  }
  .nav-arrow:active {
    background: #9F9FA9;
    color: white;
    transform: scale(0.95);
  }
  .card-actions .action-btn:hover {
    transform: none;
  }
}
/* =====================================================
   OPTIMISATIONS MOBILE - CARROUSEL ÉLARGI
===================================================== */
@media (max-width: 768px) {
  /* Réduction des marges du conteneur principal */
  .main-content {
    padding: 8px 5px 15px !important;
  }
  
  .compact-container {
    max-width: 100%;
  }
  
  /* Élargissement du carrousel */
  .carousel-wrapper {
    gap: 2px; /* Réduction de l'espace entre flèches et slides */
    margin: 0 -2px; /* Légère extension sur les côtés */
  }
  
  /* Flèches de navigation plus petites et partiellement superposées */
  .nav-arrow {
    width: 36px;
    min-width: 36px;
    margin: 0 -8px; /* Superposition partielle */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-width: 1px;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  }
  
  .nav-arrow:hover {
    transform: scale(1.05);
  }
  
  .nav-arrow svg {
    width: 18px;
    height: 18px;
  }
  
  /* Conteneur des slides plus large */
  .slides-container {
    border-radius: 12px;
    margin: 0 -2px;
  }
  
  /* Réduction des paddings des slides */
  .slide {
    padding: 5px;
  }
  
  /* Carte légèrement réduite pour compenser */
  .choice-card {
    border-radius: 10px;
  }
  
  .card-visual {
    aspect-ratio: 4 / 3;
  }
  
  /* Réduction de l'espace du texte en bas */
  .card-info {
    padding: 8px 12px;
  }
  
  .card-info p {
    font-size: 0.8rem;
    line-height: 1.2;
  }
  
  /* Boutons d'action plus petits */
  .card-actions {
    top: 6px;
    right: 6px;
    gap: 5px;
  }
  
  .card-actions .action-btn {
    width: 28px;
    height: 28px;
  }
  
  /* Pagination plus compacte */
  .image-pagination {
    bottom: 5px !important;
    padding: 3px 10px !important;
    font-size: 0.7rem !important;
  }
}

@media (max-width: 480px) {
  /* Optimisations pour très petits écrans */
  .nav-arrow {
    width: 32px;
    min-width: 32px;
    margin: 0 -10px; /* Superposition plus importante */
  }
  
  .nav-arrow svg {
    width: 16px;
    height: 16px;
  }
  
  .slide {
    padding: 3px;
  }
  
  .card-info {
    padding: 6px 8px;
  }
  
  .card-info p {
    font-size: 0.75rem;
  }
  
  .card-actions .action-btn {
    width: 26px;
    height: 26px;
  }
  
  /* Réduction des marges du conteneur principal */
  .main-content {
    padding: 5px 2px 12px !important;
    border-radius: 10px;
  }
  
  /* Le bloc legal-reference plus compact */
  .legal-reference {
    margin: 0 auto 5px auto;
    padding: 3px 5px;
  }
}

/* Pour les très petits écrans en orientation portrait */
@media (max-width: 360px) {
  .nav-arrow {
    width: 28px;
    min-width: 28px;
    margin: 0 -12px;
  }
  
  .nav-arrow svg {
    width: 14px;
    height: 14px;
  }
  
  .card-info p {
    font-size: 0.7rem;
  }
}

/* Ajustement pour éviter que les flèches ne cachent trop l'image */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
  /* Sur mobile tactile, les flèches sont plus accessibles */
  .nav-arrow {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #9F9FA9;
    opacity: 0.9;
  }
  
  .nav-arrow:active {
    background: #9F9FA9;
    color: white;
  }
}