/* Experiencia de uso: accesibilidad, versión móvil y modo oscuro.
   Está escrito a mano (no pasa por Tailwind) porque en el servidor no se recompilan los estilos. */

/* ---------- Accesibilidad ---------- */
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 200; background: #121210; color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 14px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid #009ddd; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Resaltar lo que señala un aviso (?destacar=...) ---------- */
.rh-highlight { outline: 3px solid #bb2726; outline-offset: 2px; border-radius: 8px; background-color: rgba(187, 39, 38, .09) !important; animation: rh-pulse 1.3s ease-in-out 4; scroll-margin-top: 90px; }
@keyframes rh-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(187, 39, 38, .45); } 50% { box-shadow: 0 0 0 9px rgba(187, 39, 38, 0); } }

/* ---------- Calendarios (plan de contenido y planeación) ---------- */
.cal-dow { display: none; font-size: 12px; font-weight: 600; text-transform: capitalize; color: #6f675f; }
@media (max-width: 640px) {
    /* En pantallas chicas el calendario de 7 columnas pasa a una agenda vertical: un día debajo del otro, solo los que tienen algo. */
    .cal-weekdays, .cal-blank, .cal-empty { display: none !important; }
    .cal-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .cal-day { min-height: 0 !important; }
    .cal-pieces { max-height: none !important; overflow-y: visible !important; }
    .cal-dow { display: inline; }

    /* Que iOS no haga zoom al tocar un campo y que los botones sean fáciles de tocar. */
    input, select, textarea { font-size: 16px !important; }
    .btn-brand { min-height: 42px; }
}

/* ---------- Modo oscuro (se activa con la clase "dark" en <html>) ---------- */
html.dark { color-scheme: dark; }
html.dark body { background-color: #151412; color: #e9e3dc; }
html.dark .bg-cream { background-color: #151412 !important; }
html.dark .bg-white { background-color: #1f1e1c !important; }
html.dark .card { background-color: #1f1e1c !important; border-color: #34312d !important; box-shadow: none; }
html.dark .text-charcoal, html.dark .text-gray-800, html.dark .text-gray-900 { color: #e9e3dc !important; }
html.dark .text-warm-gray, html.dark .text-gray-500, html.dark .text-gray-600 { color: #a69d92 !important; }
html.dark .border-warm-gray-light, html.dark .border-gray-200, html.dark .border-gray-300 { border-color: #34312d !important; }
html.dark .divide-warm-gray-light\/50 > :not([hidden]) ~ :not([hidden]) { border-color: #2e2b28 !important; }
html.dark input, html.dark select, html.dark textarea { background-color: #262422 !important; color: #e9e3dc !important; border-color: #403c37 !important; }
html.dark input::placeholder, html.dark textarea::placeholder { color: #857d73; }
html.dark a.hover\:text-brand-red:hover, html.dark .hover\:text-brand-red:hover { color: #ff6b69; }
html.dark .text-brand-red { color: #ff6b69; }
html.dark .text-brand-cyan-dark { color: #4cc3f0; }
html.dark code { background-color: #2a2825 !important; color: #e9e3dc; }
html.dark img[alt="Studio Redhouse"] { background: #f3eae3; border-radius: 8px; padding: 3px 8px; box-sizing: content-box; }

/* Superficies con color escrito directo en el HTML */
html.dark [style*="background-color: #fff;"], html.dark [style*="background-color: #fff\""], html.dark [style*="background: #fff;"],
html.dark [style*="background-color: #ffffff"], html.dark [style*="background: #ffffff"] { background-color: #1f1e1c !important; }
html.dark [style*="background-color: #f4f1ec"], html.dark [style*="background: #f4f1ec"],
html.dark [style*="background-color: #faf7f3"], html.dark [style*="background-color: #f3eae3"],
html.dark [style*="background: #f3eae3"], html.dark [style*="background-color: #ece6df"], html.dark [style*="background: #ece6df"] { background-color: #2a2825 !important; }
html.dark [style*="color: #6f675f"], html.dark [style*="color: #8a8378"], html.dark [style*="color: #8A8177"] { color: #a69d92 !important; }
html.dark [style*="color: #121210"] { color: #e9e3dc !important; }
html.dark [style*="border-color: #d0c9c3"], html.dark [style*="border: 1px solid #d0c9c3"] { border-color: #403c37 !important; }
html.dark [style*="border-top: 1px solid #d0c9c366"] { border-top-color: #34312d !important; }
html.dark .fixed > .card, html.dark [role="dialog"] { background-color: #1f1e1c !important; }

/* ---------- Pulido visual compartido ---------- */
/* Texto mínimo legible: lo que se escribió en 10-11 px sube a 11-12 px. */
.text-\[10px\] { font-size: 11px !important; }
.text-\[11px\] { font-size: 12px !important; }

/* Esqueleto de carga (campana, listas que llegan por fetch). */
.rh-skeleton { display: inline-block; border-radius: 6px; background: linear-gradient(90deg, #ece6df 25%, #f6f1ec 50%, #ece6df 75%); background-size: 200% 100%; animation: rh-shimmer 1.2s ease-in-out infinite; }
@keyframes rh-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
html.dark .rh-skeleton { background: linear-gradient(90deg, #2a2825 25%, #34312d 50%, #2a2825 75%); background-size: 200% 100%; }

/* Transiciones suaves en controles. */
a, button, .card { transition-property: background-color, border-color, color, box-shadow, opacity; transition-duration: .15s; transition-timing-function: ease; }
.card { transition-property: box-shadow, border-color, background-color; }

/* Tablas de datos: en pantallas chicas cada fila pasa a ser una tarjeta (la etiqueta sale del encabezado, ver ux-scripts). */
@media (max-width: 640px) {
    table.rh-cards, table.rh-cards tbody { display: block; width: 100%; }
    table.rh-cards thead { display: none; }
    table.rh-cards tr { display: block; margin-bottom: 10px; padding: 6px 12px; border: 1px solid #eae5e0; border-radius: 12px; background: #fff; }
    table.rh-cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 5px 0 !important; border: 0 !important; text-align: right; word-break: break-word; }
    table.rh-cards td::before { content: attr(data-label); flex: 0 0 auto; max-width: 45%; font-size: 12px; font-weight: 600; color: #6f675f; text-align: left; }
    table.rh-cards td:not([data-label])::before { content: none; }
    table.rh-cards td[colspan] { display: block; text-align: left; }
    html.dark table.rh-cards tr { background: #1f1e1c; border-color: #34312d; }
    html.dark table.rh-cards td::before { color: #a69d92; }
}
