/* Сброс и базовые шрифты */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-page: #f4f5f7;
  --bg-card: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #e11d48; /* энергичный акцент в стиле сервисов услуг */
  --accent-soft: #fff1f2;
  --tg-blue: #0088cc;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

body {
  font-family: var(--font);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Верхний тулбар */
.top-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-nav__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand__logo {
  background: var(--text-main);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.brand__title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand__badge {
  font-size: 0.75rem;
  background: #f3f4f6;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}

.top-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-post {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
}

/* Поисково-навигационный блок */
.search-strip {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}

.search-strip__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: #f9fafb;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.75rem;
  gap: 0.5rem;
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.5rem 0.25rem;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
}

.search-box button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tag-chip {
  background: #f3f4f6;
  color: #374151;
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.tag-chip:hover {
  border-color: var(--line-strong);
  background: #e5e7eb;
}

/* Сетка категорий */
.main-wrap {
  max-width: 1240px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}

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

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

/* Колонка/блок категории */
.category-block {
  background: var(--bg-card);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.04), 0 2px 4px -2px rgba(0,0,0,0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.category-block__header {
  padding: 0.9rem 1rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-block__title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-main);
}

.category-block__count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Премиум карточка */
.premium-card {
  padding: 1.15rem;
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  transition: background 0.15s ease;
}

.premium-card__badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.badge-promoted {
  background: #fef2f2;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid #fecdd3;
}

.badge-custom {
  background: #f0fdf4;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.master-profile {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.master-profile__photo {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.master-profile__info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.master-profile__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.master-profile__role {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.master-profile__location {
  font-size: 0.75rem;
  color: #059669;
  font-weight: 500;
  margin-top: 0.2rem;
}

.premium-card__desc {
  font-size: 0.825rem;
  color: #374151;
  background: #f9fafb;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.premium-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
}

.master-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
}

.master-buttons {
  display: flex;
  justify-content: flex-end;
}

.master-buttons .btn-contact {
  flex: initial;
}

.btn-contact {
  padding: 0.45rem 0.9rem;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.btn-phone {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  transition: all 0.15s ease;
}
.btn-phone:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.btn-tg {
  background: var(--tg-blue);
  color: #ffffff;
}

.btn-phone {
  background: #f3f4f6;
  color: var(--text-main);
  border: 1px solid var(--line-strong);
}

/* Список бесплатных строк */
.free-list {
  display: flex;
  flex-direction: column;
}

.free-item {
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f3f4f6;
  gap: 0.5rem;
}

.free-item:last-child {
  border-bottom: none;
}

.free-item__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.free-item__name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.free-item__name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.free-item__specialty {
  font-size: 0.775rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.free-item__action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.free-item__price {
  font-size: 0.775rem;
  font-weight: 600;
  color: #374151;
}

.btn-icon-call {
  background: #f3f4f6;
  border: 1px solid var(--line);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}

/* Кнопка "Показать еще" */
.btn-toggle-more {
  width: 100%;
  padding: 0.65rem 1rem;
  background: #fafafa;
  border: none;
  border-top: 1px solid var(--line);
  color: #4b5563;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn-toggle-more:hover {
  background: #f3f4f6;
}

/* Новости */
.news-strip {
  margin-top: 2rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.news-strip__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.news-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 640px) {
  .news-items {
    grid-template-columns: 1fr;
  }
}

.news-box {
  background: #f9fafb;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.news-box__tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
}

.news-box__head {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0.2rem 0;
}

.news-box__copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Футер */
.page-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  background: #ffffff;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.skip-link {
  position: absolute;
  top: -9999px;
  left: -9999px;
}
.skip-link:focus {
  top: 0;
  left: 0;
  background: #000;
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

/* Modal form */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 98vh;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 1.35rem 1.5rem;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem;
}
.modal-close:hover {
  color: #0f172a;
}

.form-group {
  margin-bottom: 0.65rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.25rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #0f172a;
  background: #fff;
  font-family: inherit;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row {
  display: flex;
  gap: 0.65rem;
}
.form-row > * {
  flex: 1;
}

.btn-submit-app {
  width: 100%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 0.65rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.25rem;
}
.btn-submit-app:hover {
  background: #1d4ed8;
}

/* Векторные бейджи и иконки */
.category-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  flex-shrink: 0;
}

.category-icon-wrapper.repair { background: #eff6ff; color: #2563eb; }
.category-icon-wrapper.beauty { background: #fdf2f8; color: #db2777; }
.category-icon-wrapper.auto { background: #fef2f2; color: #dc2626; }
.category-icon-wrapper.cleaning { background: #ecfdf5; color: #059669; }
.category-icon-wrapper.tutors { background: #fffbeb; color: #d97706; }
.category-icon-wrapper.it { background: #f5f3ff; color: #7c3aed; }

.badge-promoted {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.avatar-initials {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  color: #475569;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  flex-shrink: 0;
  text-transform: uppercase;
}

.btn-icon-call {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
}

/* Оптимизация под смартфоны (iPhone SE, узкие экраны < 480px) */
@media (max-width: 480px) {
  .brand__badge {
    display: none; /* Скрываем длинный бейдж ЖК на узких экранах, оставляем лого и название */
  }
  .btn-post {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .top-nav__inner {
    padding: 0.6rem 0.75rem;
  }
  .main-wrap {
    padding: 0 0.5rem;
    margin: 1rem auto;
  }
  .modal-card {
    padding: 1.25rem;
    border-radius: 12px;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Стилизация форматированного контента новостей */
.news-box__copy.ql-rendered {
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
}
.news-box__copy.ql-rendered p {
  margin-bottom: 0.4rem;
}
.news-box__copy.ql-rendered p:last-child {
  margin-bottom: 0;
}
.news-box__copy.ql-rendered img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.5rem 0;
}
.news-box__copy.ql-rendered ul, .news-box__copy.ql-rendered ol {
  padding-left: 1.25rem;
  margin-bottom: 0.4rem;
}

/* Плашка рейтинга */
.badge-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.rating-star {
  color: #f59e0b;
}
.rating-val {
  color: #92400e;
}
.rating-count {
  color: #b45309;
  font-weight: 500;
  font-size: 0.7rem;
}

/* Чипсы навыков */
.skills-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.skill-pill {
  font-size: 0.725rem;
  background: #f1f5f9;
  color: #475569;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 500;
}

/* Мини-портфолио в карточке */
.card-mini-portfolio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.mini-portfolio-thumb {
  display: block;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.mini-portfolio-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.mini-portfolio-thumb:hover img {
  transform: scale(1.06);
}

/* Микро-анимация карточки при наведении */
.premium-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.category-block:hover .premium-card {
  background: #fcfdfe;
}

/* Кнопка бота в шапке */
.btn-tg-bot {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}
.btn-tg-bot:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* Разделитель между ТОП мастером и остальными */
.category-divider {
  padding: 0.55rem 1rem;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Кликабельность всех карточек (мастера, новости) */
.clickable-card {
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.premium-card.clickable-card:hover {
  background-color: #f8fafc !important;
}
.free-item.clickable-card {
  transition: background-color 0.15s ease;
}
.free-item.clickable-card:hover {
  background-color: #f1f5f9 !important;
}
.free-item.clickable-card:hover .free-item__name {
  color: #2563eb;
}

/* Кнопка "Профиль →" в строке бесплатного мастера */
.btn-icon-profile {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
}
.btn-icon-profile:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Карточка новости на главной */
.news-box.clickable-card {
  cursor: pointer;
  transition: all 0.2s ease;
}
.news-box.clickable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
  background: #ffffff;
}
.news-box.clickable-card:hover .news-box__head {
  color: #2563eb;
}

/* Аккуратная карточка новости на главной (превью + текст) */
.news-card-inner {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-top: 0.35rem;
}
.news-thumb {
  width: 80px;
  height: 65px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.news-content-col {
  flex-grow: 1;
  min-width: 0;
}
.news-box__preview-text {
  font-size: 0.825rem;
  color: #4b5563;
  line-height: 1.4;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
