/* ============================================
   СаратовВет — Тёплый и дружелюбный дизайн
   ============================================ */

/* --- Pico CSS v2 color overrides --- */
:root[data-theme="light"] {
  --pico-primary: #8B5E3C;
  --pico-primary-background: #8B5E3C;
  --pico-primary-border: #8B5E3C;
  --pico-primary-underline: rgba(139, 94, 60, 0.5);
  --pico-primary-hover: #6D4A2F;
  --pico-primary-hover-background: #7a5435;
  --pico-primary-hover-border: #6D4A2F;
  --pico-primary-hover-underline: #6D4A2F;
  --pico-primary-focus: rgba(139, 94, 60, 0.25);
  --pico-primary-inverse: #fff;
  --pico-secondary: #E8A838;
  --pico-secondary-background: #E8A838;
  --pico-secondary-border: #E8A838;
  --pico-secondary-underline: rgba(232, 168, 56, 0.5);
  --pico-secondary-hover: #D4952E;
  --pico-secondary-hover-background: #daa033;
  --pico-secondary-hover-border: #D4952E;
  --pico-secondary-hover-underline: #D4952E;
  --pico-secondary-focus: rgba(232, 168, 56, 0.25);
  --pico-secondary-inverse: #fff;
  --pico-background: #FDF8F3;
  --pico-card-background-color: #FFFFFF;
  --pico-card-border-color: #E8DDD4;
  --pico-card-box-shadow: 0 2px 8px rgba(61, 43, 31, 0.08);
  --pico-text: #3D2B1F;
  --pico-text-muted: #8B7355;
  --pico-border-color: #E8DDD4;
  --pico-form-element-border-color: #E8DDD4;
  --pico-form-element-focus-color: #8B5E3C;
  --pico-form-element-active-border-color: #8B5E3C;
  --pico-form-element-selected-background-color: rgba(139, 94, 60, 0.1);
}

