/* Componentes propios sobre Tailwind (CDN): se escriben en CSS normal porque @apply no
   está disponible sin compilar Tailwind. */
:root {
  --brand: #0A7CFF;
  --brand-oscuro: #0857B8;
  --navy: #0B2447;
}

.input {
  display: block;
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10, 124, 255, 0.15); }
select.input { padding-right: 2rem; }

.btn-primario, .btn, .btn-peligro, .btn-suave {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border-radius: 0.5rem; padding: 0.5rem 0.9rem; font-size: 0.875rem; font-weight: 600;
  line-height: 1.25rem; white-space: nowrap; transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
}
.btn-primario { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(10, 124, 255, 0.3); }
.btn-primario:hover { background: var(--brand-oscuro); }
.btn { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.btn:hover { background: #f8fafc; color: var(--navy); }
.btn-suave { background: #EEF6FF; color: var(--brand); }
.btn-suave:hover { background: #D9ECFF; }
.btn-peligro { background: #fff; color: #be123c; border: 1px solid #fecdd3; }
.btn-peligro:hover { background: #fff1f2; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.tarjeta { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.75rem; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); }
input[type=file] { max-width: 100%; width: 100%; }
.grid > label { min-width: 0; }
.tabla { width: 100%; font-size: 0.875rem; }
.tabla th { text-align: left; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; padding: 0.65rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.tabla td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tabla tbody tr:hover { background: #fafcff; }
.tabla tbody tr:last-child td { border-bottom: none; }

.pestana { padding: 0.6rem 0.2rem; font-size: 0.875rem; font-weight: 600; color: #64748b; border-bottom: 2px solid transparent; white-space: nowrap; }
.pestana:hover { color: var(--navy); }
.pestana.activa { color: var(--brand); border-color: var(--brand); }

/* ---- Multicalendario ------------------------------------------------------------- */
.multical { display: grid; position: relative; user-select: none; --col-prop: 240px; --celda: 60px; --fila-min: 72px; }
.multical .nombre-prop { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multical .celda { position: relative; min-height: 72px; border-right: 1px solid #eef2f7; border-bottom: 1px solid #e2e8f0; background: #fff; cursor: cell; }
.multical .celda.finde { background: #fbfcfe; }
.multical .celda.hoy { background: #f0f7ff; }
.multical .celda.bloq { background: repeating-linear-gradient(135deg, #f1f5f9 0 6px, #e2e8f0 6px 8px); }
.multical .celda.sel { background: #D9ECFF !important; }
.multical .precio { position: absolute; left: 0; right: 0; top: calc(50% + 26px); text-align: center; font-size: 11px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.multical .cab { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid #e2e8f0; border-right: 1px solid #eef2f7; text-align: center; padding: 6px 0; }
.multical .prop { position: sticky; left: 0; z-index: 6; background: #fff; border-bottom: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 72px; }
.multical .esquina { position: sticky; left: 0; top: 0; z-index: 7; background: #fff; border-bottom: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; }
/* Centrada en la fila (que es elástica), dejando sitio debajo para el precio del día. */
.barra { position: absolute; top: calc(50% - 24px); height: 44px; line-height: 1.15; z-index: 3; border-radius: 9px; color: #fff; font-size: 13px; font-weight: 600; padding: 0 8px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; box-shadow: 0 1px 3px rgba(11, 36, 71, 0.25); cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.barra:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(11, 36, 71, 0.25); }
.barra.pendiente { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }
.barra.bloqueo { background: #94a3b8 !important; }
.barra .sub { font-weight: 400; opacity: 0.85; }
.barra .linea2 { display: block; font-size: 11px; font-weight: 500; opacity: 0.85; }

/* ---- Rejilla de precios ------------------------------------------------------------ */
.rejilla .col-prop { min-width: 180px; }
.rejilla td.dia { min-width: 64px; text-align: center; border-right: 1px solid #eef2f7; padding: 6px 2px; cursor: pointer; }
.rejilla td.dia.sel { background: #D9ECFF; }
.rejilla td.dia.ajuste .p { color: var(--brand); font-weight: 700; }
.rejilla td.dia.bloq { background: repeating-linear-gradient(135deg, #f8fafc 0 6px, #e2e8f0 6px 8px); }
.rejilla td.dia.ocup .p { text-decoration: line-through; color: #cbd5e1; }

/* ---- Modal ------------------------------------------------------------------------- */
.modal-fondo { position: fixed; inset: 0; z-index: 50; background: rgba(11, 36, 71, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; animation: aparecer 0.12s ease-out; }
.modal-caja { width: 100%; max-width: 40rem; background: #fff; border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(11, 36, 71, 0.35); }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

.prosa p { margin-bottom: 0.75rem; }
.htmx-request .spinner { display: inline-block; }
.spinner { display: none; }
.tabla td.text-right, .tabla th.text-right { white-space: nowrap; }
.mes-cal { --fila-mes: 44px; --cab-mes: 40px; }
.barra-mes.pendiente { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }
.celda-bloq { background: repeating-linear-gradient(135deg, #f8fafc 0 6px, #e2e8f0 6px 8px); }

/* --- Móvil ------------------------------------------------------------------------ */
@media (max-width: 639px) {
  /* Calendario: columna de habitaciones estrecha y celdas más pequeñas para ver ~6 días */
  .multical { --col-prop: 96px; --celda: 46px; --fila-min: 64px; }
  .multical .prop { padding: 0 8px; gap: 6px; min-height: 64px; }
  .multical .prop > span:first-child { width: 4px; }
  .multical .nombre-prop { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-size: 12px; line-height: 1.25; }
  .multical .celda { min-height: 64px; }
  .multical .precio { font-size: 10px; top: calc(50% + 20px); }
  .barra { height: 36px; top: calc(50% - 20px); font-size: 12px; padding: 0 5px; gap: 4px; border-radius: 7px; }
  .barra > svg, .barra > span:first-child:not(.min-w-0) { display: none; }
  .barra .linea2 { font-size: 10px; }
  /* Rejilla de precios: igual que el calendario, columna de propiedad estrecha */
  .rejilla .col-prop { min-width: 0; width: 96px; max-width: 96px; padding: 6px 8px !important; font-size: 12px; line-height: 1.25; white-space: normal; }
  .rejilla td.dia { min-width: 46px; }
  /* Calendario mensual: la semana entera cabe en pantalla (7 columnas de ~50 px) */
  .mes-cal { --fila-mes: 28px; --cab-mes: 32px; }
  .mes-cal button { padding: 4px; }
  .mes-cal button > span:first-child { height: 1.5rem; min-width: 1.5rem; font-size: 12px; }
  .mes-cal .precio-mes { font-size: 10px; }
  .mes-cal .barra-mes { padding: 0 4px; gap: 4px; }
  .mes-cal .barra-mes > span:first-child:not(.min-w-0), .mes-cal .linea2-mes { display: none; }
  .mes-cal .barra-mes .text-\[13px\] { font-size: 11px; }
}
