/* ============================================
   Форма записи к врачу — Virilisgroup
   Префикс: .vg-appointment-*
   ============================================ */

/* ---------- Reset & Container ---------- */
.vg-appointment-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, .45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.vg-appointment-overlay.vg-active {
  display: flex;
}

.vg-appointment-modal {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #1a1a1a;
  line-height: 1.45;
}

/* ---------- Header ---------- */
.vg-appointment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.vg-appointment-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}
.vg-appointment-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.vg-appointment-close:hover {
  background: #e0e0e0;
}
.vg-appointment-close svg {
  width: 18px;
  height: 18px;
  stroke: #666;
}

/* ---------- Progress ---------- */
.vg-appointment-progress {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
  flex-shrink: 0;
}
.vg-appointment-progress-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e8e8e8;
  transition: background .3s;
}
.vg-appointment-progress-step.vg-done {
  background: #009F8F;
}
.vg-appointment-progress-step.vg-current {
  background: #E2378D;
}

/* ---------- Body (scrollable) ---------- */
.vg-appointment-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 24px;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Step containers ---------- */
.vg-appointment-step {
  display: none;
}
.vg-appointment-step.vg-active {
  display: block;
  animation: vgFadeIn .25s ease;
}
@keyframes vgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vg-appointment-step-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  color: #333;
}

/* ---------- Step 1: Age toggle ---------- */
.vg-appointment-age-toggle {
  display: flex;
  gap: 12px;
}
.vg-appointment-age-btn {
  flex: 1;
  padding: 28px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  font-size: 15px;
  font-weight: 500;
  color: #444;
}
.vg-appointment-age-btn:hover {
  border-color: #E2378D;
  background: #fef0f5;
}
.vg-appointment-age-btn.vg-selected {
  border-color: #E2378D;
  background: #fce4ef;
  color: #b82870;
  font-weight: 600;
}
.vg-appointment-age-btn-icon {
  display: block;
  font-size: 36px;
  margin-bottom: 8px;
  line-height: 1;
}

/* ---------- Step 2: Medical center cards ---------- */
.vg-appointment-centers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vg-appointment-center-card {
  padding: 16px 18px;
  border: 2px solid #eee;
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
}
.vg-appointment-center-card:hover {
  border-color: #E2378D;
  background: #fef0f5;
}
.vg-appointment-center-card.vg-selected {
  border-color: #E2378D;
  background: #fce4ef;
}
.vg-appointment-center-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.vg-appointment-center-logo {
  width: 64px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vg-appointment-center-logo img {
  max-width: 64px;
  max-height: 44px;
  object-fit: contain;
}
.vg-appointment-center-info {
  flex: 1;
  min-width: 0;
}
.vg-appointment-center-name {
  font-weight: 600;
  font-size: 15px;
  color: #1a1a1a;
  margin-bottom: 2px;
}
.vg-appointment-center-address {
  font-size: 13px;
  color: #777;
}
.vg-appointment-center-metro {
  font-size: 12px;
  color: #E2378D;
  margin-top: 3px;
}

/* ---------- Step 3: Tabs ---------- */
.vg-appointment-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 2px solid #eee;
}
.vg-appointment-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #888;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
  font-family: inherit;
}
.vg-appointment-tab:hover {
  color: #E2378D;
}
.vg-appointment-tab.vg-tab-active {
  color: #E2378D;
  border-bottom-color: #E2378D;
  font-weight: 600;
}

/* ---------- Step 3: Speciality select ---------- */
.vg-appointment-search {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
  margin-bottom: 12px;
  font-family: inherit;
}
.vg-appointment-search:focus {
  border-color: #E2378D;
}

.vg-appointment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
}
.vg-appointment-list li {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  font-size: 15px;
}
.vg-appointment-list li:hover {
  background: #fef0f5;
}
.vg-appointment-list li.vg-selected {
  background: #fce4ef;
  font-weight: 600;
  color: #b82870;
}

/* ---------- Step 3: Doctor cards ---------- */
.vg-appointment-doctors {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.vg-appointment-doctor-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 2px solid #eee;
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
}
.vg-appointment-doctor-card:hover {
  border-color: #E2378D;
  background: #fef0f5;
}
.vg-appointment-doctor-card.vg-selected {
  border-color: #E2378D;
  background: #fce4ef;
}
.vg-appointment-doctor-card.vg-any-doctor {
  justify-content: center;
  padding: 16px;
  border-style: dashed;
  color: #555;
  font-weight: 500;
}

.vg-appointment-doctor-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #f0f0f0;
  flex-shrink: 0;
}
.vg-appointment-doctor-photo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #999;
  font-size: 22px;
  font-weight: 600;
}

.vg-appointment-doctor-info {
  flex: 1;
  min-width: 0;
}
.vg-appointment-doctor-name {
  font-weight: 600;
  font-size: 15px;
  color: #1a1a1a;
  margin-bottom: 3px;
}
.vg-appointment-doctor-spec {
  font-size: 13px;
  color: #777;
}

/* ---------- Step 4: Date picker ---------- */
.vg-appointment-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.vg-appointment-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.vg-appointment-cal-header span {
  font-weight: 600;
  font-size: 16px;
}
.vg-appointment-cal-nav {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  font-size: 18px;
  color: #555;
}
.vg-appointment-cal-nav:hover {
  background: #e0e0e0;
}
.vg-appointment-cal-nav:disabled {
  opacity: .3;
  cursor: default;
}

