/* ==================================== */
/* COLPOSCOPIE - STYLES SPECIFIQUES     */
/* ==================================== */

/* Styles partages et multi-view.css : <link> de colposcopie.html, avant cette feuille (PERF-05) */

/* Zéro persistance : un « tirer pour rafraîchir » effacerait la saisie en cours (REG-05, D3) */
html {
  overscroll-behavior-y: contain;
}

/* ==================================== */
/* COLPOSCOPIE - Variables specifiques  */
/* ==================================== */
:root {
  /* Zone de transformation */
  --zt-fill: rgba(200, 180, 160, 0.2);
  --zt-stroke: #A0896D;
  --guide-stroke: rgba(100, 100, 100, 0.15);
  --guide-label: #666666;
}
.control-group input[type="number"] {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--border-radius-pill);
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.control-group input[type="number"]:hover {
  border-color: var(--accent-primary);
}

.control-group input[type="number"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.15);
}

#lesion-clock-form,
#add-biopsy-mode,
#add-traitement-mode {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#lesion-clock-form > .control-group,
#add-biopsy-mode > .control-group,
#add-traitement-mode > .control-group {
  margin-bottom: 0;
}

#add-lesion-mode .control-group label,
#add-biopsy-mode .control-group label,
#add-traitement-mode .control-group label {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Paire de champs cote a cote dans la sidebar */
#lesion-clock-form .form-row-pair {
  display: flex;
  gap: 12px;
}

#lesion-clock-form .form-row-pair > .control-group {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

/* Le multi-select-dropdown utilise position:absolute pour son menu.
   Deux ancetres ont overflow:hidden qui le cliperaient :
   - .edit-group (shared/css/forms.css)
   - .item-list (shared/css/components.css) -> recoit l'override via #lesion-list
   On leve la contrainte uniquement la ou un dropdown peut apparaitre, sans
   toucher au shared CSS reutilise par d'autres apps. */
.accordion-item-content .edit-group:has(.multi-select-dropdown) {
  overflow: visible;
}

#lesion-list {
  overflow: visible;
}

/* Position en mode dessin libre : le shared/css/forms.css style .position-info
   uniquement dans .edit-row .edit-control. Ici la position est posee dans une
   .edit-group (cf. createLesionBody pour positionMode === 'drawn'), donc on
   l'aligne sur le look des inputs du mode clock pour eviter le contraste de
   police vs. les selects "De / A / Rayon int. / Rayon ext.". */
.accordion-item-content .edit-group > .position-info {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.4;
  box-sizing: border-box;
}

/* Boutons des panneaux d'ajout : styles fournis par shared/css/forms.css
   (.add-mode .btn-row et .btn-pill). */

/* Titre h1 de la page (SEO-07) : hors écran visuellement, mais lu par les aides
   techniques dans tous les états de la barre latérale. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ==================================== */
/* ITEM LIST (override shared gap)      */
/* ==================================== */
.item-list {
  gap: 8px;
}

/* ==================================== */
/* SVG CONTAINER                        */
/* ==================================== */
.svg-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

#main-svg {
  background: var(--bg-canvas);
  width: 100%;
  height: 100%;
  max-width: 600px;
  max-height: 600px;
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Les gestes tactiles sur le schema vont aux lesions et aux biopsies : sans
     cela, page zoomee, le navigateur fait defiler le viewport et coupe le
     glisser (pointercancel). Le zoom par pincement reste possible hors du schema. */
  touch-action: none;
}

/* svg user-select now in shared/layout.css */

/* ==================================== */
/* SVG COLPOSCOPIE SPECIFIQUE           */
/* ==================================== */

/* Guides horaires */
.clock-guide {
  stroke: var(--guide-stroke);
  stroke-width: 1;
  pointer-events: none;
}

.clock-guide.primary {
  stroke-width: 1.5;
  stroke: rgba(100, 100, 100, 0.25);
}

.clock-label {
  font-size: 12px;
  fill: var(--guide-label);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  font-weight: 500;
}

.clock-label.primary {
  font-weight: 600;
  fill: var(--text-secondary);
}

