/**
 * ============================================================================
 * ARCHIVO: assets/css/estilos-personalizados.css
 * DESCRIPCIÓN: Estilos auxiliares, utilidades de alto contraste para obra,
 *              animaciones y reglas de impresión para informes.
 * ============================================================================
 */

/* ----------------------------------------------------------------------------
 * 1. Variables de Tema y Tipografía
 * ---------------------------------------------------------------------------- */
:root {
    --color-primary: #f59e0b;
    /* Amber 500 */
    --color-primary-dark: #d97706;
    /* Amber 600 */
    --color-bg-light: #f8fafc;
    --color-bg-dark: #0f172a;
    --color-surface-light: #ffffff;
    --color-surface-dark: #1e293b;
    --font-stack: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-stack);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

/* ----------------------------------------------------------------------------
 * 2. Mejoras de Accesibilidad y Alto Contraste en Obra (Bajo Sol Directo)
 * ---------------------------------------------------------------------------- */
.touch-target-large {
    min-height: 3.5rem;
    /* h-14 */
    touch-action: manipulation;
}

.high-contrast-card {
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
}

.dark .high-contrast-card {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* Espaciado inferior de seguridad para que la barra móvil fija (dock) nunca tape contenido */
.safe-area-pb {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 1023px) {
    main {
        padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ----------------------------------------------------------------------------
 * 3. Glassmorphism & Efectos Visuales
 * ---------------------------------------------------------------------------- */
.glass-effect {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dark .glass-effect {
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ----------------------------------------------------------------------------
 * 4. Microanimaciones y Transiciones Suaves
 * ---------------------------------------------------------------------------- */
.fade-in-up {
    animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse-badge {
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.85;
    }
}

/* ----------------------------------------------------------------------------
 * 5. Barra de Desplazamiento Personalizada
 * ---------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ----------------------------------------------------------------------------
 * 6. Contenedor de Notificaciones Flotantes (Toasts)
 * ---------------------------------------------------------------------------- */
#contenedor-toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    max-width: 90vw;
    width: 380px;
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: 0.875rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    animation: toastSlideIn 0.3s ease-out forwards;
    transition: all 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-item.toast-salida {
    opacity: 0;
    transform: translateX(100%);
}

.toast-exito {
    background-color: #065f46;
    color: #ecfdf5;
    border: 1px solid #059669;
}

.toast-error {
    background-color: #991b1b;
    color: #fef2f2;
    border: 1px solid #dc2626;
}

.toast-info {
    background-color: #1e3a8a;
    color: #eff6ff;
    border: 1px solid #2563eb;
}

.toast-advertencia {
    background-color: #92400e;
    color: #fffbeb;
    border: 1px solid #d97706;
}

/* ----------------------------------------------------------------------------
 * 7. Reglas para Impresión y Exportación Física
 * ---------------------------------------------------------------------------- */
@media print {

    .no-print,
    #sidebar-principal,
    #barra-navegacion-inferior,
    #cabecera-superior,
    #contenedor-toast,
    button:not(.btn-print) {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 10pt;
    }

    .card,
    .bg-slate-800,
    .bg-slate-900 {
        background: #ffffff !important;
        color: #000000 !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: none !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    th,
    td {
        border: 1px solid #cbd5e1 !important;
        padding: 6px 8px !important;
        color: #000000 !important;
    }

    th {
        background-color: #f1f5f9 !important;
    }
}

/* ----------------------------------------------------------------------------
 * 8. Cabecera Fija (Sticky Header) para Tablas de Desglose
 * ---------------------------------------------------------------------------- */
.tabla-sticky-header {
    border-collapse: separate;
    border-spacing: 0;
}

.tabla-sticky-header thead {
    position: sticky;
    top: 0;
    z-index: 20;
}

.tabla-sticky-header thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #ffffff;
}

.dark .tabla-sticky-header thead th {
    background-color: #1e293b;
    /* slate-800 */
}

/* ----------------------------------------------------------------------------
 * 9. Botón Guardar Tarea (Tamaño Táctil Responsivo)
 * ---------------------------------------------------------------------------- */
#boton-guardar-parte,
#boton-cancelar-edicion {
    min-height: 56px !important;
    height: 56px !important;
}

@media (min-width: 640px) {

    #boton-guardar-parte,
    #boton-cancelar-edicion {
        min-height: 56px !important;
        height: 56px !important;
    }
}

/* ----------------------------------------------------------------------------
 * 10. Animación de Palpitar para Bloque de Sugerencias de Tareas
 * ---------------------------------------------------------------------------- */
@keyframes palpitarMoradoSuave {
    0%, 100% {
        background-color: rgba(168, 85, 247, 0.08);
        border-color: rgba(192, 132, 252, 0.45);
        box-shadow: 0 4px 15px -1px rgba(168, 85, 247, 0.12);
    }
    50% {
        background-color: rgba(168, 85, 247, 0.22);
        border-color: rgba(168, 85, 247, 0.85);
        box-shadow: 0 0 25px 6px rgba(168, 85, 247, 0.35);
    }
}

@keyframes palpitarMoradoDark {
    0%, 100% {
        background-color: rgba(88, 28, 135, 0.25);
        border-color: rgba(147, 51, 234, 0.4);
        box-shadow: 0 4px 15px -1px rgba(147, 51, 234, 0.15);
    }
    50% {
        background-color: rgba(88, 28, 135, 0.55);
        border-color: rgba(168, 85, 247, 0.9);
        box-shadow: 0 0 25px 8px rgba(168, 85, 247, 0.45);
    }
}

.bloque-palpitar-morado {
    animation: palpitarMoradoSuave 2.6s ease-in-out infinite;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.dark .bloque-palpitar-morado {
    animation: palpitarMoradoDark 2.6s ease-in-out infinite;
}