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

/* Support RTL */
html[dir="rtl"] {
  text-align: right;
}

html[dir="rtl"] .search-input-container {
  flex-direction: row-reverse;
}

html[dir="rtl"] .search-options {
  justify-content: flex-end;
}

html[dir="rtl"] .language-selector {
  left: 20px;
  right: auto;
}

/* Sélecteur de langue */
.language-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.lang-toggle {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 25px;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  min-width: 140px;
  justify-content: space-between;
}

.lang-toggle:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.current-lang {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  min-width: 180px;
  z-index: 1001;
}

.lang-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s ease;
  font-size: 0.9rem;
}

.lang-option:hover {
  background-color: #f8f9fa;
}

.lang-option.active {
  background-color: #e3f2fd;
  color: #1976d2;
  font-weight: 600;
}

.lang-option .flag {
  font-size: 1.2rem;
}

.lang-option .name {
  font-weight: 500;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.logo i {
  font-size: 3rem;
  color: #ff4444;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
}

.main-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.search-section {
  margin-bottom: 30px;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-input-container {
  display: flex;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  background: white;
}

#searchQuery {
  flex: 1;
  padding: 18px 25px;
  border: none;
  font-size: 1.1rem;
  outline: none;
  background: transparent;
}

#searchQuery::placeholder {
  color: #999;
}

.search-btn {
  background: linear-gradient(135deg, #ff4444, #cc3333);
  border: none;
  padding: 18px 30px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-btn:hover {
  background: linear-gradient(135deg, #cc3333, #aa2222);
  transform: translateY(-1px);
}

.search-btn i {
  font-size: 1.2rem;
}

.search-options {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.search-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  color: #666;
  transition: color 0.3s ease;
}

.search-options label:hover {
  color: #333;
}

.search-options input[type="radio"] {
  accent-color: #ff4444;
}

.loading-spinner {
  text-align: center;
  padding: 40px;
  color: #666;
}

.loading-spinner i {
  font-size: 2rem;
  color: #ff4444;
  margin-bottom: 15px;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.video-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.video-thumbnail {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail img {
  transform: scale(1.05);
}

.video-duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.video-info {
  padding: 20px;
}

.video-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.4;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-size: 0.9rem;
  color: #666;
}

.video-views {
  display: flex;
  align-items: center;
  gap: 5px;
}

.video-date {
  font-size: 0.85rem;
}

.download-section {
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.download-btn {
  width: 100%;
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.download-btn:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: translateY(-1px);
}

.download-formats {
  margin-top: 10px;
  display: none;
}

.download-formats.show {
  display: block;
}

.format-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.format-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 0.9rem;
}

.format-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.format-quality {
  font-weight: 600;
  color: #333;
}

.format-type {
  color: #666;
  font-size: 0.8rem;
}

.download-format-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.3s ease;
}

.download-format-btn:hover {
  background: #0056b3;
}

.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  border-left: 4px solid #c62828;
}

.success-message {
  background: #e8f5e8;
  color: #2e7d32;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  border-left: 4px solid #2e7d32;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.no-results i {
  font-size: 4rem;
  color: #ddd;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .logo h1 {
    font-size: 2rem;
  }

  .main-content {
    padding: 25px;
    border-radius: 15px;
  }

  .search-results {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .search-options {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .search-input-container {
    border-radius: 12px;
  }

  #searchQuery {
    padding: 15px 20px;
    font-size: 1rem;
  }

  .search-btn {
    padding: 15px 25px;
  }
}

@media (max-width: 480px) {
  .video-card {
    border-radius: 12px;
  }

  .video-info {
    padding: 15px;
  }

  .video-title {
    font-size: 1rem;
  }
}
