/* ==========================================================================
   PAN MANITOS · Tema visual del panel
   Mismo lenguaje visual del módulo de Visitas aplicado a todo el panel:
   tarjetas redondeadas, encabezados tipo "hero", acentos ámbar y animaciones suaves.
   Se carga en todas las páginas del panel desde AdminPanelProvider.
   ========================================================================== */

/* Colores y sombras del tema (modo claro) que usan todos los estilos. */
:root {
    --pm-card: #ffffff;
    --pm-card-soft: #f9fafb;
    --pm-border: #e5e7eb;
    --pm-border-soft: #f3f4f6;
    --pm-text: #111827;
    --pm-muted: #6b7280;
    --pm-accent: var(--primary-500, #f59e0b);
    --pm-accent-soft: #fef3c7;
    --pm-accent-text: #b45309;
    --pm-row-hover: #fffbeb;
    --pm-thead: #f9fafb;
    --pm-decor: rgba(251, 191, 36, .14);
    --pm-shadow: 0 1px 3px rgba(15, 23, 42, .06);
    --pm-shadow-hover: 0 12px 28px rgba(15, 23, 42, .10);
    --pm-radius: 20px;
    --pm-radius-sm: 12px;
}

/* Los mismos valores para el modo oscuro. */
.dark {
    --pm-card: #111827;
    --pm-card-soft: #1f2937;
    --pm-border: #374151;
    --pm-border-soft: #1f2937;
    --pm-text: #f9fafb;
    --pm-muted: #9ca3af;
    --pm-accent-soft: rgba(245, 158, 11, .14);
    --pm-accent-text: #fcd34d;
    --pm-row-hover: rgba(245, 158, 11, .06);
    --pm-thead: rgba(255, 255, 255, .03);
    --pm-decor: rgba(251, 191, 36, .07);
    --pm-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    --pm-shadow-hover: 0 12px 28px rgba(0, 0, 0, .35);
}

/* ── Animación de entrada de la página ───────────────────────────────────── */
/*
 * Solo en el contenido y solo opacidad: un transform rompería las ventanas
 * emergentes fijas, y el encabezado no se anima porque contiene la de "Borrar".
 */
.fi-page-content {
    animation: pm-aparecer .35s ease-out .05s backwards;
}

/* ── Encabezado de página (tipo hero) ────────────────────────────────────── */
/*
 * IMPORTANTE: las ventanas emergentes de Filament (p. ej. "Borrar") viven dentro
 * del encabezado. Por eso aquí NO se usa overflow, z-index, transform ni
 * pseudo-elementos posicionados: la decoración va toda en capas de fondo.
 */
.fi-header {
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    background:
        linear-gradient(90deg, #f59e0b, #fbbf24 45%, transparent) top left / 100% 4px no-repeat,
        radial-gradient(circle at 100% 0, var(--pm-decor) 0 110px, transparent 111px),
        var(--pm-card);
    padding: 22px 24px;
    box-shadow: var(--pm-shadow);
}

/* Fila superior: botón Volver + migas de pan; debajo el título. */
.fi-header > div:first-child {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 14px;
    row-gap: 10px;
}

.fi-header .pm-volver { order: 1; }
.fi-header .fi-breadcrumbs { order: 2; }
.fi-header .fi-header-heading { order: 3; flex-basis: 100%; }
.fi-header .fi-header-subheading { order: 4; flex-basis: 100%; }

.fi-header-heading {
    font-weight: 800;
    letter-spacing: -.01em;
}

.fi-header-subheading {
    margin-top: 0;
    color: var(--pm-muted);
}

/* ── Botón Volver ────────────────────────────────────────────────────────── */
.pm-volver {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #fde68a;
    border-radius: 999px;
    background: var(--pm-accent-soft);
    padding: 6px 14px 6px 10px;
    color: var(--pm-accent-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: background .15s, box-shadow .15s, transform .15s;
}

.dark .pm-volver {
    border-color: rgba(251, 191, 36, .25);
}

.pm-volver svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform .2s;
}

.pm-volver small {
    border-left: 1px solid currentColor;
    padding-left: 7px;
    font-size: 12px;
    font-weight: 600;
    opacity: .75;
}

.pm-volver:hover {
    background: #fde68a;
    box-shadow: 0 4px 12px rgba(245, 158, 11, .25);
}

.dark .pm-volver:hover {
    background: rgba(245, 158, 11, .25);
}

.pm-volver:hover svg {
    transform: translateX(-3px);
}

.pm-volver:focus-visible {
    outline: 2px solid var(--pm-accent);
    outline-offset: 2px;
}

/* ── Secciones (formularios, detalles, gráficos) ─────────────────────────── */
.fi-section {
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow);
    transition: box-shadow .2s;
}

.fi-section:hover {
    box-shadow: var(--pm-shadow-hover);
}

.fi-section-header-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.fi-section-header-heading::before {
    content: "";
    width: 4px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--pm-accent);
}