/* Lesions */
.lesion-group {
  cursor: pointer;
}

.lesion-shape {
  stroke-width: 2;
  transition: opacity var(--transition-fast);
}

.lesion-shape:hover {
  opacity: 0.8;
}

.lesion-group.selected .lesion-shape {
  stroke-width: 3;
  stroke-dasharray: none;
}

/* Biopsies */
.biopsy-marker {
  cursor: pointer;
}

.biopsy-circle {
  fill: white;
  stroke: var(--accent-danger);
  stroke-width: 2;
  transition: all var(--transition-fast);
}

.biopsy-marker:hover .biopsy-circle {
  stroke-width: 3;
}

.biopsy-marker.selected .biopsy-circle {
  fill: var(--accent-danger);
}

.biopsy-label {
  font-size: 10px;
  font-weight: 700;
  fill: var(--accent-danger);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.biopsy-marker.selected .biopsy-label {
  fill: white;
}

/* Photo overlay */
.photo-overlay {
  pointer-events: none;
}

/* ==================================== */
/* VIEW FILTERS (CSS Effects)           */
/* ==================================== */

.view-acetic #layer-background {
  filter: contrast(1.2) brightness(1.1);
}

.view-lugol #layer-background {
  filter: sepia(0.3) contrast(1.1);
}

/* ==================================== */
/* RESOURCES SECTION (push to bottom)   */
/* ==================================== */
.resources-section {
  margin-top: auto;
}

/* ==================================== */
/* HELP SECTION - LEGENDE IFCPC         */
/* ==================================== */

