:root {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --accent-color: #e74c3c;
  --background-color: #f8f9fa;
  --text-color: #333;
  --border-radius: 8px;
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
  --shadow-hover: 0 5px 20px rgba(0,0,0,0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem 0;
  text-align: center;
  box-shadow: var(--shadow);
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 300;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

header a {
  color: white;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

header a:hover {
  opacity: 1;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Video Controls */
.video-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.video-controls h2 {
  color: var(--secondary-color);
  font-weight: 400;
}

.controls-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), #2980b9);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d, #495057);
}

.btn-success {
  background: linear-gradient(135deg, #28a745, #218838);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-color), #c82333);
}

/* Video List */
.video-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Video Cards */
.video-card {
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  cursor: pointer;
  position: relative;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.video-card.selected {
  border: 3px solid var(--primary-color);
  transform: translateY(-3px);
}

.video-card.selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary-color);
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.video-thumbnail {
  width: 100%;
  height: 160px;
  background: linear-gradient(45deg, #eee, #ddd);
  background-size: cover;
  background-position: center;
  position: relative;
}

.video-thumbnail::after {
  content: '▶';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.7);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-card:hover .video-thumbnail::after {
  opacity: 1;
}

.video-info {
  padding: 1.5rem;
}

.video-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
  line-height: 1.4;
}

.video-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.video-description {
  font-size: 0.9rem;
  color: #777;
  line-height: 1.4;
}

/* Video Player Section */
.video-player-section {
  margin-bottom: 2rem;
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  margin-bottom: 1.5rem;
  background-color: #000;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-info-panel {
  background: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.video-info-panel h2 {
  color: var(--secondary-color);
  margin-bottom: 1rem;
  font-weight: 400;
}

/* Playlist Section */
.playlist-section {
  background: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.playlist-section h3 {
  color: var(--secondary-color);
  margin-bottom: 1rem;
  font-weight: 400;
}

.playlist-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.playlist-item:hover {
  background-color: #f8f9fa;
}

.playlist-item.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.playlist-number {
  width: 30px;
  height: 30px;
  background-color: var(--secondary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 1rem;
  font-size: 0.9rem;
}

.playlist-item.active .playlist-number {
  background-color: white;
  color: var(--primary-color);
}

.playlist-thumbnail {
  width: 60px;
  height: 34px;
  background: #ddd;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  margin-right: 1rem;
}

.playlist-info {
  flex: 1;
}

.playlist-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.playlist-duration {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.close {
  color: #aaa;
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover {
  color: var(--accent-color);
}

.selected-videos h3 {
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

.selected-videos ul {
  list-style: none;
  margin-bottom: 1.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.selected-videos li {
  padding: 0.5rem;
  background-color: #f8f9fa;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  border-left: 3px solid var(--primary-color);
}

/* Input fields */
input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.3s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Selection info */
.selection-info {
  background: linear-gradient(135deg, var(--primary-color), #2980b9);
  color: white;
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 500;
}

/* Footer */
footer {
  background-color: var(--secondary-color);
  color: white;
  text-align: center;
  padding: 2rem;
  margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .video-list {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }
  
  .video-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls-group {
    justify-content: center;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .playlist-item {
    flex-direction: column;
    text-align: center;
  }
  
  .playlist-number,
  .playlist-thumbnail {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 480px) {
  .video-list {
    grid-template-columns: 1fr;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .controls-group {
    flex-direction: column;
  }
}

/* Animation pour les cartes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.video-card {
  animation: fadeInUp 0.5s ease;
}

.video-card:nth-child(1) { animation-delay: 0.1s; }
.video-card:nth-child(2) { animation-delay: 0.2s; }
.video-card:nth-child(3) { animation-delay: 0.3s; }
.video-card:nth-child(4) { animation-delay: 0.4s; }
.video-card:nth-child(5) { animation-delay: 0.5s; }
.video-card:nth-child(6) { animation-delay: 0.6s; }

/* Loading state */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
