/**
 * Document Download Center Dedicated Stylesheet
 * CCT District 20 - Church of Christ in Thailand
 * Covers: documents.php (Page Title, Search & Filter Chips, Document Cards, Empty State)
 */

/* ==========================================================
   1. CONTROL PANEL, SEARCH & CATEGORY CHIPS
========================================================== */
.download-control-panel {
  background: #ffffff;
  border: 1px solid var(--church-border, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(18, 22, 52, 0.05);
  transition: box-shadow 0.25s ease;
}

.download-control-panel:focus-within {
  box-shadow: 0 6px 24px rgba(18, 22, 52, 0.09);
}

.download-search-wrapper {
  position: relative;
  width: 100%;
}

.download-search-icon {
  left: 14px;
  color: var(--church-text-muted, #64748b);
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 2;
}

.download-search-input {
  padding-left: 42px;
  padding-right: 40px;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--church-border, #e2e8f0);
  font-size: 0.95rem;
  color: var(--church-navy-dark, #121634);
  background-color: #ffffff;
  transition: all 0.2s ease-in-out;
}

.download-search-input:focus {
  border-color: var(--church-ocean-deep, #0b7294);
  box-shadow: 0 0 0 3.5px rgba(11, 114, 148, 0.15);
  background-color: #ffffff;
  outline: none;
}

/* Placeholder dài hơn khung trên máy hẹp -> cắt bằng dấu ba chấm thay vì cụt giữa từ */
.download-search-input::placeholder {
  text-overflow: ellipsis;
}

.download-clear-search {
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 3;
  padding: 4px 6px;
}

.download-clear-search:hover i {
  color: var(--church-navy-primary, #1a2258);
}

/* Category Filter Chips (Horizontal Swipe on Mobile) */
.download-chips-wrapper {
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.download-chips-wrapper::-webkit-scrollbar {
  display: none;
}

.download-chips {
  display: inline-flex;
  min-width: 100%;
  gap: 8px;
}

.download-chip {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid var(--church-border, #e2e8f0);
  color: var(--church-text-body, #334155);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease-in-out;
  user-select: none;
  min-height: 38px;
  text-decoration: none;
}

.download-chip .chip-count {
  font-size: 0.8rem;
  color: var(--church-text-muted, #64748b);
  margin-left: 4px;
  font-weight: 400;
}

.download-chip:hover {
  background: var(--church-navy-soft, #f1f4fb);
  border-color: var(--church-navy-light, #344199);
  color: var(--church-navy-primary, #1a2258);
}

.download-chip.active {
  background: var(--church-navy-primary, #1a2258);
  border-color: var(--church-navy-primary, #1a2258);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(26, 34, 88, 0.25);
}

.download-chip.active .chip-count {
  color: var(--church-gold-bright, #fbbf24);
  font-weight: 600;
}

/* ==========================================================
   2. MODERN DOCUMENT CARDS (DATA GRID)
========================================================== */
.download-card {
  background: #ffffff;
  border: 1.5px solid var(--church-border, #e2e8f0);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.download-card:hover {
  border-color: #ff37ff;
  box-shadow: 0 0 0 1px #ff37ff, 0 0 14px rgba(255, 55, 255, 0.3), 0 0 24px rgba(255, 55, 255, 0.12);
}

.download-card-main {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
  flex-grow: 1;
}

.download-file-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.download-file-icon.icon-pdf {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.download-file-icon.icon-word {
  background-color: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.download-file-icon.icon-excel {
  background-color: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.download-file-icon.icon-generic {
  background-color: #f8fafc;
  color: var(--church-navy-primary, #1a2258);
  border: 1px solid #e2e8f0;
}

.download-info {
  min-width: 0;
  flex-grow: 1;
}

.download-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--church-navy-primary, #1a2258);
  line-height: 1.4;
  margin-bottom: 6px;
  word-break: break-word;
}

.download-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--church-text-muted, #64748b);
}

.download-badge-cat {
  display: inline-flex;
  align-items: center;
  background-color: var(--church-navy-soft, #f1f4fb);
  color: var(--church-navy-primary, #1a2258);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(26, 34, 88, 0.1);
}

/* Download Action Buttons */
.download-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 40px;
  white-space: nowrap;
}

.download-btn-primary {
  background: linear-gradient(135deg, var(--church-navy-primary, #1a2258) 0%, #1e296e 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(26, 34, 88, 0.2);
}

.download-btn-primary:hover {
  background: linear-gradient(135deg, #242e75 0%, #293888 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(26, 34, 88, 0.3);
  transform: translateY(-1px);
}

.download-btn-secondary {
  background: #ffffff;
  color: var(--church-navy-primary, #1a2258);
  border: 1.5px solid var(--church-border, #e2e8f0);
}

.download-btn-secondary:hover {
  background: var(--church-navy-soft, #f1f4fb);
  border-color: var(--church-navy-primary, #1a2258);
  color: var(--church-navy-primary, #1a2258);
}

/* ==========================================================
   3. RESPONSIVE OPTIMIZATIONS
========================================================== */
@media (max-width: 767.98px) {
  .download-card {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 1rem;
  }
  .download-actions {
    width: 100%;
    border-top: 1px solid var(--church-border, #e2e8f0);
    padding-top: 10px;
  }
  .download-btn {
    width: 100%;
  }
}
