/* CSS global pour la Visionneuse de Médias - Thème Premium Sombre */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #161e2e;
  --bg-tertiary: #1f2937;
  --bg-glass: rgba(22, 30, 46, 0.7);
  --border-glass: rgba(255, 255, 255, 0.08);
  
  --accent-color: #8b5cf6; /* Violet */
  --accent-hover: #a78bfa;
  --accent-indigo: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-cyan-hover: #22d3ee;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --transition-speed: 0.3s;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Utility classes */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

/* ----------------------------------------------------
   LAYOUT CONSOLE DE CONTROLE (index.html)
   ---------------------------------------------------- */

.app-container {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  padding: 16px;
  gap: 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.logo-section h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.main-content {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  min-height: 0; /* Important pour le scroll interne */
}

/* Sidebar List */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px;
}

.sidebar h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
}

.media-count {
  font-size: 0.8rem;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--accent-hover);
}

.media-list {
  list-style: none;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.media-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-speed);
  border: 1px solid transparent;
}

.media-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.media-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: rgba(139, 92, 246, 0.3);
}

.media-icon {
  font-size: 1.2rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-info {
  flex-grow: 1;
  min-width: 0; /* Permet le troncage */
}

.media-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-path {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Control Area */
.control-area {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  min-height: 0;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
  justify-content: center;
  align-items: center;
  position: relative;
}

.preview-container {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-container img, 
.preview-container video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-placeholder {
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 16px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

/* Control Buttons & Inputs */
button {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-speed);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover {
  background: var(--accent-color);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

button.primary {
  background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-color) 100%);
  border: none;
}

button.primary:hover {
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  filter: brightness(1.1);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-hover);
}

button.secondary:hover {
  background: rgba(139, 92, 246, 0.1);
}

button.active-toggle {
  background: var(--accent-cyan);
  color: #000;
  font-weight: bold;
}
button.active-toggle:hover {
  background: var(--accent-cyan-hover);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

select, input[type="number"], input[type="text"] {
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.9rem;
  transition: border-color var(--transition-speed);
}

select:focus, input:focus {
  border-color: var(--accent-color);
}

/* Playback Control Bar (Bottom) */
footer {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.playback-slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-display {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 90px;
}

.progress-bar-wrapper {
  position: relative;
  flex-grow: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  cursor: pointer;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-color));
  width: 0%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Custom inputs for start/end times */
.trim-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.trim-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.trim-input-group label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.trim-inputs input {
  width: 100%;
}

.playback-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.playback-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-slider {
  width: 100px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

/* ----------------------------------------------------
   FENÊTRE DE PRÉSENTATION (presentation.html)
   ---------------------------------------------------- */

.presentation-body {
  background-color: #000;
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  position: relative;
  cursor: none; /* Cache le curseur sur l'écran secondaire */
}

/* Layers de transition */
.media-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
  overflow: hidden;
  opacity: 0;
  z-index: 1;
  transition: transform 1s ease-in-out, opacity 1s ease-in-out;
}

.media-layer.active {
  opacity: 1;
  z-index: 2;
}

.media-layer img, 
.media-layer video {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Conserve le ratio d'aspect */
}

/* ----------------------------------------------------
   ANIMATIONS DE TRANSITIONS (CSS)
   ---------------------------------------------------- */

/* Transition: Aucune (None) */
.media-layer.transition-None {
  transition: none !important;
}

/* Transition: Fondu (Dissolve) - Déjà géré par opacité par défaut */
.media-layer.transition-Dissolve {
  transition: opacity 1s ease-in-out !important;
}

/* Transition: Glissement Gauche (Slide Left) */
/* Le nouveau média glisse de la droite vers la gauche */
.media-layer.slide-left-enter {
  transform: translateX(100%);
  opacity: 1;
}
.media-layer.slide-left-enter-active {
  transform: translateX(0%);
  opacity: 1;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1) !important;
}
.media-layer.slide-left-exit-active {
  transform: translateX(-100%);
  opacity: 0.5;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s !important;
}

/* Transition: Glissement Droite (Slide Right) */
/* Le nouveau média glisse de la gauche vers la droite */
.media-layer.slide-right-enter {
  transform: translateX(-100%);
  opacity: 1;
}
.media-layer.slide-right-enter-active {
  transform: translateX(0%);
  opacity: 1;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1) !important;
}
.media-layer.slide-right-exit-active {
  transform: translateX(100%);
  opacity: 0.5;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s !important;
}

/* Transition: Glissement Haut (Slide Up) */
/* Le nouveau média glisse du bas vers le haut */
.media-layer.slide-up-enter {
  transform: translateY(100%);
  opacity: 1;
}
.media-layer.slide-up-enter-active {
  transform: translateY(0%);
  opacity: 1;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1) !important;
}
.media-layer.slide-up-exit-active {
  transform: translateY(-100%);
  opacity: 0.5;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s !important;
}

/* Transition: Glissement Bas (Slide Down) */
/* Le nouveau média glisse du haut vers le bas */
.media-layer.slide-down-enter {
  transform: translateY(-100%);
  opacity: 1;
}
.media-layer.slide-down-enter-active {
  transform: translateY(0%);
  opacity: 1;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1) !important;
}
.media-layer.slide-down-exit-active {
  transform: translateY(100%);
  opacity: 0.5;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s !important;
}

/* Transition: Zoom Avant (Zoom In) */
/* Le nouveau média apparaît en s'agrandissant */
.media-layer.zoomin-enter {
  transform: scale(0.5);
  opacity: 0;
}
.media-layer.zoomin-enter-active {
  transform: scale(1);
  opacity: 1;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s ease-in-out !important;
}
.media-layer.zoomin-exit-active {
  transform: scale(1.5);
  opacity: 0;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s ease-in-out !important;
}

/* Transition: Zoom Arrière (Zoom Out) */
/* Le nouveau média apparaît en se rétrécissant */
.media-layer.zoomout-enter {
  transform: scale(1.5);
  opacity: 0;
}
.media-layer.zoomout-enter-active {
  transform: scale(1);
  opacity: 1;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s ease-in-out !important;
}
.media-layer.zoomout-exit-active {
  transform: scale(0.5);
  opacity: 0;
  transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 1s ease-in-out !important;
}

/* Transition: Rotation (Rotate) */
/* Rotation 3D stylisée */
.media-layer.rotate-enter {
  transform: rotate(180deg) scale(0.2);
  opacity: 0;
}
.media-layer.rotate-enter-active {
  transform: rotate(0deg) scale(1);
  opacity: 1;
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 1s ease-in-out !important;
}
.media-layer.rotate-exit-active {
  transform: rotate(-180deg) scale(0.2);
  opacity: 0;
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 1s ease-in-out !important;
}

/* Écran noir temporaire pour cacher la projection */
body.black-screen::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000000;
  z-index: 99999;
  pointer-events: none;
}

