/* Main container */
.wtps-appointment {
  --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;
}

.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 {
  background-color: var(--appointmentselectbackground);
}

.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 {
  content: "▼"; /* Flecha hacia abajo */
  font-size: calc(var(--appointmentselectssize) * 0.8);
  color: var(--appointmentselectcolor);
  position: absolute;
  right: calc(var(--appointmentselectssize) * 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* Evita que interfiera con los clics */
}
.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(--bodytextcolor));
  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-weight: 600;
  color: var(--appointmenttitlescolor, var(--bodytextcolor));
}

.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 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: flex;
  flex-wrap: wrap;
  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: calc(var(--ap-size-lg) * 4);
  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;
  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;
}

.wtps-appointment .wtps-form .wtps-form-field .wtps-form-field-input {
  display: flex;
  flex-direction: column;
  gap: var(--ap-size-sm);
  font-size: calc(var(--appointmentfontsize) * 0.8);
}

.wtps-appointment .wtps-form .wtps-form-field .wtps-form-field-title {
  order: -1;
  font-size: calc(var(--appointmentfontsize) * 0.8);
  opacity: 0.8;
  font-weight: 600;
}

@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: start;
  }

}

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

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