/* --- Custom properties --- */
:root {
  --primary: #8B5E3C;
  --primary-hover: #6D4A2F;
  --secondary: #E8A838;
  --secondary-hover: #D4952E;
  --background: #FDF8F3;
  --surface: #FFFFFF;
  --text: #3D2B1F;
  --text-muted: #8B7355;
  --border: #E8DDD4;
  --border-hover: #D4C4B5;
  --success: #5A9E6F;
  --danger: #C0392B;
  --box-shadow: 0 2px 8px rgba(61, 43, 31, 0.08);
  --box-shadow-hover: 0 4px 16px rgba(61, 43, 31, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 50px;
}

/* --- Глобальная типографика --- */
body {
  background: var(--background);
  color: var(--text);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration-color: transparent;
  transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
  color: var(--primary-hover);
  text-decoration-color: var(--primary);
}

/* --- Кнопки --- */
[role="button"], button, input[type="submit"], input[type="button"] {
  border-radius: var(--radius-sm);
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

button:active, [role="button"]:active, input[type="submit"]:active {
  transform: scale(0.98);
}

/* --- Навигация --- */
nav {
  border-bottom: none;
  margin-bottom: 0;
  padding: 0.8rem 0;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(61, 43, 31, 0.06);
}

nav ul {
  align-items: center;
}

nav ul li {
  display: flex;
  align-items: center;
  padding: 0 0.2rem;
}

nav .logo-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
}

nav .logo-link:hover {
  background: none;
}

nav .logo-link img {
  height: 44px;
  width: auto;
  max-width: none;
}

.logo-text {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-text-accent {
  color: var(--primary);
}

nav strong a {
  color: var(--text);
  font-weight: 700;
}

nav ul li a {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  transition: color 0.2s, background 0.2s;
}

nav ul li a:hover {
  color: var(--primary);
  background: rgba(139, 94, 60, 0.06);
  text-decoration: none;
}

nav ul li a.active {
  color: var(--primary);
  background: rgba(139, 94, 60, 0.1);
}

/* Кнопка «Выйти» в навбаре — выравнивание с ссылками */
.nav-logout-wrap {
  list-style: none;
}

.nav-logout-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.nav-logout-btn {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1rem;
  font-family: inherit;
  padding: 0.4rem 0.8rem;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  line-height: 1.5;
  width: auto;
  box-shadow: none;
  transition: color 0.2s, background 0.2s;
}

.nav-logout-btn:hover {
  color: var(--primary);
  background: rgba(139, 94, 60, 0.06);
}

/* --- Футер --- */
footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer a {
  color: var(--text-muted);
  margin: 0 0.5rem;
}

footer a:hover {
  color: var(--primary);
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

/* --- Hero-секция --- */
.hero {
  background: linear-gradient(135deg, #FDF8F3 0%, #F5E6D3 50%, #FDF0E0 100%);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(232, 168, 56, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(139, 94, 60, 0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.hero .hero-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  position: relative;
  z-index: 1;
}

/* --- Карточки клиников --- */
.clinic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
  display: flex;
  flex-direction: column;
}

.clinic-card:hover,
.clinic-card:focus-visible {
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.clinic-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.clinic-card-image {
  height: 140px;
  background: linear-gradient(135deg, #F5E6D3 0%, #E8DDD4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--primary);
  opacity: 0.6;
}

.clinic-card-body {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.clinic-card-body h3 {
  margin: 0 0 0.4rem 0;
  font-size: 1.15rem;
  line-height: 1.3;
}

.clinic-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.clinic-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.clinic-card-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.8rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clinic-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: rgba(139, 94, 60, 0.08);
  color: var(--primary);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.tag-more {
  background: rgba(139, 94, 60, 0.04);
  color: var(--text-muted);
}

/* --- Секция «Популярные клиники» --- */
.section-title {
  text-align: center;
  margin-bottom: 1.5rem;
}

.section-title h2 {
  margin-bottom: 0.3rem;
}

.section-title p {
  color: var(--text-muted);
  margin: 0;
}

/* --- Сетка карточек --- */
.clinics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* --- Лендинг клиники --- */
.clinic-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  min-height: 430px;
  margin: 1.5rem 0 1.25rem;
  overflow: hidden;
  background: linear-gradient(135deg, #f4e4d1 0%, #fff6eb 100%);
  border: 1px solid rgba(139, 94, 60, 0.12);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(61, 43, 31, 0.08);
}

.clinic-hero-content {
  z-index: 1;
  padding: clamp(2rem, 5vw, 4.25rem);
}

.clinic-trust-badge {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1.1rem;
  padding: 0.38rem 0.7rem;
  background: rgba(90, 158, 111, 0.12);
  border-radius: var(--radius-pill);
  color: #3f7650;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.clinic-trust-badge svg,
.clinic-meta-item svg,
.clinic-phone-action svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.clinic-hero h1 {
  max-width: 760px;
  margin: 0 0 0.9rem;
  font-size: clamp(2.25rem, 5vw, 4.2rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.clinic-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.clinic-meta-item,
.clinic-rating {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.clinic-meta-item {
  max-width: 38rem;
}

.clinic-rating {
  padding-left: 1rem;
  border-left: 1px solid rgba(139, 94, 60, 0.22);
  text-decoration: none;
}

.clinic-rating > span:first-child {
  color: var(--secondary);
}

.clinic-rating > span:last-child {
  text-decoration: underline;
  text-decoration-color: rgba(139, 94, 60, 0.28);
  text-underline-offset: 0.18em;
}

.clinic-rating-empty {
  color: var(--text-muted);
}

.clinic-hero-description {
  max-width: 660px;
  margin: 0 0 1.65rem;
  color: #5b4738;
  font-size: 1.02rem;
  line-height: 1.7;
}

.clinic-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.clinic-hero-actions [role="button"] {
  display: inline-flex;
  gap: 0.5rem;
  min-height: 3rem;
  margin: 0;
  padding: 0.72rem 1.1rem;
  align-items: center;
  justify-content: center;
  font-weight: 650;
}

.clinic-primary-action {
  box-shadow: 0 8px 22px rgba(139, 94, 60, 0.2);
}

.clinic-phone-action {
  background: rgba(255, 255, 255, 0.72);
}

.clinic-secondary-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
  font-size: 0.88rem;
}

.clinic-secondary-contacts a {
  text-decoration: underline;
  text-decoration-color: rgba(139, 94, 60, 0.28);
  text-underline-offset: 0.2em;
}

.clinic-hero-media {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: linear-gradient(145deg, #e8d7c5, #f7eadc);
}

.clinic-hero-media::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(244, 228, 209, 0.5), transparent 36%);
  content: "";
  pointer-events: none;
}

.clinic-hero-media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clinic-hero-logo,
.clinic-hero-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 430px;
  align-items: center;
  justify-content: center;
}

.clinic-hero-logo img {
  width: min(68%, 260px);
  max-height: 65%;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(61, 43, 31, 0.12));
}

.clinic-hero-placeholder {
  color: rgba(139, 94, 60, 0.62);
  font-size: clamp(6rem, 14vw, 11rem);
  font-weight: 800;
}

.clinic-section-nav {
  position: sticky;
  z-index: 5;
  top: 0;
  margin: 0 0 3.5rem;
  padding: 0;
  overflow-x: auto;
  background: rgba(253, 248, 243, 0.94);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.clinic-section-nav-inner {
  display: flex;
  width: max-content;
  min-width: 100%;
  gap: 1.5rem;
}

.clinic-section-nav a {
  padding: 1rem 0 0.85rem;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 650;
  white-space: nowrap;
}

.clinic-section-nav a:hover,
.clinic-section-nav a:focus-visible {
  border-bottom-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* --- Секции на лендинге --- */
.landing-section {
  margin-bottom: 2rem;
}

.landing-section h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.clinic-content-section,
.clinic-booking-section {
  margin-bottom: 4.5rem;
  scroll-margin-top: 4.5rem;
}

.clinic-section-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.clinic-section-header h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  letter-spacing: -0.025em;
}

.clinic-section-header > p {
  max-width: 390px;
  margin: 0 0 0.12rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: right;
}

.clinic-section-kicker {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.clinic-section-link {
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  font-weight: 650;
}

/* --- Карточки услуг --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.service-card {
  display: flex;
  min-height: 88px;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.service-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-1px);
}

.service-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.98rem;
  line-height: 1.3;
}

.service-card .service-price {
  flex: 0 0 auto;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--primary);
  white-space: nowrap;
}

.service-card .service-duration {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* --- Карточки врачей --- */
.doctors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}

.doctor-card {
  position: relative;
  min-height: 218px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
  padding: 1.35rem;
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.doctor-card:hover,
.doctor-card:focus-visible {
  border-color: var(--border-hover);
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-2px);
}

.doctor-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.doctor-avatar {
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #F5E6D3 0%, #E8DDD4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 750;
  color: var(--primary);
  flex-shrink: 0;
}

.doctor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-info {
  display: flex;
  min-width: 0;
  flex: 1;
  align-self: stretch;
  flex-direction: column;
}

.doctor-info h3 {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
  line-height: 1.25;
}

.doctor-info .doctor-specialty {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 650;
  margin-bottom: 0.25rem;
}

.doctor-experience {
  margin-bottom: 0.6rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.doctor-info .doctor-desc {
  display: -webkit-box;
  margin: 0 0 0.75rem;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.doctor-card-link {
  margin-top: auto;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 650;
}

/* --- Публичная карточка врача --- */
.doctor-profile-card {
  max-width: 760px;
  margin: 0 auto 2rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
}

.doctor-profile-header {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.doctor-profile-header h1 {
  margin-bottom: 0.3rem;
}

.doctor-profile-photo {
  display: flex;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #F5E6D3 0%, #E8DDD4 100%);
  border-radius: 50%;
  color: var(--primary);
  font-size: 3.5rem;
}

.doctor-profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-profile-specialty {
  margin-bottom: 0.5rem;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 600;
}

.doctor-profile-clinic {
  color: var(--text-muted);
}

.doctor-profile-section {
  margin-top: 1.5rem;
}

.doctor-profile-section h2 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.doctor-profile-section p {
  margin: 0;
  line-height: 1.65;
}

/* --- Галерея клиники --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 190px;
  gap: 0.75rem;
}

.gallery-thumbnail {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
  color: inherit;
  cursor: zoom-in;
  text-align: left;
}

.gallery-thumbnail figure {
  position: relative;
  height: 100%;
  margin: 0;
}

.gallery-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  transition: transform 0.2s, filter 0.2s;
}

.gallery-thumbnail:first-child {
  grid-row: span 2;
  grid-column: span 2;
}

.gallery-thumbnail:hover img,
.gallery-thumbnail:focus-visible img {
  filter: brightness(0.92);
  transform: scale(1.02);
}

.gallery-thumbnail:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.gallery-thumbnail figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2.5rem 0.75rem 0.65rem;
  background: linear-gradient(transparent, rgba(30, 20, 14, 0.72));
  color: #fff;
}

.gallery-thumbnail figcaption small {
  color: inherit;
}

.gallery-lightbox {
  width: min(96vw, 1200px);
  max-width: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  color: #fff;
}

.gallery-lightbox::backdrop {
  background: rgba(22, 16, 12, 0.92);
  backdrop-filter: blur(3px);
}

.gallery-lightbox-inner {
  position: relative;
  display: flex;
  min-height: min(80vh, 800px);
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-slide {
  margin: 0;
  text-align: center;
}

.gallery-lightbox-image {
  display: block;
  max-width: calc(100vw - 7rem);
  max-height: calc(100vh - 7rem);
  margin: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.gallery-lightbox-slide figcaption {
  margin-top: 0.75rem;
  color: #fff;
}

.gallery-lightbox-control {
  position: absolute;
  z-index: 1;
  display: flex;
  width: 3rem;
  height: 3rem;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

.gallery-lightbox-control:hover,
.gallery-lightbox-control:focus-visible {
  background: rgba(139, 94, 60, 0.9);
  border-color: #fff;
}

.gallery-lightbox-close {
  top: 0;
  right: 0;
}

.gallery-lightbox-previous {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.gallery-lightbox-next {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

.gallery-lightbox-counter {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  color: #fff;
  text-align: center;
}

/* --- Онлайн-запись на лендинге --- */
.clinic-booking-section {
  padding: clamp(1.4rem, 4vw, 2.5rem);
  background: linear-gradient(145deg, #f2e1cd 0%, #fbefe0 100%);
  border: 1px solid rgba(139, 94, 60, 0.13);
  border-radius: 20px;
}

.clinic-booking-header {
  border-bottom-color: rgba(139, 94, 60, 0.18);
}

.clinic-booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr);
  gap: 1rem;
}

.clinic-booking-card,
.clinic-booking-note {
  margin: 0;
  padding: clamp(1.1rem, 3vw, 1.7rem);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(139, 94, 60, 0.13);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(61, 43, 31, 0.05);
}

.clinic-booking-card > h3,
.clinic-booking-note h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.clinic-booking-card > p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.clinic-booking-card > [role="button"] {
  width: 100%;
  margin: 0;
}

.clinic-booking-note ol {
  display: grid;
  gap: 1rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.clinic-booking-note li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.clinic-booking-note li > span {
  display: inline-flex;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  background: rgba(139, 94, 60, 0.1);
  border-radius: 50%;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 750;
}

.clinic-booking-note li div {
  display: grid;
  gap: 0.12rem;
}

.clinic-booking-note li strong {
  font-size: 0.86rem;
}

.clinic-booking-note li small {
  color: var(--text-muted);
  line-height: 1.35;
}

.booking-step-label {
  margin: 1rem 0 0.55rem;
  font-size: 0.88rem;
}

.booking-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.booking-option {
  width: auto;
  margin: 0;
  padding: 0.48rem 0.75rem;
  font-size: 0.82rem;
}

.booking-time-option {
  position: relative;
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.booking-time-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.booking-time-option {
  padding: 0.45rem 0.72rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 650;
}

.booking-time-option:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.booking-time-option:has(input:focus-visible) {
  outline: 3px solid var(--pico-primary-focus);
  outline-offset: 2px;
}

.booking-submit {
  width: 100%;
}

/* --- Отзывы на лендинге --- */
.reviews-summary {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
  margin-bottom: 0.15rem;
}

.reviews-summary strong {
  font-size: 1.8rem;
  line-height: 1;
}

.reviews-summary > span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.reviews-summary > span > span,
.review-stars {
  color: var(--secondary);
}

.reviews-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.review-card {
  margin: 0;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.review-card > header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 0.75rem;
  padding: 0;
  background: transparent;
}

.review-card > header > div {
  display: grid;
  gap: 0.12rem;
}

.review-card p {
  margin: 0;
  color: #5b4738;
  font-size: 0.9rem;
  line-height: 1.55;
}

.review-stars {
  white-space: nowrap;
}

.clinic-empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  background: rgba(139, 94, 60, 0.04);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  text-align: center;
}

.clinic-empty-state p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
}

.review-form-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.review-form-panel summary {
  margin: 0;
}

.review-form-panel[open] summary {
  margin-bottom: 1rem;
}

/* --- Формы авторизации --- */
.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
}

.auth-card header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}

.auth-card header p {
  color: var(--text-muted);
  margin: 0;
}

.auth-card form [type="submit"] {
  width: 100%;
}

.auth-divider {
  text-align: center;
  color: var(--text-muted);
  margin: 1rem 0;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 1.5rem);
  height: 1px;
  background: var(--border);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-card .auth-links {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --- Профиль --- */
.profile-card {
  max-width: 520px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F5E6D3 0%, #E8DDD4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 auto 1rem;
}

.profile-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin-bottom: 1.5rem;
}

.profile-info dt {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.profile-info dd {
  margin: 0;
  font-weight: 500;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.profile-actions a {
  text-align: center;
}

/* --- Дашборд клиники --- */
.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--box-shadow);
}

.dashboard-card h2 {
  margin: 0 0 1rem 0;
}

.dashboard-status {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
}

.status-active {
  background: rgba(90, 158, 111, 0.12);
  color: var(--success);
}

.status-inactive {
  background: rgba(192, 57, 43, 0.1);
  color: var(--danger);
}

/* --- Таблица услуг в дашборде --- */
.services-table {
  width: 100%;
  border-collapse: collapse;
}

.services-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border);
}

.services-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.services-table tr:hover td {
  background: rgba(139, 94, 60, 0.03);
}

.services-table .btn-delete {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.services-table .btn-delete:hover {
  background: var(--danger);
  color: #fff;
}

/* --- Кастомные формы (не form.as_p) --- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  border-radius: var(--radius-sm);
}

.form-group .help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.form-actions [role="button"],
.form-actions button {
  flex: 1;
}

/* --- Сообщения (messages) --- */
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.messages li {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.messages .success {
  background: rgba(90, 158, 111, 0.1);
  border: 1px solid rgba(90, 158, 111, 0.25);
  color: #3d7a4f;
}

.messages .error {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.2);
  color: #a93226;
}

.messages .warning {
  background: rgba(232, 168, 56, 0.12);
  border: 1px solid rgba(232, 168, 56, 0.3);
  color: #8a6d20;
}

.messages .info {
  background: rgba(139, 94, 60, 0.08);
  border: 1px solid rgba(139, 94, 60, 0.2);
  color: var(--text);
}

/* --- Кнопка «Назад» --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.back-link:hover {
  color: var(--primary);
}

/* --- Пустое состояние --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* --- Адаптивность --- */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1.2rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .clinics-grid {
    grid-template-columns: 1fr;
  }

  .clinic-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    margin-top: 1rem;
    border-radius: 18px;
  }

  .clinic-hero-content {
    padding: 1.5rem;
  }

  .clinic-hero h1 {
    font-size: clamp(2rem, 12vw, 3.1rem);
  }

  .clinic-hero-media {
    min-height: 230px;
    order: -1;
  }

  .clinic-hero-media-placeholder-only {
    display: none;
  }

  .clinic-hero-media::after {
    background: linear-gradient(0deg, rgba(244, 228, 209, 0.5), transparent 45%);
  }

  .clinic-hero-logo,
  .clinic-hero-placeholder {
    min-height: 230px;
  }

  .clinic-hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .clinic-hero-actions [role="button"] {
    width: 100%;
  }

  .clinic-rating {
    padding-left: 0;
    border-left: 0;
  }

  .clinic-section-nav {
    margin-bottom: 2.5rem;
  }

  .clinic-section-nav-inner {
    gap: 1.15rem;
  }

  .clinic-content-section,
  .clinic-booking-section {
    margin-bottom: 3.2rem;
  }

  .clinic-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .clinic-section-header > p {
    text-align: left;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .doctors-grid {
    grid-template-columns: 1fr;
  }

  .doctor-card {
    min-height: 0;
  }

  .doctor-avatar {
    width: 64px;
    height: 64px;
  }

  .doctor-profile-card {
    padding: 1.25rem;
  }

  .doctor-profile-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .doctor-profile-photo {
    width: 112px;
    height: 112px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 130px;
  }

  .gallery-thumbnail:first-child {
    grid-row: span 2;
    grid-column: span 2;
  }

  .gallery-lightbox-image {
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 8rem);
  }

  .gallery-lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
  }

  .gallery-lightbox-previous {
    left: 0.5rem;
  }

  .gallery-lightbox-next {
    right: 0.5rem;
  }

  .gallery-lightbox-counter {
    bottom: 0.5rem;
  }

  .clinic-booking-section {
    padding: 1.2rem;
  }

  .clinic-booking-layout,
  .reviews-list {
    grid-template-columns: 1fr;
  }

  .reviews-summary {
    margin-top: 0.25rem;
  }

  .auth-card {
    margin: 1rem;
    padding: 1.5rem;
  }

  .profile-card {
    margin: 1rem;
  }

  .dashboard-card {
    padding: 1rem;
  }

  .services-table {
    font-size: 0.85rem;
  }

  .form-actions {
    flex-direction: column;
  }
}
