/* downloads.css - Light Theme with Search */
:root {
  --primary-color: #2563eb;
  --primary-light: #dbeafe;
  --secondary-color: #64748b;
  --background-color: #ffffff;
  --surface-color: #f8fafc;
  --border-color: #e2e8f0;
  --text-color: #1e293b;
  --text-light: #64748b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 6px rgba(0, 0, 0, 0.1);
  --border-radius: 8px;
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  
  padding: 0;
  background-color: #f1f5f9;
  color: var(--text-color);
  min-height: 100vh;
  padding: 40px 20px;
  line-height: 1.6;
}

/* --- Base RTL Support --- */
[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--background-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.header {
  background: var(--background-color);
  color: var(--text-color);
  padding: 40px 30px 30px;
  /* border-bottom: 1px solid var(--border-color); */
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--primary-color);
}

.header h1::before {
  content: '📥';
  font-size: 1.8rem;
}

.header p {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 400;
}

.search-section {
  padding: 0 30px 30px;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
}

.search-container {
  position: relative;
  max-width: 500px;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 45px; /* Default LTR padding */
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  background: var(--background-color);
  transition: var(--transition);
  box-shadow: var(--shadow);
}

/* RTL override for search input */
[dir="rtl"] .search-input {
  padding: 12px 45px 12px 16px;
}


.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-icon {
  position: absolute;
  right: 16px; /* Default LTR position */
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

/* RTL override for search icon */
[dir="rtl"] .search-icon {
  right: auto;
  left: 16px;
}

.content {
  padding: 30px;
}

.file-counter {
  background: var(--surface-color);
  padding: 16px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 24px;
  border-left: 4px solid var(--primary-color); /* Default LTR border */
  border-right: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* RTL override for file counter border */
[dir="rtl"] .file-counter {
  border-left: none;
  border-right: 4px solid var(--primary-color);
}

.file-counter .count {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 1.1em;
  margin: 0 4px;
}

.file-counter .file-info {
  color: var(--text-light);
  font-size: 0.9rem;
}

.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.download-item {
  display: flex;
  align-items: center;
  padding: 5px;
  background: var(--background-color);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  position: relative;
}

.download-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.file-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px; /* Default LTR margin */
  margin-left: 0;
  flex-shrink: 0;
  color: var(--primary-color);
  font-size: 1.2rem;
}

/* RTL override for file icon margin */
[dir="rtl"] .file-icon {
  margin-right: 0;
  margin-left: 16px;
}

/* --- NEW Font Awesome Icon Styles --- */
.file-icon i {
  font-size: 1.6rem;
  color: var(--primary-color);
}


.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--text-color);
  word-break: break-word;
}

.file-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  gap: 12px;
}

.file-type {
  background: var(--surface-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.download-link {
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin-left: 10px; /* Default LTR margin */
  margin-right: 0;
}

/* RTL override for download link margin */
[dir="rtl"] .download-link {
  margin-left: 10px;
  margin-right: auto;
}

.download-link:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  color: white;
}

.empty-state {
  text-align: center;
  padding: 60px 30px;
  color: var(--text-light);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--text-color);
}

.no-results {
  text-align: center;
  padding: 40px 30px;
  color: var(--text-light);
  display: none;
}

.no-results .icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  background: var(--surface-color);
}

/* --- REMOVED Old File type icons --- */
/* .download-item[data-file-type="pdf"] .file-icon::before { ... }
... all other ::before rules are removed ...
*/

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 20px 10px;
  }
  
  .header {
    padding: 30px 20px 20px;
  }
  
  .header h1 {
    font-size: 1.75rem;
  }
  
  .search-section {
    padding: 0 20px 20px;
  }
  
  .content {
    padding: 20px;
  }
  
  .download-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .file-icon {
    margin-right: 0; /* LTR reset */
    margin-left: 0; /* RTL reset */
  }
  
  .file-info {
    width: 100%;
  }
  
  .download-link {
    align-self: stretch;
    justify-content: center;
    margin-left: 0; /* LTR reset */
    margin-right: 0; /* RTL reset */
  }
  
  .file-meta {
    flex-direction: column;
    gap: 4px;
  }
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.download-item {
  animation: fadeIn 0.3s ease forwards;
}

/* Hidden state for search filtering */
.download-item.hidden {
  display: none;
}