.categories-page-modern {
  padding: 30px 0 50px;
  background: var(--bg-page, #ffffff);
  min-height: 60vh;
  transition: background-color 0.3s ease;
}

.page-header-modern {
  text-align: center;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color, #f3f4f6);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main, #1f2937);
  margin: 0 0 10px 0;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted, #6b7280);
  margin: 0;
  line-height: 1.5;
}

.filter-bar {
  background: var(--bg-card, #f9fafb);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.search-box-filter {
  position: relative;
  width: 100%;
}

.search-icon-filter {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle, #6b7280);
  font-size: 1.1rem;
  z-index: 1;
}

.search-input-filter {
  width: 100%;
  padding: 12px 45px 12px 45px;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text-main, #1f2937);
  background: var(--input-bg, #ffffff);
  transition: all 0.3s ease;
}

.search-input-filter:focus {
  outline: none;
  border-color: var(--tg-blue, #0088cc);
  box-shadow: 0 0 0 3px var(--tg-blue-glow, rgba(0, 136, 204, 0.1));
}

.clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-subtle, #9ca3af);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 5px;
  transition: color 0.3s ease;
  z-index: 1;
}

.clear-search:hover {
  color: var(--tg-blue, #0088cc);
}

.filter-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sort-select {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text-main, #1f2937);
  background: var(--input-bg, #ffffff);
  cursor: pointer;
  transition: all 0.3s ease;
}

.sort-select:focus {
  outline: none;
  border-color: var(--tg-blue, #0088cc);
  box-shadow: 0 0 0 3px var(--tg-blue-glow, rgba(0, 136, 204, 0.1));
}

.view-toggle {
  display: flex;
  gap: 5px;
  background: var(--input-bg, #ffffff);
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  padding: 4px;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 8px 12px;
  color: var(--text-muted, #6b7280);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  background: var(--bg-surface-alt, #f3f4f6);
  color: var(--tg-blue, #0088cc);
}

.view-btn.active {
  background: var(--tg-blue, #0088cc);
  color: #ffffff !important;
}

.results-info {
  margin-bottom: 20px;
  padding: 10px 0;
  font-size: 0.9rem;
  color: var(--text-muted, #6b7280);
  font-weight: 500;
}

.categories-grid-modern {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .categories-grid-modern {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

@media (min-width: 992px) {
  .categories-grid-modern {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
  
  .category-image-page {
    height: 170px;
  }
}

.categories-grid-modern.list-view {
  grid-template-columns: 1fr;
}

.category-card-page {
  display: block;
  text-decoration: none;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card, #ffffff);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
  transition: all 0.3s ease;
  border: 1px solid var(--border-color, #f3f4f6);
}

.category-card-page.hidden {
  display: none;
}

.category-card-page:hover {
  transform: translateY(-5px);
  border-color: var(--tg-blue);
  box-shadow: var(--shadow-hover, 0 8px 20px rgba(0, 0, 0, 0.15));
  text-decoration: none;
}

.category-card-page.list-view {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.category-card-page.list-view .category-image-page {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border-radius: 12px 0 0 12px;
}

.category-card-page.list-view .category-content-page {
  flex: 1;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-image-page {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: var(--bg-surface-alt, #f3f4f6);
}

.category-image-page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.category-card-page:hover .category-image-page img {
  transform: scale(1.1);
}

.category-overlay-page {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-card-page:hover .category-overlay-page {
  opacity: 1;
}

.category-badge-page {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card, rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(10px);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main, #1f2937);
  border: 1px solid var(--border-color, rgba(0,0,0,0.05));
  z-index: 2;
  box-shadow: var(--shadow-xs);
}

.category-badge-page i {
  font-size: 0.7rem;
  color: var(--tg-blue, #0088cc);
}

.category-content-page {
  padding: 16px;
  background: var(--bg-card, #ffffff);
}

.category-title-page {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main, #1f2937);
  margin: 0;
  line-height: 1.3;
  text-align: center;
  transition: color 0.3s ease;
}

.category-card-page.list-view .category-title-page {
  text-align: left;
  font-size: 1.1rem;
}

.category-card-page:hover .category-title-page {
  color: var(--tg-blue, #0088cc);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted, #6b7280);
}

.empty-state i {
  font-size: 4rem;
  color: var(--text-subtle, #d1d5db);
  margin-bottom: 20px;
  display: block;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main, #374151);
  margin: 0 0 10px 0;
}

.empty-state p {
  font-size: 0.95rem;
  margin: 0;
}

.pagination-wrapper {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.pagination-modern {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.pagination-modern .pagination {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
}

.pagination-modern .pagination li {
  margin: 0;
}

.pagination-modern .pagination a,
.pagination-modern .pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-card, #ffffff);
  color: var(--text-muted, #6b7280);
}

.pagination-modern .pagination a:hover {
  background: var(--bg-surface-alt, #f3f4f6);
  color: var(--tg-blue, #0088cc);
  border-color: var(--tg-blue, #0088cc);
  transform: translateY(-2px);
}

.pagination-modern .pagination .active span {
  background: var(--gradient-tg, linear-gradient(135deg, #0088cc 0%, #229ED9 100%));
  color: #ffffff !important;
  border-color: var(--tg-blue, #0088cc);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.pagination-modern .pagination .disabled span {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-surface-alt, #f9fafb);
  border-color: var(--border-color);
  color: var(--text-subtle);
}

@media (max-width: 576px) {
  .categories-page-modern {
    padding: 20px 0 40px;
  }
  
  .page-header-modern {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .page-subtitle {
    font-size: 0.85rem;
  }
  
  .filter-bar {
    padding: 12px;
  }
  
  .filter-controls {
    flex-direction: column;
  }
  
  .sort-select {
    width: 100%;
  }
  
  .view-toggle {
    width: 100%;
    justify-content: center;
  }
  
  .categories-grid-modern {
    gap: 12px;
    margin-bottom: 30px;
  }
  
  .category-image-page {
    height: 150px;
  }
  
  .category-card-page.list-view .category-image-page {
    width: 100px;
    height: 100px;
  }
  
  .category-badge-page {
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    font-size: 0.7rem;
  }
  
  .category-content-page {
    padding: 12px;
  }
  
  .category-title-page {
    font-size: 0.9rem;
  }
  
  .pagination-modern .pagination a,
  .pagination-modern .pagination span {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.85rem;
  }
  
  .empty-state {
    padding: 40px 20px;
  }
  
  .empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
  }
  
  .empty-state h3 {
    font-size: 1.1rem;
  }
  
  .empty-state p {
    font-size: 0.85rem;
  }
}

