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

/* Variables */
:root {
  --primary-color: #4361ee;
  --primary-dark: #3a56d4;
  --secondary-color: #4cc9f0;
  --accent-color: #f72585;
  --light-bg: #f8f9fa;
  --dark-bg: #121212;
  --dark-card: #1e1e1e;
  --dark-hover: #2d2d2d;
  --light-text: #f8f9fa;
  --dark-text: #333;
  --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  --hover-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  --border-radius: 12px;
  --transition-speed: 0.3s;

  /* Nouvelles variables */
  --gradient-primary: linear-gradient(135deg, #4361ee, #4cc9f0);
  --gradient-accent: linear-gradient(135deg, #f72585, #7209b7);
  --gradient-dark: linear-gradient(135deg, #3a0ca3, #4361ee);
  --card-bg-light: #ffffff;
  --card-bg-dark: #1e1e1e;
  --tab-bg-light: #f1f3f5;
  --tab-bg-dark: #2a2a2a;
  --file-bg-light: #f9f9f9;
  --file-bg-dark: #2a2a2a;
  --file-hover-light: #f0f0f0;
  --file-hover-dark: #333333;
}

/* Body styling */
body {
  font-family: "Poppins", sans-serif;
  background-color: var(--light-bg);
  color: var(--dark-text);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  line-height: 1.6;
  background-image: radial-gradient(circle at 25% 10%, rgba(67, 97, 238, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(76, 201, 240, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
}

body.dark {
  background-color: var(--dark-bg);
  color: var(--light-text);
  background-image: radial-gradient(circle at 25% 10%, rgba(67, 97, 238, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(76, 201, 240, 0.1) 0%, transparent 50%);
}

.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 20px 0;
}

/* Header Styling */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--gradient-primary);
  padding: 20px 5%;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.logo::before {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  z-index: -1;
  animation: pulse-logo 3s infinite ease-in-out;
}

@keyframes pulse-logo {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.2;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.1;
  }
}

.logo i {
  font-size: 28px;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.logo h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

#darkModeToggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#darkModeToggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Search Bar Styling */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 15px;
  color: #888;
  font-size: 16px;
  z-index: 1;
  transition: color 0.3s ease;
}

input {
  width: 300px;
  padding: 12px 15px 12px 45px;
  border-radius: 25px;
  border: none;
  font-size: 16px;
  background-color: rgba(255, 255, 255, 0.9);
  transition: all var(--transition-speed) ease;
  font-family: "Poppins", sans-serif;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

input:focus {
  outline: none;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
  width: 320px;
  background-color: rgba(255, 255, 255, 1);
}

input:focus + .search-icon {
  color: var(--primary-color);
}

input::placeholder {
  font-size: 14px;
  color: #888;
  transition: opacity 0.3s ease;
}

input:focus::placeholder {
  opacity: 0.7;
}

.clear-search-btn {
  position: absolute;
  right: 15px;
  background: none;
  border: none;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  display: none;
  z-index: 1;
  transition: color 0.3s ease, transform 0.3s ease;
}

.clear-search-btn:hover {
  color: #333;
  transform: scale(1.1);
}

/* Container and category section */
.container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 30px;
  padding: 30px 5%;
  max-width: 1400px;
  margin: 0 auto;
}

.category {
  width: calc(50% - 15px); /* 50% width minus half the gap */
  background-color: var(--card-bg-light);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  position: relative;
}

.category::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.05), rgba(76, 201, 240, 0.05));
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 0;
}

.category:hover::before {
  opacity: 1;
}

body.dark .category {
  background-color: var(--card-bg-dark);
}

.category:hover {
  transform: translateY(-5px);
  box-shadow: var(--hover-shadow);
}

.category-header {
  background: var(--gradient-primary);
  color: white;
  text-align: center;
  padding: 25px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  position: relative;
  overflow: hidden;
}

.category-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.category:hover .category-header::before {
  opacity: 1;
}

.category-icon {
  font-size: 28px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 1px;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Subcategory tabs */
.subcategory-tabs {
  display: flex;
  background-color: var(--tab-bg-light);
  border-bottom: 1px solid #e9ecef;
  width: 100%;
  position: relative;
  z-index: 1;
}

body.dark .subcategory-tabs {
  background-color: var(--tab-bg-dark);
  border-bottom: 1px solid #444;
}

.tab-btn {
  flex: 1;
  padding: 15px 10px;
  background: none;
  border: none;
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}

.tab-btn::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--gradient-primary);
  transition: width 0.3s ease, left 0.3s ease;
  z-index: 1;
}