.help-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Pastilles de la légende IFCPC de l'aide (SEC-10 : plus de style en ligne) */
.legend-color--normal { background: #4CAF50; }
.legend-color--grade1 { background: #FFA726; }
.legend-color--grade2 { background: #EF5350; }
.legend-color--invasion { background: #D32F2F; }

/* ==================================== */
/* LESION STYLES                        */
/* ==================================== */

/* Handles de lesion (drag/resize) */
.lesion-handles {
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.lesion-group.selected .lesion-handles {
  opacity: 1;
}

.lesion-handle {
  fill: white;
  stroke: var(--accent-primary);
  stroke-width: 2;
  cursor: grab;
  transition: all var(--transition-fast);
}

.lesion-handle:hover {
  transform-origin: center;
  fill: var(--accent-primary);
}

.lesion-handle:active {
  cursor: grabbing;
  fill: var(--accent-primary);
}

.lesion-handle.handle-move {
  cursor: move;
}

.lesion-handle.handle-resize {
  cursor: nwse-resize;
}

.lesion-handle.handle-radius {
  cursor: ns-resize;
  stroke: var(--accent-secondary, #7b1fa2);
}

.lesion-handle.handle-radius:hover {
  fill: var(--accent-secondary, #7b1fa2);
}

/* Preview pendant le dessin */
.lesion-preview {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0.7;
}

/* Pattern overlay */
.lesion-pattern-overlay {
  pointer-events: none;
}

/* ==================================== */
/* LESION LIST (Colposcopie-specific)   */
/* ==================================== */
/* Base styles from shared/css/components.css (.accordion-item, etc.) */

/* Bouton d'en-tete (lesions, biopsies, traitements) : occupe l'en-tete a cote du
   point de couleur, sans l'apparence d'un bouton. */
.accordion-item-toggle,
.traitement-item-toggle {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.accordion-item-toggle {
  gap: 4px;
}

.traitement-item-toggle {
  gap: 8px;
}

.accordion-item-toggle:focus-visible,
.traitement-item-toggle:focus-visible,
.item-color-dot:focus-visible {
  outline: 2px solid var(--accent-primary-hover);
  outline-offset: 2px;
}

/* ==================================== */
/* DRAWING MODE CURSOR                  */
/* ==================================== */
#main-svg.drawing-mode {
  cursor: crosshair;
}

#main-svg.drawing-mode .lesion-shape,
#main-svg.drawing-mode .lesion-handle,
#main-svg.drawing-mode .biopsy-marker {
  pointer-events: none;
}

/* ==================================== */
/* BIOPSY MARKERS SVG                   */
/* ==================================== */
.biopsy-marker {
  cursor: pointer;
  transition: transform var(--transition-fast);
  transform-box: fill-box;
  transform-origin: center;
}

.biopsy-marker:hover {
  transform: scale(1.1);
}

.biopsy-marker.selected circle {
  stroke: var(--accent-primary);
  stroke-width: 3;
}

/* ==================================== */
/* BIOPSY LIST ITEMS (extends accordion)*/
/* ==================================== */


.biopsy-result-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--border-radius-pill);
  font-size: 9px;
  font-weight: 600;
}

.biopsy-result-badge.pending {
  background: #E0E0E0;
  color: #616161;
}

.biopsy-result-badge.normal {
  background: #E8F5E9;
  color: #2E7D32;
}

.biopsy-result-badge.cin1 {
  background: #FFF8E1;
  color: #F57F17;
}

.biopsy-result-badge.cin2 {
  background: #FFE0B2;
  color: #E65100;
}

.biopsy-result-badge.cin3,
.biopsy-result-badge.ais {
  background: #FFEBEE;
  color: #C62828;
}

.biopsy-result-badge.carcinome {
  background: #FFCDD2;
  color: #B71C1C;
}

.biopsy-result-badge.adenocarcinome {
  background: #F3E5F5;
  color: #7B1FA2;
}


/* btn-delete-biopsy styles moved to shared/css/components.css as .btn-delete-full */

/* Add mode cursor for biopsies */
#main-svg.biopsy-add-mode {
  cursor: crosshair;
}


/* ==================================== */
/* TRAITEMENT STYLES                    */
/* ==================================== */

/* Traitement zone (drawn path) */
.traitement-zone {
  fill-opacity: 0.25;
  stroke-width: 2;
  stroke-dasharray: 6, 3;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.traitement-zone:hover {
  fill-opacity: 0.35;
}

.traitement-zone.selected {
  stroke-width: 3;
  fill-opacity: 0.4;
}

/* Traitement type colors */
.traitement-zone.type-laser {
  fill: #FF6B6B;
  stroke: #E63946;
}

.traitement-zone.type-leep {
  fill: #4ECDC4;
  stroke: #2A9D8F;
}

.traitement-zone.type-cryo {
  fill: #74B9FF;
  stroke: #0984E3;
}

.traitement-zone.type-conisation {
  fill: #FDCB6E;
  stroke: #F39C12;
}

/* Traitement list items (sidebar) */
.traitement-item {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.traitement-item:hover {
  border-color: var(--border-medium);
}

.traitement-item.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(217, 119, 87, 0.1);
}

.traitement-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.traitement-item-header:hover {
  background: var(--bg-sidebar-hover);
}

.traitement-type-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.traitement-type-icon.type-laser {
  background: #FF6B6B;
}

.traitement-type-icon.type-leep {
  background: #4ECDC4;
}

.traitement-type-icon.type-cryo {
  background: #74B9FF;
}

.traitement-type-icon.type-conisation {
  background: #FDCB6E;
}

.traitement-item-label {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}

/* btn-delete-traitement styles moved to shared/css/components.css as .btn-delete-icon */

/* Add mode cursor for traitements */
#main-svg.traitement-add-mode {
  cursor: crosshair;
}

/* ==================================== */
/* TRAITEMENT BRUSH MODE                 */
/* ==================================== */

/* Hide cursor when in brush mode */
.svg-container.traitement-brush-mode {
  cursor: none;
}

/* Brush cursor (follows mouse) */
.brush-cursor {
  position: fixed;
  pointer-events: none;
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  opacity: 0.8;
}

.brush-cursor.active {
  background: var(--accent-primary);
  opacity: 0.3;
}

/* ==================================== */
/* TRAITEMENT ZONES (SVG)                */
/* ==================================== */

.traitement-zone {
  cursor: pointer;
  transition: opacity 0.2s, filter 0.2s;
}

.traitement-zone:hover {
  opacity: 0.9;
}

.traitement-zone.selected {
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.3));
}

.traitement-zone.highlight {
  animation: traitement-pulse 0.75s ease-out 2;
}

@keyframes traitement-pulse {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 8px var(--accent-primary)); }
}

