/* ===== ENCYCLOPEDIA STYLES ===== */

/* Search Bar */
.ency-search-bar {
  max-width: 720px;
  margin: 0 auto 2rem;
}

.ency-search-bar .search-box {
  margin-bottom: 1rem;
}

.ency-search-bar .search-box .form-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px center;
  transition: var(--transition);
}

.ency-search-bar .search-box .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 61, 34, 0.08);
}

.ency-search-bar .search-box .form-input::placeholder {
  color: var(--text-muted);
}

/* Tag Filters */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.tag-filter {
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--white);
  border: 1.5px solid var(--border);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.tag-filter:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.tag-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Results Header */
.results-header {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.results-header strong {
  color: var(--primary);
}

/* Encyclopedia Grid */
.ency-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Encyclopedia Card */
.ency-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.ency-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.ency-card-header {
  padding: 20px 20px 12px;
  background: linear-gradient(135deg, var(--off-white), var(--cream));
  border-bottom: 1px solid var(--border);
}

.ency-card-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(13, 61, 34, 0.08);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ency-card-name {
  font-family: var(--font-arabic);
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.ency-card-ar-name {
  font-family: var(--font-arabic);
  font-size: 1rem;
  color: var(--accent-dark);
  direction: rtl;
}

.ency-card-body {
  padding: 16px 20px;
}

.ency-card-hp {
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.08), rgba(201, 168, 76, 0.04));
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  border-left: 3px solid var(--accent);
}

.ency-card-hp-title {
  font-family: var(--font-arabic);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.ency-card-hp-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
}

.ency-card-preview {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ency-card-footer {
  padding: 12px 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ency-card-actions {
  display: flex;
  gap: 8px;
}

/* Entry Modal Body */
.entry-modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.entry-modal-tag {
  display: inline-block;
  padding: 4px 14px;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.entry-modal-ar-name {
  font-family: var(--font-arabic);
  font-size: 1.5rem;
  color: var(--accent-dark);
  direction: rtl;
  margin-bottom: 1.5rem;
}

.entry-section {
  margin-bottom: 1.5rem;
}

.entry-section h4 {
  font-family: var(--font-arabic);
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.entry-section p {
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.entry-section ul {
  padding-left: 1.25rem;
  color: var(--text-light);
  line-height: 1.8;
}

.entry-section li {
  margin-bottom: 0.25rem;
}

.entry-source {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text-light);
  border-left: 3px solid var(--accent);
}

.entry-safety {
  background: rgba(220, 38, 38, 0.06);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--danger);
  border-left: 3px solid var(--danger);
}

/* Responsive */
@media (max-width: 1024px) {
  .ency-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .ency-grid {
    grid-template-columns: 1fr;
  }

  .ency-search-bar .search-box .form-input {
    padding: 12px 16px 12px 44px;
    font-size: 0.95rem;
  }

  .tag-filters {
    gap: 6px;
  }

  .tag-filter {
    padding: 5px 12px;
    font-size: 0.8rem;
  }

  .entry-modal-body {
    padding: 16px;
  }
}