/*
 * Estilos del plugin: solo estructura (distribución, huecos, rejillas).
 * Tipografía, colores de texto, enlaces, botones y campos de formulario los
 * pone el tema: los botones llevan las clases "button wp-element-button" y los
 * estilos "suaves" van dentro de :where() (especificidad cero) para que
 * cualquier regla del tema los sustituya. Los grises translúcidos
 * (rgba(128,128,128,x)) se adaptan solos a temas claros y oscuros.
 * Excepción: los colores del calendario (días, leyenda y botones de mes) son
 * propios del plugin y se leen de las variables --sephor-cal-* que imprime
 * Ajustes → Personalización visual; no dependen del tema. También llevan color
 * propio los avisos de error y de éxito.
 */

/* ---------- Estructura general ---------- */
.rsb-booking-widget {
  max-width: 640px;
}
:where(.rsb-booking-widget label) {
  display: block;
  margin-bottom: 4px;
}
:where(.rsb-booking-widget input, .rsb-booking-widget select, .rsb-booking-widget textarea) {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}
:where(.rsb-booking-widget input[type="checkbox"], .rsb-booking-widget input[type="radio"]) {
  width: auto;
}
.rsb-booking-widget .rsb-room-select {
  max-width: 320px;
}
:where(.rsb-single-room-name) {
  font-weight: 700;
  margin: 0 0 12px;
}
.rsb-hidden-select {
  display: none;
}
#rsb-my-profile {
  max-width: 420px;
}
#rsb-my-profile input:disabled {
  opacity: 0.65;
}
#rsb-my-profile .description {
  display: block;
  font-size: 0.8em;
  opacity: 0.7;
  margin-top: 4px;
}

/* Descripción de la sala */
:where(.rsb-room-desc) {
  background: rgba(128, 128, 128, 0.08);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 12px 0 20px;
}
.rsb-room-desc h4 {
  margin: 0 0 8px;
}
.rsb-room-desc p {
  margin: 0;
  white-space: pre-line;
}

/* Franja "Conectado como / Iniciar sesión" */
:where(.rsb-auth-banner) {
  background: rgba(128, 128, 128, 0.12);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.9em;
  margin: 0 0 16px;
}
.rsb-banner-login-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rsb-banner-login-form input {
  width: auto !important;
}
.rsb-banner-login-message {
  font-size: 0.85em;
}

/* Botón mostrar/ocultar contraseña */
.rsb-password-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rsb-password-wrap input {
  flex: 1;
  min-width: 0;
}
:where(.rsb-password-toggle) {
  flex: none;
  background: none;
  border: 1px solid rgba(128, 128, 128, 0.5);
  border-radius: 4px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  font-size: 0.78em;
  padding: 4px 8px;
  white-space: nowrap;
}
:where(.rsb-password-toggle):hover {
  background: rgba(128, 128, 128, 0.15);
}
.rsb-banner-login-form .rsb-password-wrap {
  width: auto;
}
.rsb-banner-login-form .rsb-password-wrap input {
  width: auto !important;
  flex: none;
}

/* Botones de acción: los pinta el tema ("button wp-element-button") */
.rsb-booking-widget .rsb-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Avisos */
.rsb-success {
  color: #1a7f37;
  margin-top: 10px;
}
.rsb-error {
  background: #c0392b;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 10px;
}
.rsb-info {
  margin-top: 10px;
}