.tab-btn:hover::before {
  width: 100%;
  left: 0;
}

body.dark .tab-btn {
  color: #aaa;
}

.tab-btn.active {
  color: var(--primary-color);
  background-color: rgba(67, 97, 238, 0.05);
}

.tab-btn.active::before {
  width: 100%;
  left: 0;
}

body.dark .tab-btn.active {
  color: var(--secondary-color);
  background-color: rgba(76, 201, 240, 0.05);
}

.tab-btn:hover:not(.active) {
  color: var(--primary-dark);
  background-color: rgba(67, 97, 238, 0.03);
}

body.dark .tab-btn:hover:not(.active) {
  color: var(--secondary-color);
  background-color: rgba(76, 201, 240, 0.03);
}

.result-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.result-count.visible {
  opacity: 1;
  transform: scale(1);
}

.files-container {
  padding: 0;
  min-height: 300px; /* Ensure minimum height for better visual balance */
  position: relative;
}

.subcategory-content {
  display: none;
  padding: 15px;
}

.subcategory-content.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

/* Empty category styling */
.empty-category {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  color: #aaa;
  text-align: center;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.02), rgba(76, 201, 240, 0.02));
  border-radius: var(--border-radius);
  margin: 10px 0;
}

.empty-category i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
  animation: float 3s infinite ease-in-out;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.empty-category p {
  font-size: 18px;
  font-weight: 500;
}

/* Styling for file items */
.file {
  display: flex;
  align-items: center;
  padding: 20px;
  margin-bottom: 15px;
  border-radius: var(--border-radius);
  background-color: var(--file-bg-light);
  transition: all var(--transition-speed) ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.file::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.file:hover::before {
  opacity: 1;
}

body.dark .file {
  background-color: var(--file-bg-dark);
}

.file:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
  background-color: var(--file-hover-light);
}

body.dark .file:hover {
  background-color: var(--file-hover-dark);
}

.file-icon {
  width: 50px;
  height: 50px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.file-icon::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.file:hover .file-icon::after {
  opacity: 1;
}

.file-icon i {
  font-size: 20px;
  color: white;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.file-info {
  flex: 1;
}

.file h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--primary-color);
  transition: color 0.3s ease;
}

.file:hover h3 {
  color: var(--primary-dark);
}

body.dark .file h3 {
  color: var(--secondary-color);
}

.file-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.file:hover .file-description {
  color: #444;
}

body.dark .file-description {
  color: #aaa;
}

body.dark .file:hover .file-description {
  color: #ccc;
}

/* File metadata */
.file-meta {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: #888;
}

