.themes-page {
  padding-top: 10px;
}

.themes-hero {
  margin-bottom: 22px;
}

.themes-hero__content {
  max-width: 760px;
}

.themes-hero__title {
  margin-top: 12px;
}

.themes-hero__lead {
  margin-top: 10px;
  max-width: 620px;
  font-size: 15px;
  line-height: 1.7;
}

.themes-filter-row {
  margin-top: 18px;
  display: flex;
  align-items: stretch;
  gap: 12px;
  max-width: 760px;
}

.themes-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  margin-top: 0;
}

.themes-search__input {
  width: 100%;
  min-height: 52px;
  height: 52px;
  padding-left: 44px;
  font-size: 15px;
}

.themes-sort {
  flex: 0 0 172px;
  min-width: 172px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .themes-sort {
  background: #ffffff;
  border-color: #dbe3ef;
}

.themes-sort__label {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.themes-sort__select {
  flex: 1 1 auto;
  min-width: 0;
  height: 50px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.themes-sort__select option {
  color: #0f172a;
  background: #ffffff;
}

.themes-toolbar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.themes-toolbar__meta {
  color: var(--text-muted);
  font-size: 14px;
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.themes-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 88px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  box-shadow: none !important;
}

.themes-card__media {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 56px;
  min-width: 74px;
  padding: 0;
  background: transparent;
  border: 0;
}

.themes-card__image,
.css-image-placeholder--theme {
  width: 100%;
  height: 100%;
  max-width: 74px;
  max-height: 56px;
  object-fit: contain;
  display: block;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
}

.css-image-placeholder--theme {
  display: flex;
  align-items: center;
  justify-content: center;
}

.css-image-placeholder--theme .css-image-placeholder__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.css-image-placeholder--theme .css-image-placeholder__icon {
  font-size: 16px;
  line-height: 1;
}

.css-image-placeholder--theme .css-image-placeholder__text {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
}

.themes-card__body {
  grid-column: 2;
  min-width: 0;
  padding: 0;
}

.themes-card__name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

html[data-theme="light"] .themes-card__name {
  color: #0f172a;
}

.themes-card__count {
  margin-top: 4px;
  font-size: 13px;
  color: #9aa9c4;
  line-height: 1.2;
}

html[data-theme="light"] .themes-card__count {
  color: #64748b;
}

.themes-card::after {
  content: attr(data-count);
  grid-column: 3;
  align-self: center;
  justify-self: end;
  min-width: 32px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  color: #aeb9cd;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

html[data-theme="light"] .themes-card::after {
  background: #f1f5f9;
  color: #94a3b8;
}

.themes-empty {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 700px;
  margin: 40px auto;
  padding: 32px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.themes-empty__icon {
  font-size: 36px;
  line-height: 1;
  margin: 0;
}

.themes-empty__title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.themes-empty .text-muted,
.themes-empty p {
  margin: 0;
}

.themes-loadmore {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.themes-grid.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.themes-grid-loader {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 320px;
  width: 100%;
}

.themes-grid-loader__brick {
  position: relative;
  width: 48px;
  height: 48px;
  animation: brick-spin 1s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.35));
}

.themes-grid-loader__brick::before {
  content: '';
  position: absolute;
  inset: 8px 0 0 0;
  border-radius: 5px;
  background: #facc15;
}

.themes-grid-loader__brick::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 10px;
  border-radius: 4px;
  background: #fde047;
  box-shadow: -12px 0 0 #fde047, 12px 0 0 #fde047;
}

.themes-grid-loader__label {
  font-size: 13px;
  font-weight: 700;
  color: #6b7fa0;
  letter-spacing: 0.02em;
}

html[data-theme="light"] .themes-grid-loader__label {
  color: #94a3b8;
}

@keyframes brick-spin {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.08); }
  50% { transform: rotate(180deg) scale(1); }
  75% { transform: rotate(270deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}

@media (max-width: 1100px) {
  .themes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .themes-filter-row {
    flex-direction: column;
    gap: 10px;
  }

  .themes-sort {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .themes-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .themes-card {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 80px;
    padding: 12px 14px;
  }

  .themes-card__media {
    width: 64px;
    height: 48px;
    min-width: 64px;
  }

  .themes-card__image,
  .css-image-placeholder--theme {
    max-width: 64px;
    max-height: 48px;
  }

  .themes-card__name {
    font-size: 14px;
  }

  .themes-card__count {
    font-size: 12px;
  }

  .themes-card::after {
    min-width: 28px;
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
  }
}