/* Type-specific base colors */
.traitement-zone.type-laser path,
.traitement-zone.type-laser circle {
  fill: #FF6B6B;
  fill-opacity: 0.4;
  stroke: #E63946;
  stroke-width: 2;
}

.traitement-zone.type-leep path,
.traitement-zone.type-leep circle {
  fill: #4ECDC4;
  fill-opacity: 0.4;
  stroke: #2A9D8F;
  stroke-width: 2;
}

.traitement-zone.type-cryo path,
.traitement-zone.type-cryo circle {
  fill: #74B9FF;
  fill-opacity: 0.4;
  stroke: #0984E3;
  stroke-width: 2;
}

.traitement-zone.type-conisation path,
.traitement-zone.type-conisation circle {
  fill: #FDCB6E;
  fill-opacity: 0.4;
  stroke: #F39C12;
  stroke-width: 2;
}

/* Center marker for LEEP/conisation */
.traitement-center-marker {
  cursor: move;
  transition: r 0.2s;
}

.traitement-center-marker:hover {
  r: 6;
}

/* Brush strokes */
.traitement-stroke {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Poignee de redimensionnement (mode centered) */
.centered-resize-handle {
  opacity: 0;
  transition: opacity 0.15s ease;
}

#centered-preview:hover .centered-resize-handle {
  opacity: 1;
}

#centered-preview.dragging .centered-resize-handle {
  opacity: 1;
}

/* ==================================== */
/* TRAITEMENT SIDEBAR CONTROLS           */
/* ==================================== */

/* Input small for numbers */
.input-small {
  width: 80px !important;
  padding: 6px 8px;
  font-size: 11px;
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
}

/* Slider row for brush size */
.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-row input[type="range"] {
  flex: 1;
}

.slider-row span {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 40px;
}

/* Centered controls layout */
#traitement-centered-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

#traitement-centered-controls .control-group {
  flex: 1;
}

/* ==================================== */
/* SESSION CARDS (Rapport Panel)         */
/* ==================================== */

.session-card {
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  background: var(--bg-card);
  overflow: hidden;
}

.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-sidebar-hover);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.session-header:hover {
  background: var(--bg-sidebar-active);
}

.session-date {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.session-count {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: auto;
}

.session-controls {
  display: flex;
  gap: 4px;
}

.session-content {
  padding: 12px;
}

.session-card.collapsed .session-content {
  display: none;
}

.session-card.collapsed .session-header .btn-card {
  transform: rotate(-90deg);
}

/* Parameters section in card */
.traitement-parameters {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
}

/* Follow-up subsection */
.traitement-followup {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-sidebar-hover);
  border-radius: var(--border-radius-md);
}

.traitement-followup h5 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Type-specific badge colors */
.card-badge.type-laser {
  background: #FF6B6B;
  color: white;
}

.card-badge.type-leep {
  background: #4ECDC4;
  color: white;
}

.card-badge.type-cryo {
  background: #74B9FF;
  color: white;
}

.card-badge.type-conisation {
  background: #FDCB6E;
  color: #333;
}

/* ==================================== */
/* PANEL OVERRIDES (Colposcopie)        */
/* ==================================== */

#panel-rapport {
  background: var(--bg-canvas);
  overflow-y: auto;
}

/* ==================================== */
/* RESPONSIVE - TABLET (768px)          */
/* ==================================== */
@media (max-width: 768px) {
  .main-area {
    width: 100%;
  }

  #main-svg {
    max-width: 100%;
    max-height: calc(100vh - 120px);
  }
}

/* ==================================== */
/* VIEW BADGE (Col / Vagin)             */
/* ==================================== */
.view-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.view-badge-col {
  background: #E3F2FD;
  color: #1565C0;
}
.view-badge-vagin {
  background: #FCE4EC;
  color: #AD1457;
}
