/* Основной контейнер плагина */
:root {
  /* Определяем CSS переменные для цветов по умолчанию. Они будут переопределены инлайн-стилями. */
  --ohr-main-color: #24a9b3;
  --ohr-hover-color: #1d8a93;
  --ohr-slot-bg-color: #ffffff;
  --ohr-container-bg-color: #f9f9f9;
  --ohr-day-column-bg-color: #ffffff;
  --ohr-day-header-bg-color: #eeeeee;
  --ohr-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; /* System Default */
}

.ohr-booking-container {
  font-family: var(--ohr-font-family);
  width: 100%;
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
  box-sizing: border-box;
  background-color: var(--ohr-container-bg-color);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

/* Область для сообщений */
.ohr-message-area {
  margin-bottom: 20px;
}

/* Wochennavigation */
.ohr-week-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.ohr-week-nav span.ohr-current-month-year {
  font-weight: bold;
  font-size: 1.2em;
  color: #333;
}

.ohr-nav-button {
  background-color: var(--ohr-main-color);
  color: white;
  padding: 8px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.3s ease, opacity 0.3s ease;
}

.ohr-nav-button:hover:not(.disabled) {
  background-color: var(--ohr-hover-color);
  opacity: 0.9;
  color: white;
}
.ohr-nav-button.disabled {
  background-color: #ccc !important;
  border-color: #ccc !important;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Kalender Grid */
.ohr-calendar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 15px;
}

.ohr-day-column {
  background-color: var(--ohr-day-column-bg-color);
  border: 1px solid #eee;
  border-radius: 5px;
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ohr-day-header {
  background-color: var(--ohr-day-header-bg-color);
  padding: 10px 5px;
  font-weight: bold;
  border-bottom: 1px solid #eee;
  font-size: 0.9em;
  word-wrap: break-word;
  color: #333;
}

.ohr-time-slots {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.ohr-time-slot {
  background-color: var(--ohr-slot-bg-color);
  border: 1px solid var(--ohr-main-color);
  color: var(--ohr-main-color);
  padding: 10px 5px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease,
    border-color 0.2s ease, box-shadow 0.2s ease;
  font-size: 0.9em;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.ohr-time-slot:hover:not(:disabled):not(.admin-blocked):not(.already-booked) {
  background-color: var(
    --ohr-hover-color
  ) !important; /* !important для перекрытия инлайн стилей, если они тоже меняют фон */
  color: #fff !important;
  border-color: var(--ohr-hover-color) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Стили для неактивных слотов */
.ohr-time-slot.disabled,
.ohr-time-slot.admin-blocked,
.ohr-time-slot.already-booked,
.ohr-time-slot.past-slot {
  background-color: #e9e9e9 !important;
  border-color: #dcdcdc !important;
  color: #aaa !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}
/* Добавляем перечеркивание только для занятых и заблокированных */
.ohr-time-slot.admin-blocked,
.ohr-time-slot.already-booked {
  text-decoration: line-through;
}
/* Убираем перечеркивание для прошедших слотов */
.ohr-time-slot.past-slot {
  text-decoration: none;
}

/* Сообщение об отсутствии дней */
.ohr-no-days-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px 20px;
  color: #757575;
  font-style: italic;
  background-color: #fff;
  border: 1px dashed #eee;
  border-radius: 5px;
}

/* Formularansicht */
.ohr-form-view {
  padding: 25px;
  overflow: hidden;
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 5px;
  margin-top: 20px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
.ohr-form-view h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.4em;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

/* Календарь */
#ohr-calendar-view {
  background-color: transparent;
  border: none;
  padding: 0;
  margin: 0;
}
#ohr-calendar-view h2 {
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
  font-size: 1.4em;
  color: #333;
}

/* Отображение выбранного слота */
#ohr-selected-slot-display {
  color: var(--ohr-main-color);
  font-weight: bold;
}
#ohr-change-slot {
  color: var(--ohr-main-color);
  text-decoration: underline;
  cursor: pointer;
}
#ohr-change-slot:hover {
  color: var(--ohr-hover-color);
}

/* Группы полей формы */
.ohr-form-group {
  margin-bottom: 20px;
}

.ohr-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #444;
  font-size: 0.95em;
}
.ohr-form-group label .required {
  color: #e53935;
  font-weight: bold;
  margin-left: 3px;
}

