:root {
  --primary-color: #2980b9;
  --secondary-color: #2c3e50;
  --background-color: #f4f4f4;
  --card-color: #fff;
  --text-color: #333;
  --muted-color: #555;
  --error-color: #e74c3c;
  --success-color: #2ecc71;
  --border-radius: 8px;
  --box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  --transition: all 0.3s ease;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--background-color);
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--text-color);
  line-height: 1.6;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
  color: var(--secondary-color);
  margin-bottom: 10px;
  font-weight: 600;
}

.subtitle {
  color: var(--muted-color);
  font-size: 1.1em;
}

.loading {
  text-align: center;
  padding: 30px;
  background: var(--card-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin: 20px 0;
}

.spinner {
  border: 5px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 5px solid var(--primary-color);
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.error-message {
  color: var(--error-color);
  background: rgba(231, 76, 60, 0.1);
  padding: 15px;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--error-color);
}

.error-message button {
  background: var(--error-color);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: var(--border-radius);
  margin-top: 10px;
  cursor: pointer;
}

.error-message button:hover {
  background: #c0392b;
}

.stats-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.stat-card {
  background: var(--card-color);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  flex: 1;
  min-width: 150px;
  text-align: center;
}

.stat-value {
  font-size: 1.8em;
  font-weight: bold;
  color: var(--primary-color);
  margin: 5px 0;
}

.stat-label {
  font-size: 0.9em;
  color: var(--muted-color);
}

.search-container {
  margin-bottom: 25px;
}

#search {
  width: 100%;
  padding: 12px 20px;
  border: 2px solid #ddd;
  border-radius: 30px;
  font-size: 16px;
  transition: border-color 0.3s;
}

#search:focus {
  outline: none;
  border-color: var(--primary-color);
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.sort-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

#sort, #items-per-page {
  padding: 10px 15px;
  border-radius: var(--border-radius);
  border: 1px solid #ddd;
  background: white;
  font-size: 14px;
  cursor: pointer;
}

#sort:focus, #items-per-page:focus {
  outline: none;
  border-color: var(--primary-color);
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.file-item {
  background: var(--card-color);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.file-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.file-link {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.file-link:hover {
  text-decoration: underline;
  color: var(--secondary-color);
}

.file-icon {
  font-size: 24px;
  width: 30px;
  text-align: center;
}

.file-name {
  word-break: break-word;
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted-color);
  font-size: 0.9em;
  border-top: 1px solid #eee;
  padding-top: 12px;
}

.file-details span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 30px;
  gap: 10px;
}

.pagination-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-button {
  padding: 8px 15px;
  border: 1px solid #ddd;
  background: white;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
}

.pagination-button:hover:not(.active):not(:disabled) {
  background: #f0f0f0;
}

.pagination-button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--muted-color);
  font-size: 0.9em;
}

.pagination-ellipsis {
  display: flex;
  align-items: center;
  padding: 0 10px;
}

footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  color: var(--muted-color);
}

.build-info {
  font-size: 0.9em;
  margin-top: 10px;
}

/* 👇 BOTÃO DOWNLOAD 👇 */
.download-btn {
  padding: 8px 15px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: opacity 0.2s;
}

.download-btn:hover {
  opacity: 0.9;
}

.file-actions {
  text-align: center;
}

.download-btn {
  display: inline-block;
}
/* 👆 BOTÃO DOWNLOAD 👆 */

/* ##################### */

/* 👇 REDES SOCIAIS 👇 */

/* Social links */
.social-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.social-link {
  color: var(--text-color);
  font-size: 1.5rem;
  transition: color 0.3s;
}

.social-link:hover {
  color: var(--primary-color);
}

.whatsapp:hover { color: #25D366; }
.telegram:hover { color: #0088cc; }
.facebook:hover { color: #1877f2; }
.instagram:hover { color: #E1306C; }
.twitter:hover { color: #1DA1F2; }
.x:hover{ color: #FC6D26; background-color: rgba(252, 109, 38, 0.1); }
.threads { color: #D44638; background-color: rgba(212, 70, 56, 0.1); }
.tiktok:hover { color: #000000; background-color: rgba(0, 0, 0, 0.1); }
.linkedin:hover { color: #0077B5; background-color: rgba(0, 119, 181, 0.1); }
.kwai:hover { color: #FF6600; background-color: rgba(255, 102, 0, 0.1); }
.email:hover { color: #D44638; background-color: rgba(212, 70, 56, 0.1); }
.github:hover { color: #181717; background-color: rgba(24, 23, 23, 0.1); }
.gitlab:hover { color: #FC6D26; background-color: rgba(252, 109, 38, 0.1); }

/* 👆 REDES SOCIAIS 👆 */

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

  ul {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .sort-container {
    width: 100%;
  }

  #sort, #items-per-page {
    width: 100%;
  }

/* 👇 BOTÃO DOWNLOAD 👇 */
  .download-btn {
    width: 100%;
    justify-content: center;
  }
/* 👆 BOTÃO DOWNLOAD 👆 */

  .pagination-controls {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
    justify-content: flex-start;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.file-item {
  animation: fadeIn 0.3s ease-out forwards;
  opacity: 0;
}

.file-item:nth-child(1) { animation-delay: 0.1s; }
.file-item:nth-child(2) { animation-delay: 0.2s; }
.file-item:nth-child(3) { animation-delay: 0.3s; }
.file-item:nth-child(4) { animation-delay: 0.4s; }
.file-item:nth-child(5) { animation-delay: 0.5s; }
.file-item:nth-child(6) { animation-delay: 0.6s; }
.file-item:nth-child(7) { animation-delay: 0.7s; }
.file-item:nth-child(8) { animation-delay: 0.8s; }
.file-item:nth-child(9) { animation-delay: 0.9s; }
.file-item:nth-child(10) { animation-delay: 1.0s; }

/* Dark mode via classe .dark */
.dark {
  --primary-color: #3498db;
  --secondary-color: #ecf0f1;
  --background-color: #121212;
  --card-color: #1e1e1e;
  --text-color: #e0e0e0;
  --muted-color: #b0b0b0;
}

.dark #search,
.dark #sort,
.dark #items-per-page,
.dark .pagination-button {
  background: #2d2d2d;
  color: #e0e0e0;
  border-color: #444;
}

.dark .file-details {
  border-top-color: #444;
}

.dark footer {
  border-top-color: #444;
}