.fi-section-header-description {
    padding-left: 14px;
}

/* ── Tablas ──────────────────────────────────────────────────────────────── */
.fi-ta-ctn {
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow);
}

.fi-ta-table > thead > tr > th {
    background: var(--pm-thead);
}

.fi-ta-header-cell,
.fi-ta-header-cell-sort-btn {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--pm-muted);
}

.fi-ta-row {
    transition: background-color .15s;
}

.fi-ta-row:hover,
.fi-ta-row.fi-striped:hover {
    background-color: var(--pm-row-hover);
}

.fi-ta-row:hover > .fi-ta-cell:first-child {
    box-shadow: inset 3px 0 0 var(--pm-accent);
}

.fi-ta-empty-state-icon-bg {
    background: var(--pm-accent-soft);
    color: var(--pm-accent-text);
}

/* ── Tablas en modo tarjetas (Cargos, Centros Infantiles…) ───────────────
   Cualquier columna cuya vista tenga el atributo data-tarjeta convierte
   su registro en una tarjeta completa. */
.fi-ta-record:has([data-tarjeta]) {
    position: relative;
    display: block;
    padding: 0;
    overflow: hidden;
    border-radius: var(--pm-radius);
    transition: transform .2s, box-shadow .2s;
}

.fi-ta-record:has([data-tarjeta]):hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .12);
}

.fi-ta-record:has([data-tarjeta]) .fi-ta-col { display: block; width: 100%; }

.fi-ta-record:has([data-tarjeta]) .fi-ta-record-content-ctn,
.fi-ta-record:has([data-tarjeta]) .fi-ta-record-content { width: 100%; padding: 0; }

/* Espacio a la derecha para que la casilla de selección no tape los botones. */
.fi-ta-record:has([data-tarjeta]) .fi-ta-actions { flex-wrap: wrap; padding: 0 46px 16px 18px; }

/* Casilla de selección en la esquina inferior derecha, junto a los botones. */
.fi-ta-record:has([data-tarjeta]) > .fi-ta-record-checkbox {
    position: absolute;
    right: 18px;
    bottom: 20px;
    z-index: 1;
    margin: 0;
}

/* Sin animaciones si el usuario pidió reducir movimiento. */
@media (prefers-reduced-motion: reduce) {
    .fi-ta-record:has([data-tarjeta]):hover { transform: none; }
}

/* ── Botones ─────────────────────────────────────────────────────────────── */
.fi-btn {
    border-radius: var(--pm-radius-sm);
    font-weight: 700;
    transition: transform .12s, box-shadow .15s, filter .15s, background-color .15s;
}

.fi-btn:hover {
    box-shadow: 0 6px 16px rgba(15, 23, 42, .12);
    transform: translateY(-1px);
}

.fi-btn:active {
    transform: translateY(0) scale(.98);
    box-shadow: none;
}