.ohr-form-group input[type="text"],
.ohr-form-group input[type="email"],
.ohr-form-group input[type="tel"],
.ohr-form-group select,
.ohr-form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1em;
  transition: border-color 0.3s ease;
}
.ohr-form-group input:focus,
.ohr-form-group select:focus,
.ohr-form-group textarea:focus {
  border-color: var(--ohr-main-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(36, 169, 179, 0.2);
}

.ohr-form-group select {
  /* Внешний вид для select */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpolygon%20points%3D%220%2C0%2020%2C0%2010%2C10%22%20style%3D%22fill%3A%23666666%3B%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  padding-right: 30px;
}

.ohr-form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* Поля с ошибками валидации */
input.ohr-input-error,
select.ohr-input-error,
textarea.ohr-input-error {
  border-color: #e53935 !important;
  background-color: #fff8f8;
}
.ohr-validation-message {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 10px 15px;
  margin-bottom: 20px;
  border-radius: 4px;
  font-size: 0.95em;
}
.ohr-validation-message ul {
  margin: 5px 0 0 20px;
  padding: 0;
}

/* Кнопки формы */
.ohr-form-actions {
  margin-top: 25px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ohr-submit-button,
.ohr-back-button {
  background-color: var(--ohr-main-color);
  color: white;
  padding: 12px 25px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: bold;
  transition: background-color 0.3s ease, opacity 0.3s ease, transform 0.1s ease;
  flex-grow: 1;
}

.ohr-submit-button:hover {
  background-color: var(--ohr-hover-color);
  opacity: 0.95;
  transform: translateY(-1px);
}
.ohr-submit-button:active {
  transform: translateY(0px);
}

.ohr-back-button {
  background-color: #757575 !important;
  border-color: #757575 !important;
  flex-grow: 0;
}
.ohr-back-button:hover {
  background-color: #555 !important;
  border-color: #555 !important;
  opacity: 1;
  transform: translateY(-1px);
}
.ohr-back-button:active {
  transform: translateY(0px);
}

/* НОВЫЙ Индикатор загрузки (Оверлей) */
#ohr-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  border-radius: 8px;
}

#ohr-loading-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.ohr-loading-spinner {
  text-align: center;
}

.ohr-spinner-circle {
  width: 50px;
  height: 50px;
  margin: 0 auto 15px;
  border: 5px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--ohr-main-color);
  animation: ohr-spin 0.8s linear infinite;
}
#ohr-loading-overlay p {
  color: #333;
  font-weight: bold;
  margin: 0;
}

@keyframes ohr-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Company Info Styles */
.ohr-company-info {
  margin-bottom: 25px;
  padding: 15px;
  background-color: var(
    --ohr-day-column-bg-color,
    #ffffff
  ); /* Используем цвет колонки дня */
  border: 1px solid #eee;
  border-left: 4px solid var(--ohr-main-color, #24a9b3); /* Акцентная полоса слева */
  border-radius: 4px;
  font-size: 0.9em;
  color: #555;
}

.ohr-company-info h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--ohr-main-color, #24a9b3);
  font-size: 1.1em;
}
.ohr-company-info p {
  margin: 5px 0;
  line-height: 1.5;
}
.ohr-company-info a {
  color: var(--ohr-main-color);
  text-decoration: none;
}
.ohr-company-info a:hover {
  text-decoration: underline;
}

/* Meldungen (Error/Success) */
.ohr-error,
.ohr-success {
  padding: 15px 20px;
  margin: 0 0 20px 0;
  border-radius: 5px;
  border-width: 1px;
  border-style: solid;
}
.ohr-error {
  background-color: #ffebee;
  color: #c62828;
  border-color: #ef9a9a;
}
.ohr-error strong {
  color: #b71c1c;
}
.ohr-error ul {
  margin: 10px 0 0 20px;
  padding: 0;
}
.ohr-error ul li {
  margin-bottom: 5px;
}

.ohr-success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border-color: #a5d6a7;
}
.ohr-success h2 {
  margin: 0 0 10px 0;
  color: #1b5e20;
  font-size: 1.3em;
}
.ohr-success h3 {
  margin: 15px 0 8px 0;
  color: #1b5e20;
  font-size: 1.1em;
  border-bottom: 1px solid #c8e6c9;
  padding-bottom: 5px;
}
.ohr-success p {
  margin: 5px 0;
  line-height: 1.6;
}
.ohr-success .ohr-booking-details {
  margin-top: 15px;
}
.ohr-success strong {
  color: #1b5e20;
}

/* Responsivität */
@media (max-width: 992px) {
  .ohr-calendar-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .ohr-booking-container {
    padding: 15px;
    margin: 15px auto;
  }
  .ohr-calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ohr-week-nav {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .ohr-week-nav span.ohr-current-month-year {
    order: -1;
    text-align: center;
    margin-bottom: 10px;
  }
  .ohr-nav-button {
    text-align: center;
  }
  .ohr-form-view {
    max-width: 100%;
    padding: 20px;
  }
  .ohr-form-actions {
    flex-direction: column;
  }
  .ohr-back-button {
    order: 1;
  }
}

@media (max-width: 480px) {
  .ohr-booking-container {
    padding: 10px;
    margin: 10px auto;
    border-radius: 5px;
  }
  .ohr-calendar-grid {
    grid-template-columns: 1fr;
  }
  .ohr-form-group button {
    width: 100%;
  }
  .ohr-week-nav span.ohr-current-month-year {
    font-size: 1.1em;
  }
  .ohr-nav-button {
    padding: 10px 15px;
    font-size: 1em;
  }
  .ohr-day-header {
    font-size: 0.85em;
  }
  .ohr-time-slot {
    font-size: 0.9em;
    padding: 10px 5px;
  }
  .ohr-form-view {
    padding: 15px;
  }
  .ohr-submit-button,
  .ohr-back-button {
    font-size: 1em;
    padding: 12px 20px;
  }
}
