/* Main container */
.wtps-appointment {

  --appointmentfontsize: 16px;
  --appointmenttitlessize: var(--appointmentfontsize);
  --appointmenttitlescolor: var(--bodycolortext, #333);
  --appointmenttextcolor: var(--bodycolortext, #333);
  --appointmenttextcolorselected: var(--bodycolorbackground, #fff);
  --appointmentbordercolor: transparent;
  --appointmentborderradius: 8px;
  --appointmentcardbgcolor: rgba(170, 170, 170, 0.2);
  --appointmentcardbgcolorselected: var(--bodycolorprimary, #333);
  --appointmentselectssize: var(--appointmentfontsize);
  --appointmentselectcolor: var(--appointmenttextcolor);
  --appointmentselectbackground: var(--appointmentcardbgcolor);
  --appointmentselectborderradius: var(--appointmentborderradius);

  --ap-size-md: var(--appointmentfontsize, 16px);
  --ap-size-lg: calc(var(--ap-size-md) * 2);
  --ap-size-sm: calc(var(--ap-size-md) * 0.5);
  font-size: var(--appointmentfontsize);
  color: var(--appointmenttitlescolor);
  max-width: 100%;
  gap: var(--ap-size-md);
  display: flex;
  flex-direction: column;
  width: 100%;
  user-select: none;
}

.wtps-appointment-content {
  display: flex;
  flex-direction: column;
  gap: calc(var(--appointmenttitlessize) * 2.5);
  width: 100%;
}

/* calendars selector */
.wtps-appointment-calendars-selector {
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.wtps-appointment-calendars-selector label {
  display: block;
  margin-bottom: var(--ap-size-sm);
  font-weight: 500;
  color: var(--appointmenttitlescolor);
  font-size: smaller;
}

.wtps-appointment-calendars-select {
  font-size: var(--appointmentselectssize);
  padding: calc(var(--appointmentselectssize) * 0.75);
  padding-right: calc(var(--appointmentselectssize) * 2);
  border-radius: var(--appointmentselectborderradius);
  border: 1px solid var(--appointmentbordercolor);
  background: var(--appointmentselectbackground);
  width: fit-content;
  max-width: 100%;
  color: var(--appointmentselectcolor);
  appearance: none;
  cursor: pointer;
}

.wtps-appointment-calendars-select option {
  color: #000;
}

.wtps-appointment-calendars-select-wrapper {
  width: fit-content;
  max-width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.wtps-appointment-calendars-select-wrapper::after {
  pointer-events: none;
  content: "";
  position: absolute;
  bottom: calc(var(--appointmentselectssize) * 0.6);
  right: calc(var(--appointmentselectssize) * 0.25);
  content: "";
  background-color: var(--appointmentselectcolor);
  mask: url("data:image/svg+xml,%3Csvg fill='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  mask-position: center;
  mask-repeat: no-repeat;
  width: calc(var(--appointmentselectssize) * 1.5);
  height: calc(var(--appointmentselectssize) * 1.5);
}

.wtps-appointment-calendar {
  display: flex;
  flex-direction: column;
  gap: var(--ap-size-md);
}

.wtps-appointment-calendar-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--ap-size-sm);
}

.wtps-appointment-title,
.wtps-form-title {
  font-size: var(--appointmenttitlessize, var(--appointmentfontsize));
  font-weight: 600;
  color: var(--appointmenttitlescolor, var(--bodycolortext));
  margin-bottom: var(--ap-size-md);
}

.wtps-appointment-calendar-month {
  user-select: none;
  text-transform: capitalize;
  text-align: center;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--appointmentfontsize);
  font-weight: 600;
  color: var(--appointmenttitlescolor, var(--bodycolortext));
}

.wtps-appointment-calendar-today-button,
.wtps-appointment-nav-button {
  user-select: none;
  padding: var(--ap-size-sm);
  cursor: pointer;
  color: var(--appointmenttextcolor);
  font-weight: 500;
  border: 1px solid var(--appointmentbordercolor);
  border-radius: var(--appointmentborderradius);
  background: var(--appointmentcardbgcolor);
  font-size: smaller;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wtps-appointment-nav-button {
  background-color: transparent;
}

.wtps-appointment-nav-button svg {
  fill: currentColor;
  width: calc(var(--ap-size-md) * 0.8);
  height: calc(var(--ap-size-md) * 0.8);
}

.wtps-appointment-calendar-today-button.disabled,
.wtps-appointment-nav-button.prev.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Calendar container */
.wtps-appointment-calendar-dates {
  overflow: hidden;
  width: 100%;
  position: relative;
  display: flex;
}

.wtps-appointment-dates {
  display: flex;
  gap: var(--ap-size-sm);
  transition: transform 0.4s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
  width: 100%;
}

.wtps-appointment-day.fictitious {
  opacity: 0.3;
  pointer-events: none;
}

.wtps-appointment-weekdays {
  display: flex;
  background-color: var(--appointmentcardbgcolor);
  border-bottom: 1px solid var(--appointmentbordercolor);
  text-transform: capitalize;
}

.wtps-appointment-dates {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ap-size-sm);
}

.wtps-appointment-day {
  user-select: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  aspect-ratio: 1/1;
  border: 1px solid var(--appointmentbordercolor);
  border-radius: var(--appointmentborderradius);
  color: var(--appointmenttextcolor);
  background-color: var(--appointmentcardbgcolor);
  padding: var(--ap-size-md);
}

.wtps-appointment-day:hover,
.wtps-appointment-time:hover,
.wtps-appointment-nav-button:hover,
.wtps-appointment-calendar-today-button:hover {
  transform: scale(0.98);
}

.wtps-appointment-day.selected {
  pointer-events: none;
  background-color: var(--appointmentcardbgcolorselected);
  color: var(--appointmenttextcolorselected);
  border: var(--appointmentcardbgcolorselected);
}

.wtps-appointment-day.disabled {
  opacity: 0.5;
}

.wtps-appointment-day-number {
  font-size: calc(var(--appointmentfontsize) * 1.3);
  font-weight: 600;
  margin-bottom: calc(var(--appointmentfontsize) * 0.5);
}

.wtps-appointment-weekday {
  font-size: var(--appointmentfontsize);
  opacity: 0.8;
  text-transform: capitalize;
}

.wtps-appointment-time-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--ap-size-lg) * 4), 1fr));
  gap: var(--ap-size-sm);
}

