/* ============================================================
   app-extras.css — Estilos de la capa de extensión:
   calendario de rentas + modal + botones de descarga PDF.
   Acompaña a assets/app-extras.js.
   ============================================================ */

/* ---------- Calendario ---------- */

#x-cal {
  margin-bottom: 22px;
}

.xcal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.xcal-toolbar-grupo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.xcal-titulo {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 170px;
}
.xcal-titulo::first-letter {
  text-transform: uppercase;
}

.xcal-nav-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-ink-soft);
  font-size: 1.05rem;
  cursor: pointer;
  transition: var(--t);
}
.xcal-nav-btn:hover {
  background: rgba(250, 204, 21, 0.08);
  border-color: rgba(250, 204, 21, 0.4);
  color: var(--c-primary);
}

/* Cabecera de días de la semana */
.xcal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--c-line);
}
.xcal-weekdays span {
  padding: 8px 6px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-muted);
}

/* Rejilla mensual */
.xcal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--c-line);
}
.xcal-dia {
  min-height: 104px;
  border-right: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--c-surface);
  cursor: pointer;
  transition: background var(--t);
  text-align: left;
  overflow: hidden;
}
.xcal-dia:hover { background: rgba(255, 255, 255, 0.04); }
.xcal-dia.fuera { background: rgba(255, 255, 255, 0.02); }
.xcal-dia.fuera .xcal-num { color: var(--c-muted); }
.xcal-dia.ocupado { background: rgba(250, 204, 21, 0.05); }
.xcal-num {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--c-ink-soft);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.xcal-dia.hoy .xcal-num {
  background: var(--c-primary);
  color: #fff;
}

/* Chips de evento */
.xcal-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--t);
  line-height: 1.35;
}
.xcal-chip:hover { filter: brightness(0.96); }
.xcal-chip .xcal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.xcal-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.xcal-mas {
  border: none;
  background: transparent;
  color: var(--c-primary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  padding: 2px 7px;
}
.xcal-mas:hover { text-decoration: underline; }

/* Vista semana */
.xcal-semana {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--c-line);
}
.xcal-sem-dia {
  border-right: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  min-height: 180px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.xcal-sem-head {
  text-align: center;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px dashed var(--c-line);
  cursor: pointer;
}
.xcal-sem-head .dia-nombre {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-muted);
}
.xcal-sem-head .dia-num {
  font-size: 1.05rem;
  font-weight: 700;
}
.xcal-sem-dia.hoy .dia-num { color: var(--c-primary); }

/* Vista día */
.xcal-dia-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}
.xcal-evento-fila {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--c-line);
  border-left-width: 4px;
  border-radius: var(--r-sm);
  background: var(--c-surface);
  cursor: pointer;
  transition: var(--t);
  text-align: left;
  width: 100%;
}
.xcal-evento-fila:hover { box-shadow: var(--shadow-sm); }
.xcal-evento-info { flex: 1; min-width: 0; }
.xcal-evento-info strong { display: block; }
.xcal-evento-info small { color: var(--c-ink-soft); }

/* Leyenda */
.xcal-leyenda {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--c-ink-soft);
}
.xcal-leyenda span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.xcal-leyenda i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.xcal-estado {
  padding: 30px;
  text-align: center;
  color: var(--c-ink-soft);
}
.xcal-estado.error { color: var(--c-danger); }

/* ---------- Modal de detalle de renta ---------- */

.xmodal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 14, 29, 0.62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: aparecer 0.25s ease;
}
.xmodal {
  background: var(--c-surface);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 0 24px rgba(250, 204, 21, 0.06);
  width: 100%;
  max-width: 440px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px;
}
.xmodal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.xmodal-head h3 { font-size: 1.15rem; }
.xmodal-cerrar {
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--c-ink-soft);
  flex-shrink: 0;
  transition: var(--t-all, all 0.3s ease);
}
.xmodal-cerrar:hover {
  border-color: rgba(250, 204, 21, 0.5);
  color: var(--c-primary);
  background: rgba(250, 204, 21, 0.08);
}
.xmodal-datos {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  font-size: 0.92rem;
  margin-bottom: 16px;
}
.xmodal-datos dt { color: var(--c-muted); font-weight: 600; }
.xmodal-datos dd { font-weight: 550; overflow-wrap: anywhere; }
.xmodal-acciones {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--c-line);
  padding-top: 14px;
}
.xmodal-acciones .btn { flex: 1; }

/* ---------- Catálogo / galería de imágenes ---------- */

body.xcat-abierto {
  overflow: hidden;
}

.xcat-backdrop {
  z-index: 95;
  align-items: center;
}