.file-size {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: rgba(67, 97, 238, 0.1);
  padding: 3px 8px;
  border-radius: 12px;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.file:hover .file-size {
  background-color: rgba(67, 97, 238, 0.15);
  transform: scale(1.05);
}

body.dark .file-size {
  background-color: rgba(76, 201, 240, 0.1);
}

body.dark .file:hover .file-size {
  background-color: rgba(76, 201, 240, 0.15);
}

.file-size::before {
  content: "\f0a0"; /* fa-hdd icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

/* Links */
.download-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: white;
  font-weight: 500;
  background: var(--gradient-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.download-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.7s ease;
}

.download-link:hover::before {
  left: 100%;
}

.download-link:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.download-link i {
  font-size: 14px;
  transition: transform 0.3s ease;
}

.download-link:hover i {
  transform: translateY(-2px);
}

/* Search results info */
.search-results-info {
  background-color: rgba(67, 97, 238, 0.1);
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border-left: 3px solid var(--primary-color);
}

body.dark .search-results-info {
  background-color: rgba(76, 201, 240, 0.1);
  border-left: 3px solid var(--secondary-color);
}

.search-results-info .query {
  font-weight: 600;
}

.search-results-info .count {
  font-weight: 600;
}

.search-results-info .clear-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}

body.dark .search-results-info .clear-btn {
  color: var(--secondary-color);
}

.search-results-info .clear-btn:hover {
  transform: scale(1.05);
  text-decoration: underline;
}

/* Footer Styling */
footer {
  background: var(--gradient-primary);
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: auto;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.footer-note {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 5px;
}

/* Animations */
@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.category {
  animation: fadeIn 0.6s ease-out forwards;
}

.file {
  animation: slideInRight 0.5s ease-out forwards;
  opacity: 0;
}

.file:nth-child(1) {
  animation-delay: 0.1s;
}

.file:nth-child(2) {
  animation-delay: 0.2s;
}

.file:nth-child(3) {
  animation-delay: 0.3s;
}

.file:nth-child(4) {
  animation-delay: 0.4s;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .container {
    padding: 20px 4%;
  }
}

@media (max-width: 992px) {
  .category {
    width: 100%; /* Full width on medium screens */
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  input,
  input:focus {
    width: 100%;
  }

  .search-container {
    flex: 1;
    margin-right: 15px;
  }

  .file {
    flex-direction: column;
    text-align: center;
  }

  .file-icon {
    margin-right: 0;
    margin-bottom: 15px;
  }

  .tab-btn {
    padding: 12px 8px;
    font-size: 14px;
  }
}

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

  h2 {
    font-size: 20px;
  }

  .file h3 {
    font-size: 16px;
  }

  .tab-btn {
    padding: 10px 5px;
    font-size: 13px;
  }

  .result-count {
    min-width: 16px;
    height: 16px;
    font-size: 10px;
  }
}

/* Styles pour le message "Aucun résultat" */
.no-results {
  text-align: center;
  padding: 40px;
  color: #888;
  width: 100%;
  animation: fadeIn 0.5s ease;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.02), rgba(76, 201, 240, 0.02));
  border-radius: var(--border-radius);
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
}

.no-results i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
  animation: float 3s infinite ease-in-out;
}

/* Animation pour le bouton de mode sombre */
#darkModeToggle.clicked {
  animation: spin 0.3s ease;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Style pour la mise en évidence des résultats de recherche */
.search-match {
  animation: highlight 1s ease;
}

@keyframes highlight {
  0% {
    background-color: rgba(67, 97, 238, 0.3);
  }
  100% {
    background-color: inherit;
  }
}

/* Animation pour les badges de résultats */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.result-count.pulse {
  animation: pulse 0.5s ease;
}

/* Ajouter un style pour le message d'erreur */
.error-message {
  text-align: center;
  padding: 40px;
  background-color: rgba(231, 76, 60, 0.1);
  border-radius: 12px;
  margin: 20px auto;
  max-width: 600px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #e74c3c;
}

.error-message i {
  font-size: 48px;
  color: #e74c3c;
  margin-bottom: 15px;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-5px);
  }
  40%,
  80% {
    transform: translateX(5px);
  }
}

.error-message h3 {
  font-size: 24px;
  margin-bottom: 10px;
  color: #e74c3c;
}

.error-message p {
  font-size: 16px;
  color: #666;
}

body.dark .error-message {
  background-color: rgba(231, 76, 60, 0.2);
}

body.dark .error-message p {
  color: #aaa;
}