.fi-icon-btn {
    border-radius: 10px;
}

/* ── Campos de formulario ────────────────────────────────────────────────── */
.fi-input-wrp,
.fi-select-input,
.fi-fo-file-upload .filepond--panel-root {
    border-radius: var(--pm-radius-sm);
}

.fi-input-wrp {
    transition: box-shadow .15s;
}

.fi-input-wrp:focus-within {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, .15);
}

.fi-fo-field-label {
    font-weight: 600;
}

/* ── Insignias, menús desplegables y pestañas ────────────────────────────── */
.fi-badge {
    border-radius: 999px;
    font-weight: 700;
}

.fi-dropdown-panel {
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
}

.fi-tabs {
    border-radius: 14px;
}

.fi-pagination-records-per-page-select .fi-input-wrp,
.fi-pagination-items {
    border-radius: var(--pm-radius-sm);
}

/* ── Ventanas emergentes de Filament (confirmar, eliminar, filtros…) ─────── */
.fi-modal-window {
    border-radius: 22px;
    background-image: linear-gradient(90deg, #f59e0b, #fbbf24);
    background-size: 100% 5px;
    background-repeat: no-repeat;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
}

.fi-modal-close-overlay {
    backdrop-filter: blur(3px);
}

.fi-modal-heading {
    font-weight: 800;
}

/* ── Notificaciones ──────────────────────────────────────────────────────── */
.fi-no-notification {
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .2);
}

/* ── Panel principal: tarjetas de estadísticas y gráficos ────────────────── */
.fi-wi-stats-overview-stat {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: var(--pm-shadow);
    transition: transform .2s, box-shadow .2s;
}

.fi-wi-stats-overview-stat::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--pm-accent);
}

