/*
 * HotelAmbit Booking Engine - Frontend styles
 * Mobile-first, lightweight, no external dependencies.
 */

:root {
  --hb-primary: #1e40af;
  --hb-background: #ffffff;
  --hb-text: #1f2937;
  --hb-radius: 0.5rem;
  --hb-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --hb-transition: 200ms ease-in-out;
}

/* Admin tweaks */
.hotelambit-admin .form-table input[type="color"] {
  width: 60px;
  height: 32px;
  padding: 0;
  border: 1px solid #8c8f94;
  border-radius: 4px;
}

.hotelambit-admin textarea.code {
  font-family: monospace;
}

/* Frontend container */
.hotelambit-booking {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem 0;
  color: var(--hb-text);
  background-color: var(--hb-background);
  border-radius: var(--hb-radius);
  box-sizing: border-box;
}

.hotelambit-booking *,
.hotelambit-booking *::before,
.hotelambit-booking *::after {
  box-sizing: inherit;
}

/* Buttons */
.hotelambit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--hb-radius);
  cursor: pointer;
  transition: background-color var(--hb-transition), border-color var(--hb-transition), transform var(--hb-transition);
}

.hotelambit-button:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.hotelambit-button--primary {
  color: #ffffff;
  background-color: var(--hb-primary);
  border-color: var(--hb-primary);
}

.hotelambit-button--primary:hover,
.hotelambit-button--primary:focus {
  filter: brightness(1.1);
}

.hotelambit-button--secondary {
  color: var(--hb-primary);
  background-color: transparent;
  border-color: var(--hb-primary);
}

.hotelambit-button--secondary:hover,
.hotelambit-button--secondary:focus {
  background-color: rgba(30, 64, 175, 0.08);
}

.hotelambit-button--ghost {
  color: var(--hb-text);
  background-color: transparent;
  border-color: transparent;
  text-decoration: underline;
}

.hotelambit-button--ghost:hover,
.hotelambit-button--ghost:focus {
  color: var(--hb-primary);
}

/* Consent placeholder */
.hotelambit-consent-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 220px;
  padding: 2rem;
  text-align: center;
  background-color: var(--hb-background);
  border: 2px dashed rgba(0, 0, 0, 0.15);
  border-radius: var(--hb-radius);
}

.hotelambit-consent-placeholder__icon {
  font-size: 2.5rem;
  line-height: 1;
}

.hotelambit-consent-placeholder__text {
  max-width: 480px;
  margin: 0;
  font-size: 1rem;
}

/* Widget frame wrapper */
.hotelambit-booking__frame-wrapper {
  position: relative;
  width: 100%;
  min-height: 320px;
  border-radius: var(--hb-radius);
  overflow: hidden;
  background-color: var(--hb-background);
  box-shadow: var(--hb-shadow);
}

.hotelambit-booking__frame-wrapper iframe {
  display: block;
  width: 100%;
  min-height: 320px;
  border: 0;
}

.hotelambit-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--hb-text);
  background-color: var(--hb-background);
  opacity: 1;
  transition: opacity var(--hb-transition);
}

.hotelambit-booking__frame-wrapper iframe[src] + .hotelambit-loader,
.hotelambit-booking__frame-wrapper--loaded .hotelambit-loader {
  opacity: 0;
  pointer-events: none;
}

/* Modal */
.hotelambit-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.hotelambit-modal.is-open {
  display: flex;
}

.hotelambit-modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
}

.hotelambit-modal__content {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  padding: 1rem;
  background-color: var(--hb-background);
  border-radius: var(--hb-radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.hotelambit-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--hb-text);
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: 50%;
}

.hotelambit-modal__close:hover,
.hotelambit-modal__close:focus {
  background-color: rgba(0, 0, 0, 0.08);
}

.hotelambit-modal__content .hotelambit-booking__frame-wrapper {
  min-height: 60vh;
  max-height: calc(90vh - 2rem);
  box-shadow: none;
}

.hotelambit-modal__content .hotelambit-booking__frame-wrapper iframe {
  min-height: 60vh;
  max-height: calc(90vh - 2rem);
}

/* Cookie banner */
.hotelambit-cookie-banner {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99998;
  padding: 1rem;
  color: var(--hb-text);
  background-color: var(--hb-background);
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(0);
  transition: transform var(--hb-transition);
}

.hotelambit-cookie-banner.is-hidden {
  transform: translateY(120%);
}

.hotelambit-cookie-banner__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hotelambit-cookie-banner__text {
  font-size: 0.9375rem;
  line-height: 1.5;
}

.hotelambit-cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hotelambit-cookie-banner__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
}

.hotelambit-cookie-banner__legal a {
  color: var(--hb-primary);
  text-decoration: underline;
}

.hotelambit-cookie-banner__legal a:hover,
.hotelambit-cookie-banner__legal a:focus {
  text-decoration: none;
}

/* Cookie preferences panel */
.hotelambit-cookie-preferences {
  max-width: 1200px;
  margin: 1rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.hotelambit-cookie-preferences[hidden] {
  display: none;
}

.hotelambit-cookie-preferences__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}

.hotelambit-cookie-preferences__info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hotelambit-cookie-preferences__info span {
  font-size: 0.8125rem;
  color: rgba(0, 0, 0, 0.6);
}

.hotelambit-cookie-preferences__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

/* Toggle switch */
.hotelambit-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.hotelambit-toggle input {
  width: 0;
  height: 0;
  opacity: 0;
}

.hotelambit-toggle__slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: #ccc;
  border-radius: 26px;
  transition: background-color var(--hb-transition);
}

.hotelambit-toggle__slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform var(--hb-transition);
}

.hotelambit-toggle input:checked + .hotelambit-toggle__slider {
  background-color: var(--hb-primary);
}

.hotelambit-toggle input:checked + .hotelambit-toggle__slider::before {
  transform: translateX(22px);
}

.hotelambit-toggle input:disabled + .hotelambit-toggle__slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Admin notice */
.hotelambit-notice--admin {
  padding: 1rem;
  color: #92400e;
  background-color: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: var(--hb-radius);
}

/* Responsive */
@media (min-width: 768px) {
  .hotelambit-cookie-banner__content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .hotelambit-cookie-banner__actions {
    flex-shrink: 0;
  }

  .hotelambit-cookie-banner__legal {
    width: 100%;
  }

  .hotelambit-booking__frame-wrapper {
    min-height: 420px;
  }

  .hotelambit-booking__frame-wrapper iframe {
    min-height: 420px;
  }
}

@media (min-width: 1024px) {
  .hotelambit-booking__frame-wrapper {
    min-height: 520px;
  }

  .hotelambit-booking__frame-wrapper iframe {
    min-height: 520px;
  }

  .hotelambit-modal__content {
    padding: 1.5rem;
  }
}

/* Integration: Luxuryo room sidebar */
.hotelambit-room-booking .hotelambit-booking {
  margin: 0;
  box-shadow: none;
}

.hotelambit-room-booking .hotelambit-consent-placeholder,
.hotelambit-room-booking .hotelambit-booking__frame-wrapper {
  min-height: 360px;
}

.hotelambit-room-booking .hotelambit-booking__frame-wrapper iframe {
  min-height: 360px;
}

.hotelambit-room-booking .hotelambit-button--primary {
  width: 100%;
}

.hotelambit-room-booking .hotelambit-modal__content {
  max-width: 960px;
}