.xcat-panel {
  background: var(--c-bg, #0c1322);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(250, 204, 21, 0.05);
  width: 100%;
  max-width: 1040px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.xcat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  background: rgba(7, 14, 29, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  color: #fff;
}
.xcat-head h3 {
  font-family: var(--font-head, inherit);
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: #facc15;
}
.xcat-head p {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}
.xcat-head .xmodal-cerrar {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.xcat-contenido {
  overflow-y: auto;
  padding: 20px 22px 28px;
  -webkit-overflow-scrolling: touch;
}

.xcat-categoria {
  font-family: var(--font-mono, inherit);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-ink, #dce2f7);
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  position: relative;
}
.xcat-categoria::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 64px;
  height: 2px;
  background: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}
.xcat-categoria:first-child { margin-top: 0; }

.xcat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.xcat-card {
  background: var(--c-surface, #141b2b);
  border: 1px solid var(--c-line, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg, 12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--t-all, all 0.3s ease);
}
.xcat-card:hover {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.06), var(--shadow-md, 0 6px 18px rgba(0, 0, 0, 0.45));
  transform: translateY(-3px);
}

.xcat-foto {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: none;
  padding: 0;
  background: var(--bg-deep, #070e1d);
  cursor: zoom-in;
  overflow: hidden;
}
.xcat-foto::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 14, 29, 0.55), transparent 45%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.xcat-foto:hover::after { opacity: 0.4; }
.xcat-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s ease;
}
.xcat-foto:hover img { transform: scale(1.06); }

.xcat-card-cuerpo {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.xcat-card-cuerpo h4 {
  font-family: var(--font-head, inherit);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--c-ink, #dce2f7);
}
.xcat-desc {
  font-size: 0.86rem;
  color: var(--c-ink-soft, #a8b2c7);
  line-height: 1.6;
}
.xcat-specs {
  font-size: 0.78rem;
  color: var(--c-muted, #76819a);
  line-height: 1.6;
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  padding-top: 10px;
  margin-top: auto;
}
.xcat-specs strong {
  display: block;
  font-family: var(--font-mono, inherit);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #facc15;
  margin-bottom: 4px;
}

/* Visor de imagen ampliada */
.xcat-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(2, 6, 23, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  cursor: zoom-out;
  animation: aparecer 0.18s ease;
}
.xcat-lightbox figure {
  max-width: min(960px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.xcat-lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.xcat-lightbox figcaption {
  color: #fff;
  font-weight: 600;
  text-align: center;
  font-size: 0.95rem;
}
.xcat-lb-cerrar {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 40px;
  height: 40px;
}

/* ---------- Botones PDF ---------- */

.x-pdf-btn {
  white-space: nowrap;
}
.x-pdf-btn[disabled] { opacity: 0.6; }

/* ---------- Móvil ---------- */

@media (max-width: 760px) {
  .xcal-toolbar { gap: 10px; }
  .xcal-titulo {
    min-width: 0;
    width: 100%;
    order: -1;
    text-align: center;
    font-size: 1rem;
  }
  .xcal-toolbar-grupo {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 10px;
  }
  .xcal-toolbar-grupo .btn { flex: 1; max-width: 140px; }
  .xcal-nav-btn { width: 48px; height: 44px; flex-shrink: 0; }
  .xcal-toolbar > .segmentado { width: 100%; }
  .xcal-toolbar > .segmentado .seg-btn { flex: 1; }

  .xcal-dia { min-height: 76px; padding: 4px; }
  .xcal-chip { padding: 2px 4px; font-size: 0; gap: 0; justify-content: center; }
  .xcal-chip .xcal-dot { width: 8px; height: 8px; }
  .xcal-mas { font-size: 0.66rem; padding: 0 4px; }
  .xcal-num { width: 22px; height: 22px; font-size: 0.74rem; }

  /* Semana en vertical (lista de días) */
  .xcal-semana { grid-template-columns: 1fr; border-left: none; }
  .xcal-sem-dia .xcal-chip {
    font-size: 0.78rem;
    gap: 6px;
    justify-content: flex-start;
    padding: 7px 10px;
  }
  .xcal-sem-dia {
    min-height: 0;
    border: 1px solid var(--c-line);
    border-radius: var(--r-sm);
    margin-bottom: 8px;
  }
  .xcal-sem-head { text-align: left; display: flex; gap: 10px; align-items: baseline; }

  .xmodal-backdrop { padding: 0; align-items: flex-end; }
  .xmodal {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    max-height: 92vh;
  }
  .xmodal-datos { grid-template-columns: 1fr; gap: 2px; }
  .xmodal-datos dt { margin-top: 8px; }
  .xmodal-acciones { flex-direction: column; }

  /* Catálogo a pantalla completa en móvil */
  .xcat-backdrop { padding: 0; align-items: stretch; }
  .xcat-panel {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .xcat-head { padding: 14px 16px; }
  .xcat-contenido { padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); }
  .xcat-grid { grid-template-columns: 1fr; }
  .xcat-lightbox { padding: 12px; }
}