/* La barra inferior toma el color de la descripción de cada estadística. */
.fi-wi-stats-overview-stat:has(.fi-color-info)::after { background: var(--info-500, #3b82f6); }
.fi-wi-stats-overview-stat:has(.fi-color-success)::after { background: var(--success-500, #10b981); }
.fi-wi-stats-overview-stat:has(.fi-color-danger)::after { background: var(--danger-500, #ef4444); }
.fi-wi-stats-overview-stat:has(.fi-color-warning)::after { background: var(--warning-500, #f59e0b); }
.fi-wi-stats-overview-stat:has(.fi-color-gray)::after { background: var(--gray-400, #9ca3af); }

.fi-wi-stats-overview-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--pm-shadow-hover);
}

.fi-wi-stats-overview-stat-value {
    font-weight: 800;
}

/* ── Barra lateral ───────────────────────────────────────────────────────── */
.fi-sidebar-item-btn {
    border-radius: var(--pm-radius-sm);
    transition: background-color .15s, padding-left .15s;
}

.fi-sidebar-item:not(.fi-active) .fi-sidebar-item-btn:hover {
    padding-left: 14px;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-btn {
    box-shadow: inset 3px 0 0 var(--pm-accent);
}

/* ── Utilidades ──────────────────────────────────────────────────────────── */
/* Animación de aparición usada por varias piezas. */
@keyframes pm-aparecer {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Celulares: ajustes de tamaño. */
@media (max-width: 640px) {
    .fi-header { padding: 18px; }
    .pm-volver small { display: none; }
}

/* Sin animaciones si el usuario pidió reducir movimiento. */
@media (prefers-reduced-motion: reduce) {
    .fi-page-content { animation: none; }

    .fi-btn:hover,
    .fi-wi-stats-overview-stat:hover { transform: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Barra superior y marca (logo + nombre)
   ───────────────────────────────────────────────────────────────────────── */
/* Barra superior: fondo y sombra. */
.fi-topbar {
    position: relative;
    background-image: linear-gradient(90deg, rgba(251, 191, 36, .10), transparent 35%);
}

/* Línea de color animada bajo la barra */
.fi-topbar::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, #f59e0b, #fb923c, #ec4899, #8b5cf6, #3b82f6, #10b981, #f59e0b);
    background-size: 200% 100%;
    animation: pm-linea 12s linear infinite;
    opacity: .85;
    pointer-events: none;
}

.fi-topbar-start a,
/* Enlace del logo en el menú lateral. */
.fi-sidebar-header-logo-ctn a {
    text-decoration: none;
    border-radius: 16px;
    outline-offset: 4px;
}

.fi-logo:has(.pm-marca) {
    display: flex;
    align-items: center;
}

/* Contenedor de la marca (logo + nombre). */
.pm-marca {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    height: 100%;
    animation: pm-entrar .6s cubic-bezier(.34, 1.56, .64, 1) both;
}

/* Logo dentro de una insignia con anillo de color que gira */
.pm-marca-logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 15px;
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}

.pm-marca-anillo {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: conic-gradient(from 0deg, #f59e0b, #fb923c, #ec4899, #8b5cf6, #3b82f6, #10b981, #f59e0b);
    animation: pm-girar 6s linear infinite;
}

.pm-marca-anillo::after {
    content: '';
    position: absolute;
    inset: 2.5px;
    border-radius: 13px;
    background: #fff;
}

.pm-marca-logo img {
    position: relative;
    z-index: 1;
    height: 38px;
    width: auto;
    max-width: none;
    object-fit: contain;
    animation: pm-flotar 4s ease-in-out infinite;
    filter: drop-shadow(0 2px 3px rgba(180, 83, 9, .25));
}

a:hover .pm-marca-logo {
    transform: rotate(-8deg) scale(1.08);
}

/* Nombre con degradado y brillo que recorre las letras */
.pm-marca-texto {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.05;
    white-space: nowrap;
}

.pm-marca-texto strong {
    font-size: 19px;
    font-weight: 900;
    letter-spacing: .04em;
    background: linear-gradient(100deg, #b45309 0%, #f59e0b 30%, #fde68a 45%, #f59e0b 60%, #c2410c 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pm-brillo 5s ease-in-out infinite;
}

.pm-marca-texto strong em {
    font-style: normal;
}

/* Subtítulo con el punto verde que late. */
.pm-marca-texto small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pm-muted);
}

.pm-marca-punto {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, .6);
    animation: pm-latido 2.2s ease-out infinite;
}

/* Ajustes de la marca en modo oscuro. */
.dark .pm-marca-anillo::after {
    background: #1f2937;
}

.dark .pm-marca-texto strong {
    background-image: linear-gradient(100deg, #fbbf24 0%, #fde68a 30%, #fffbeb 45%, #fcd34d 60%, #fb923c 100%);
}

.dark .fi-topbar {
    background-image: linear-gradient(90deg, rgba(251, 191, 36, .08), transparent 35%);
}

/* Celulares: marca más compacta. */
@media (max-width: 640px) {
    .pm-marca-texto small { display: none; }
    .pm-marca-texto strong { font-size: 16px; }
    .pm-marca-logo { width: 40px; height: 40px; }
    .pm-marca-logo img { height: 32px; }
}

/* Animaciones de la marca y de la barra superior. */
@keyframes pm-linea { to { background-position: 200% 0; } }
@keyframes pm-girar { to { transform: rotate(360deg); } }
@keyframes pm-flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px) rotate(-2deg); } }
@keyframes pm-brillo { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@keyframes pm-latido { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); } }
@keyframes pm-entrar { from { opacity: 0; transform: translateX(-10px) scale(.96); } to { opacity: 1; transform: none; } }

/* Sin animaciones si el usuario pidió reducir movimiento. */
@media (prefers-reduced-motion: reduce) {
    .fi-topbar::after, .pm-marca, .pm-marca-anillo, .pm-marca-logo img, .pm-marca-texto strong, .pm-marca-punto { animation: none !important; }
}