.wtps-appointment-time {
  user-select: none;
  text-align: center;
  border: 1px solid var(--appointmentbordercolor);
  border-radius: var(--appointmentborderradius);
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--appointmentcardbgcolor);
  color: var(--appointmenttextcolor);
  width: fit-content;
  padding: var(--ap-size-md) var(--ap-size-lg);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.wtps-appointment-time.selected {
  pointer-events: none;
  background-color: var(--appointmentcardbgcolorselected);
  color: var(--appointmenttextcolorselected);
  border-color: var(--appointmentcardbgcolorselected);
}

.wtps-appointment-form-footer {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--ap-size-md);
}

.wtps-appointment-summary {
  flex-grow: 1;
  text-align: end;
  font-size: calc(var(--appointmentfontsize) * 0.9);
  opacity: 0.8;
  font-weight: 500;
}

/* Form buttons */
.wtps-appointment-form-buttons {
  display: flex;
  gap: var(--ap-size-sm);
  justify-content: flex-end;
}

.wtps-appointment-submit,
.wtps-appointment-return,
.wtps-appointment-get-availability,
.wtps-appointment-cart-button,
.wtps-appointment-error-button {
  padding: var(--ap-size-sm);
  background-color: var(--appointmentcardbgcolorselected);
  color: var(--appointmenttextcolorselected);
  border: none;
  border-radius: var(--appointmentborderradius);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wtps-appointment-get-availability,
.wtps-appointment-error-button {
  padding: var(--ap-size-md) var(--ap-size-lg);
}

.wtps-appointment-get-availability:hover {
  opacity: 0.8;
}

.wtps-appointment-cart-button {
  margin-left: auto;
}

.wtps-appointment-error-button {
  margin-top: var(--ap-size-md);
}

.wtps-appointment-error-title {
  font-weight: 600;
}

.wtps-appointment-submit:hover {
  opacity: 0.9;
}

.wtps-appointment-wrapper-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--ap-size-md);
  min-height: 400px;
}

/* Success message */
.wtps-appointment-success {
  text-align: center;
  padding: var(--ap-size-lg);
}

.wtps-appointment-success-icon {
  color: var(--appointmenttextcolor);
  margin-bottom: var(--ap-size-md);
}

.wtps-appointment-success-icon svg,
.wtps-appointment-error-icon svg {
  fill: currentColor;
  width: calc(var(--ap-size-md) * 1.5);
  height: calc(var(--ap-size-md) * 1.5);
}

.wtps-appointment-success-title {
  font-size: inherit;
  margin-bottom: var(--ap-size-sm);
  font-weight: 600;
}

.wtps-appointment-success-message {
  color: var(--appointmenttextcolor);
}

.wtps-appointment-return:hover {
  opacity: 0.9;
}

.wtps-appointment-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--appointmentcardbgcolorselected);
  animation: spin 1s ease-in-out infinite;
}

.wtps-appointment-empty-day {
  min-height: 200px;
}

.wtps-appointment-empty-day .wtps-appointment-empty-day-message {
  font-size: inherit;
  font-weight: 500;
  color: var(--appointmenttextcolor);
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.wtps-appointment-hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .wtps-appointment-form-inputs {
    flex-direction: column;
  }

  .wtps-appointment-calendar-dates,
  .wtps-appointment-dates {
    gap: 5px;
  }

  .wtps-appointment-form-footer {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

}

@media (max-width: 480px) {
  .wtps-appointment-days-container {
    justify-content: flex-start;
    width: 100%;
  }

  .wtps-appointment-wrapper-state {
    min-height: 250px;
  }
}

/* ESTADO CARGANDO */
body:has(#appointment-loader) {
  overflow: hidden;
}

#appointment-loader {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: #FFFFFF;
}

.appointment-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #FFFFFF;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}


/* Página calendario en proceso de compra */
.wtps-page-appointment {
  width: 100%;
  max-width: var(--sectionmaxwidth);
  margin: 0 auto;
  min-height: 100%;
  padding: 20px;
}

.wtps-page-appointment-title {
  width: 100%;
  padding-bottom: calc(var(--appointmentfontsize) * 1.5);
  font-size: calc(var(--appointmentfontsize * 1.2));
  font-weight: 600;
}