.vg-appointment-cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #999;
  padding: 4px 0;
  text-transform: uppercase;
}

.vg-appointment-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  cursor: default;
  color: #ccc;
  border: none;
  background: none;
  font-family: inherit;
}
.vg-appointment-cal-day.vg-available {
  color: #1a1a1a;
  cursor: pointer;
  font-weight: 500;
  background: #f5f5f5;
}
.vg-appointment-cal-day.vg-available:hover {
  background: #fce4ef;
  color: #b82870;
}
.vg-appointment-cal-day.vg-selected {
  background: #E2378D;
  color: #fff;
  font-weight: 600;
}
.vg-appointment-cal-day.vg-today {
  outline: 2px solid #E2378D;
  outline-offset: -2px;
}
.vg-appointment-cal-day.vg-empty {
  visibility: hidden;
}

/* ---------- Step 5: Time slots ---------- */
.vg-appointment-times {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.vg-appointment-time-slot {
  padding: 14px 10px;
  border: 2px solid #eee;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fff;
  font-family: inherit;
}
.vg-appointment-time-slot:hover {
  border-color: #E2378D;
  background: #fef0f5;
}
.vg-appointment-time-slot.vg-selected {
  border-color: #E2378D;
  background: #fce4ef;
}
.vg-appointment-time-value {
  font-size: 17px;
  font-weight: 600;
  color: #1a1a1a;
}
.vg-appointment-time-duration {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

/* ---------- Step 6: Contact form ---------- */
.vg-appointment-form-group {
  margin-bottom: 16px;
}
.vg-appointment-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.vg-appointment-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
  font-family: inherit;
}
.vg-appointment-input:focus {
  border-color: #E2378D;
}
.vg-appointment-input.vg-error {
  border-color: #e53935;
}
.vg-appointment-error-text {
  font-size: 12px;
  color: #e53935;
  margin-top: 4px;
  display: none;
}
.vg-appointment-error-text.vg-visible {
  display: block;
}

.vg-appointment-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
}
.vg-appointment-textarea:focus {
  border-color: #E2378D;
}

/* ---------- Summary ---------- */
.vg-appointment-summary {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.vg-appointment-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}
.vg-appointment-summary-label {
  color: #888;
}
.vg-appointment-summary-value {
  font-weight: 600;
  color: #333;
  text-align: right;
}

/* ---------- Footer / Buttons ---------- */
.vg-appointment-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.vg-appointment-btn-back {
  padding: 12px 20px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #555;
  transition: all .2s;
  font-family: inherit;
}
.vg-appointment-btn-back:hover {
  background: #f5f5f5;
}

.vg-appointment-btn-next {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: #E2378D;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all .2s;
  font-family: inherit;
}
.vg-appointment-btn-next:hover {
  background: #c42e7a;
}
.vg-appointment-btn-next:disabled {
  background: #ccc;
  cursor: default;
}

/* ---------- Step 7: Result ---------- */
.vg-appointment-result {
  text-align: center;
  padding: 20px 0;
}
.vg-appointment-result-icon {
  font-size: 56px;
  margin-bottom: 16px;
}
.vg-appointment-result h3 {
  font-size: 20px;
  margin: 0 0 10px;
  font-weight: 600;
}
.vg-appointment-result p {
  color: #666;
  font-size: 15px;
  margin: 0 0 8px;
  line-height: 1.5;
}
.vg-appointment-result-note {
  font-size: 13px;
  color: #999;
  font-style: italic;
  margin-top: 12px;
}
.vg-appointment-result-error h3 {
  color: #c62828;
}

/* ---------- Loading ---------- */
.vg-appointment-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: #888;
  font-size: 14px;
  gap: 12px;
}
.vg-appointment-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e8e8e8;
  border-top-color: #E2378D;
  border-radius: 50%;
  animation: vgSpin .7s linear infinite;
}
@keyframes vgSpin {
  to { transform: rotate(360deg); }
}

/* ---------- Empty state ---------- */
.vg-appointment-empty {
  text-align: center;
  padding: 32px 0;
  color: #999;
  font-size: 14px;
}

/* ---------- Consent ---------- */
.vg-appointment-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}
.vg-appointment-consent input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}

/* ---------- Убираем чёрные аутлайны по клику / фокусу ---------- */
.vg-appointment-modal *:focus {
  outline: none;
  box-shadow: none;
}
/* Оставляем видимый фокус только для навигации с клавиатуры */
.vg-appointment-modal button:focus-visible,
.vg-appointment-modal input:focus-visible,
.vg-appointment-modal textarea:focus-visible {
  outline: 2px solid #E2378D;
  outline-offset: 2px;
}
.vg-appointment-list li:focus {
  outline: none;
}

/* ---------- Honeypot (скрыт от людей) ---------- */
.vg-appointment-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .vg-appointment-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .vg-appointment-modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
  }
  .vg-appointment-header {
    padding: 16px 16px 12px;
  }
  .vg-appointment-body {
    padding: 16px;
  }
  .vg-appointment-footer {
    padding: 12px 16px 16px;
  }
  .vg-appointment-age-toggle {
    gap: 8px;
  }
  .vg-appointment-age-btn {
    padding: 20px 12px;
  }
  .vg-appointment-times {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  .vg-appointment-calendar {
    gap: 4px;
  }
}