/* ---------- Navegación de mes ---------- */
.rsb-cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0 8px;
  font-weight: 600;
}
:where(.rsb-cal-nav button) {
  background: none;
  border: 1px solid rgba(128, 128, 128, 0.5);
  border-radius: 4px;
  color: inherit;
  font: inherit;
  width: 32px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
:where(.rsb-cal-nav button):hover {
  background: rgba(128, 128, 128, 0.15);
}
/* Botones de mes de los calendarios: colores de Personalización visual */
#rsb-prev-month,
#rsb-next-month,
#rsb-admin-book-prev,
#rsb-admin-book-next {
  background: var(--sephor-cal-nav-bg, #e5e5e5);
  color: var(--sephor-cal-nav-fg, #555555);
}
#rsb-prev-month:hover,
#rsb-next-month:hover,
#rsb-admin-book-prev:hover,
#rsb-admin-book-next:hover {
  background: var(--sephor-cal-nav-bg, #e5e5e5);
  filter: brightness(0.93);
}

/* ---------- Rejilla del calendario ---------- */
.rsb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.rsb-cal-head {
  text-align: center;
  font-weight: 600;
  padding: 6px 0;
  font-size: 0.85em;
  opacity: 0.75;
}
.rsb-cal-cell {
  position: relative;
  min-height: 56px;
  border: 1px solid var(--sephor-cal-libre-border, #dddddd);
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  background: var(--sephor-cal-libre-bg, #ffffff);
  color: var(--sephor-cal-libre-fg, #555555);
}
.rsb-cal-cell:hover {
  filter: brightness(0.95);
}
.rsb-cal-cell.rsb-cal-empty {
  border: none;
  cursor: default;
  background: transparent;
  filter: none;
}
.rsb-cal-daynum {
  font-size: 0.9em;
  color: inherit;
}
.rsb-cal-today .rsb-cal-daynum {
  font-weight: 700;
  text-decoration: underline;
}
/* El número de hoy lleva su color solo sobre días libres o parcialmente ocupados */
.rsb-cal-today:not(.rsb-cal-full):not(.rsb-cal-past):not(.rsb-cal-closed):not(.rsb-block-closed):not(.rsb-block-blocked):not(.rsb-block-open) .rsb-cal-daynum {
  color: var(--sephor-cal-hoy-fg, #2e86ab);
}
.rsb-cal-selected {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

/* Ocupación del día: parcial y lleno */
.rsb-cal-cell.rsb-cal-partial {
  background: var(--sephor-cal-ocupado-bg, #e0e0e0);
  color: var(--sephor-cal-ocupado-fg, #333333);
}
.rsb-cal-cell.rsb-cal-full {
  background: var(--sephor-cal-lleno-bg, #1a1a1a);
  color: var(--sephor-cal-lleno-fg, #ffffff);
}

/* No seleccionable: días ya pasados, o cerrados por fin de semana no laborable/festivo */
.rsb-cal-cell.rsb-cal-past,
.rsb-cal-cell.rsb-cal-closed {
  background: var(--sephor-cal-nosel-bg, #c0392b);
  color: var(--sephor-cal-nosel-fg, #ffffff);
  cursor: not-allowed;
}
.rsb-cal-cell.rsb-cal-past:hover,
.rsb-cal-cell.rsb-cal-closed:hover {
  filter: none;
}

/* Pestaña "Bloqueos" del Panel de gestión: estados de un día, clicables para alternar */
.rsb-cal-cell.rsb-block-closed {
  background: #c0392b;
  color: #fff;
}
.rsb-cal-cell.rsb-block-closed .rsb-cal-daynum {
  color: #fff;
}
.rsb-cal-cell.rsb-block-closed:hover {
  filter: none;
  background: #a93226;
}
.rsb-cal-cell.rsb-block-blocked {
  background: #7a1f1f;
  color: #fff;
}
.rsb-cal-cell.rsb-block-blocked .rsb-cal-daynum {
  color: #fff;
}
.rsb-cal-cell.rsb-block-blocked:hover {
  filter: none;
  background: #611818;
}
.rsb-cal-cell.rsb-block-open {
  background: #00c853;
  color: #fff;
}
.rsb-cal-cell.rsb-block-open .rsb-cal-daynum {
  color: #fff;
}
.rsb-cal-cell.rsb-block-open:hover {
  filter: none;
  background: #00b04a;
}

/* ---------- Leyenda de colores ---------- */
.rsb-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 0.8em;
}
.rsb-cal-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.rsb-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--sephor-cal-libre-border, #dddddd);
}
.rsb-legend-past {
  background: var(--sephor-cal-nosel-bg, #c0392b);
  border-color: var(--sephor-cal-nosel-bg, #c0392b);
}
.rsb-legend-partial {
  background: var(--sephor-cal-ocupado-bg, #e0e0e0);
  border-color: var(--sephor-cal-ocupado-bg, #e0e0e0);
}
.rsb-legend-full {
  background: var(--sephor-cal-lleno-bg, #1a1a1a);
  border-color: var(--sephor-cal-lleno-bg, #1a1a1a);
}
.rsb-legend-free {
  background: var(--sephor-cal-libre-bg, #ffffff);
  border-color: var(--sephor-cal-libre-border, #dddddd);
}

/* ---------- Panel del día seleccionado ---------- */
.rsb-day-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(128, 128, 128, 0.35);
}
.rsb-day-panel h4 {
  margin: 0 0 8px;
}
.rsb-day-panel .description {
  opacity: 0.75;
  font-size: 0.9em;
  margin-top: 0;
}
.rsb-duration-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 12px 0 18px;
}
.rsb-duration-fields p {
  margin: 0;
}
.rsb-occupied-summary {
  opacity: 0.75;
  font-size: 0.9em;
  margin: 0 0 12px;
}

/* ---------- Login / registro / invitado dentro del panel del día ---------- */
.rsb-auth-box {
  max-width: 360px;
  margin-top: 8px;
}
.rsb-auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

/* Pestañas (área de reserva y Panel de gestión): subrayado con el color del texto */
:where(.rsb-tab) {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  border-bottom: 2px solid rgba(128, 128, 128, 0.35);
  border-radius: 0;
  color: inherit;
  font: inherit;
  font-size: 0.9em;
  cursor: pointer;
}
:where(.rsb-tab):hover {
  background: rgba(128, 128, 128, 0.12);
}
:where(.rsb-tab-active) {
  border-bottom-color: currentColor;
}
.rsb-tab.rsb-tab-active {
  font-weight: 700;
  text-decoration: underline;
}

/* ---------- Mis reservas y tablas ---------- */
#rsb-my-bookings {
  max-width: 800px;
}
#rsb-my-bookings h3 {
  margin: 24px 0 8px;
}
#rsb-my-bookings h3:first-child {
  margin-top: 0;
}
.rsb-my-bookings-table {
  width: 100%;
  border-collapse: collapse;
}
.rsb-my-bookings-table th,
.rsb-my-bookings-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}
.rsb-cancel-booking:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Panel de gestión (front) ---------- */
.rsb-panel-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
}
.rsb-panel-tabs .rsb-tab {
  flex: none;
  padding: 8px 12px;
  white-space: nowrap;
}
.rsb-panel-section table th,
.rsb-panel-section table td {
  text-align: left;
}

/* ---------- Aviso emergente de reservas nuevas (Panel de gestión) ---------- */
.rsb-popup-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100000;
}
.rsb-popup-toast {
  max-width: 320px;
  background: #1a1a1a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.9em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
