/* ── Layout base ── */
html, body {
    overflow-x: hidden;
}

main#chatMessages {
    overflow-x: hidden;
}

/* Movil: layout tipo app — body fixed + tracking de visualViewport (height + offsetTop) */
@media (max-width: 639px) {
    html {
        height: 100%;
        overflow: hidden;
    }

    /* Body anclado al visualViewport: top sigue el offset y height sigue la altura visible */
    body {
        position: fixed;
        top: var(--app-y, 0);
        left: 0;
        right: 0;
        width: 100%;
        height: var(--app-h, 100dvh);
        max-height: var(--app-h, 100dvh);
        overflow: hidden;
        overscroll-behavior: none;
        margin: 0;
    }

    /* Contenedor raiz llena el body */
    body > div.flex.flex-col {
        height: 100%;
        max-height: 100%;
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-right: none;
    }

    /* Header, banner y footer nunca se comprimen; solo el main hace scroll interno */
    body > div.flex.flex-col > header,
    body > div.flex.flex-col > footer,
    body > div.flex.flex-col > .pwa-install-bar {
        flex-shrink: 0;
    }

    body > div.flex.flex-col > main {
        flex: 1 1 0;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    /* Footer: padding minimo + safe-area para el home indicator.
       iOS pone safe-area = 0 automaticamente cuando el teclado esta abierto,
       asi que la caja queda pegada al teclado sin JS ni :focus-within. */
    body > div.flex.flex-col > footer {
        padding-top: 0.5rem;
        padding-bottom: calc(0.25rem + env(safe-area-inset-bottom));
    }
}

/* ── Scrollbar ── */
main::-webkit-scrollbar {
    width: 5px;
}

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

main::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

main::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ── Animaciones ── */
.animate-fade-in {
    animation: fadeIn 0.35s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Indicador de escritura ── */
.typing-dots {
    display: flex;
    gap: 5px;
    padding: 4px 0;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgb(1, 129, 198);
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.4);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Avatares ── */
.bot-avatar {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
}

@media (min-width: 640px) {
    .bot-avatar {
        width: 3.5rem;
        height: 3.5rem;
    }
}

.user-avatar {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background: #1f2937;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ── Markdown en burbujas del bot ── */
.markdown-body > *:first-child {
    margin-top: 0;
}

.markdown-body > *:last-child {
    margin-bottom: 0;
}

.markdown-body p {
    margin: 0.4em 0;
}

.markdown-body strong {
    font-weight: 600;
    color: #1f2937;
}

.markdown-body em {
    font-style: italic;
}

/* Listas */
.markdown-body ul,
.markdown-body ol {
    margin: 0.5em 0;
    padding-left: 1.4em;
}

.markdown-body ul {
    list-style: disc;
}

.markdown-body ol {
    list-style: decimal;
}

.markdown-body li {
    margin: 0.2em 0;
}

.markdown-body li > ul,
.markdown-body li > ol {
    margin: 0.1em 0;
}

/* Encabezados */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    font-weight: 600;
    margin: 0.8em 0 0.3em;
    line-height: 1.3;
    color: #111827;
}

.markdown-body h1 { font-size: 1.15em; }
.markdown-body h2 { font-size: 1.08em; }
.markdown-body h3 { font-size: 1.02em; }
.markdown-body h4 { font-size: 0.95em; }

/* Codigo inline */
.markdown-body code {
    background: #e8f4fa;
    color: #0181c6;
    padding: 0.15em 0.4em;
    border-radius: 5px;
    font-size: 0.88em;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

/* Bloque de codigo */
.markdown-body pre {
    background: #0c2d3f;
    color: #d6eef8;
    padding: 14px 18px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 0.6em 0;
    font-size: 0.85em;
    line-height: 1.5;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Tablas */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.6em 0;
    font-size: 0.85em;
    border-radius: 8px;
    overflow: hidden;
}

.markdown-body th,
.markdown-body td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

.markdown-body th {
    font-weight: 600;
    color: #0181c6;
    background: #e8f4fa;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.markdown-body tr:hover td {
    background: #f0f8fc;
}

.markdown-body tr:last-child td {
    border-bottom: none;
}

/* Blockquote */
.markdown-body blockquote {
    border-left: 3px solid rgb(1, 129, 198);
    padding-left: 12px;
    margin: 0.5em 0;
    color: #6b7280;
}

/* Separador */
.markdown-body hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0.8em 0;
}

/* Links */
.markdown-body a {
    color: #0181c6;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.markdown-body a:hover {
    color: #016da8;
}

/* ── Tablas exportables (toolbar Excel) ── */
.a3-table-wrap {
    margin: 0.6em 0;
}

.a3-table-wrap .markdown-body table,
.a3-table-wrap > table {
    margin-top: 0.2em;
}

.table-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 4px;
}

.table-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.table-toolbar button:hover {
    background: #0181c6;
    color: #ffffff;
    border-color: #0181c6;
}

.table-toolbar button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.table-toolbar-error {
    color: #b91c1c;
    font-size: 11px;
    margin-left: auto;
    align-self: center;
}

/* ── Vista previa de Excel (preview de ExportPlugin) ──
   Emula la ventana de Excel: titlebar verde + cuadricula con letras/numeros + tab + statusbar.
   Generado como HTML literal por ExportPlugin.BuildPreviewBlock. */

/* Cuando la burbuja del bot contiene un preview Excel, que se ajuste al contenido en lugar
   de ocupar el flex-1 entero (la burbuja ya no se extendera mas alla del Excel). */
.markdown-body:has(.excel-preview) {
    flex: 0 0 auto;
    width: fit-content;
    max-width: 100%;
    align-self: flex-start;
}

.excel-preview {
    /* Ancho ajustado al contenido (tabla), pero sin exceder el ancho del contenedor;
       si la tabla es mas ancha que el padre, el scroll horizontal lo gestiona .excel-sheet-frame. */
    width: fit-content;
    max-width: 100%;
    margin: 0.6em 0 0.4em;
    border: 1px solid #c8d6df;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    font-family: 'Calibri', 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    color: #1f2937;
}

/* Title bar (verde Excel con icono y nombre del fichero) */
.excel-preview .excel-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #107C41;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

.excel-preview .excel-titlebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #fff;
    color: #107C41;
    border-radius: 2px;
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
}

.excel-preview .excel-titlebar-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Frame que envuelve la tabla y permite scroll horizontal si es ancha */
.excel-preview .excel-sheet-frame {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

/* Tabla principal (sobreescribe los estilos de .markdown-body table) */
.excel-preview .excel-sheet {
    border-collapse: collapse;
    width: auto;
    margin: 0;
    background: #fff;
    border-radius: 0;
    font-size: 12px;
}

.excel-preview .excel-sheet th,
.excel-preview .excel-sheet td {
    border: 1px solid #d0d7de;
    padding: 4px 10px;
    background: #fff;
    color: #1f2937;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 400;
}

/* Fila de letras de columna (A, B, C...) — gris claro tipo Excel */
.excel-preview .excel-col-letters th {
    background: #f0f1f3;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
    font-size: 10px;
    height: 18px;
    padding: 2px 4px;
}

/* Fila de nombres reales — fondo blanco, negrita, separador verde abajo */
.excel-preview .excel-col-names th {
    background: #fafbfc;
    color: #1f2937;
    font-weight: 600;
    border-bottom: 2px solid #107C41;
}

/* Esquina vacia y columna de numeros de fila — gris tipo Excel */
.excel-preview .excel-corner,
.excel-preview .excel-row-num {
    background: #f0f1f3 !important;
    color: #6b7280;
    font-weight: 500;
    font-size: 10px;
    text-align: center;
    width: 36px;
    min-width: 36px;
    padding: 2px 4px;
}

.excel-preview tbody tr:hover td {
    background: #f0f8fc;
}

/* Fila separadora de grupo (cuando se uso agrupar_por en el plugin).
   Mismo estilo que aplica ExcelExportService.StyleGroupSeparator en el xlsx real. */
.excel-preview .excel-group-separator td {
    background: #EFF6FF !important;
    color: #0181c6;
    font-weight: 600;
    text-align: left;
}

.excel-preview .excel-group-separator:hover td {
    background: #EFF6FF !important;
}

/* Tab inferior con el nombre de la hoja activa */
.excel-preview .excel-tabs {
    display: flex;
    gap: 1px;
    background: #f3f4f6;
    border-top: 1px solid #d0d7de;
    padding: 4px 8px 0;
    font-size: 11px;
}

.excel-preview .excel-tab {
    display: inline-block;
    padding: 4px 14px 5px;
    background: #e9ebee;
    border: 1px solid #d0d7de;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    color: #6b7280;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-preview .excel-tab.excel-tab-active {
    background: #fff;
    color: #107C41;
    font-weight: 600;
    margin-bottom: -1px;
    padding-bottom: 6px;
}

/* Barra de estado inferior con la pista */
.excel-preview .excel-statusbar {
    background: #fafbfc;
    border-top: 1px solid #d0d7de;
    padding: 4px 12px 5px;
    font-size: 10.5px;
    color: #6b7280;
}

/* ── Chart containers ── */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0.8em auto;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.chart-container:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
}

.chart-canvas-wrapper.chart-canvas-pie {
    height: 360px;
}

.chart-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 8px;
}

.chart-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.chart-toolbar button:hover {
    background: #0181c6;
    color: #ffffff;
    border-color: #0181c6;
}

/* Modal fullscreen */
.chart-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    cursor: pointer;
}

.chart-modal {
    position: relative;
    width: 92vw;
    max-width: 1400px;
    max-height: 92vh;
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    cursor: default;
}

.chart-modal canvas {
    width: 100% !important;
    max-height: 82vh;
}

.chart-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.chart-modal-close:hover {
    background: #ef4444;
    color: #ffffff;
}

.chart-modal-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.chart-modal-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.chart-modal-toolbar button:hover {
    background: #0181c6;
    color: #ffffff;
    border-color: #0181c6;
}

/* ── Responsive ── */

/* Movil (<640px): graficos mas bajos y modal a pantalla casi completa */
@media (max-width: 639px) {
    /* Evita el zoom automatico de iOS al enfocar el input (requiere >=16px) */
    #chatInput {
        font-size: 16px;
    }

    .chart-container {
        padding: 10px;
    }

    .chart-canvas-wrapper {
        height: 240px;
    }

    .chart-canvas-wrapper.chart-canvas-pie {
        height: 280px;
    }

    .chart-toolbar button {
        font-size: 10px;
        padding: 3px 8px;
    }

    .chart-modal {
        width: 96vw;
        max-height: 92vh;
        padding: 14px;
        border-radius: 12px;
    }

    .chart-modal canvas {
        max-height: 60vh;
    }

    .chart-modal-toolbar button {
        font-size: 11px;
        padding: 5px 10px;
    }

    /* Tablas markdown anchas: scroll horizontal dentro de la burbuja */
    .markdown-body table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .markdown-body pre {
        font-size: 0.78em;
        padding: 10px 12px;
    }
}

/* Tablet (640-1023px): graficos algo mas altos */
@media (min-width: 640px) and (max-width: 1023px) {
    .chart-canvas-wrapper {
        height: 300px;
    }

    .chart-canvas-wrapper.chart-canvas-pie {
        height: 340px;
    }
}

/* ── Feedback de respuestas (pulgar arriba / abajo) ── */
.feedback-bar {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    padding-left: 4px;
    align-items: center;
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.feedback-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #e5e7eb;
}

.feedback-btn:active {
    transform: scale(0.94);
}

.feedback-bar.feedback-up-active .feedback-up {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

.feedback-bar.feedback-down-active .feedback-down {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.feedback-btn.feedback-retry {
    font-size: 16px;
    margin-left: 4px;
}

.feedback-btn.feedback-retry:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

/* ── Modal de razones de feedback ── */
.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
    padding: 16px;
}

.feedback-modal {
    background: #fff;
    border-radius: 16px;
    padding: 20px 22px 18px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.2s ease;
}

.feedback-modal-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
}

.feedback-modal-hint {
    margin: 0 0 14px;
    font-size: 0.82rem;
    color: #6b7280;
}

.feedback-reasons-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.feedback-reason {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.feedback-reason:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.feedback-reason input[type="checkbox"] {
    accent-color: rgb(1, 129, 198);
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
}

.feedback-comment-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.feedback-comment {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.88rem;
    font-family: inherit;
    color: #374151;
    resize: vertical;
    min-height: 64px;
    margin-bottom: 16px;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.feedback-comment:focus {
    outline: none;
    border-color: rgb(1, 129, 198);
}

.feedback-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.feedback-modal-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.feedback-modal-cancel {
    background: #fff;
    color: #374151;
    border-color: #e5e7eb;
}

.feedback-modal-cancel:hover {
    background: #f9fafb;
}

.feedback-modal-send {
    background: rgb(1, 129, 198);
    color: #fff;
}

.feedback-modal-send:hover {
    background: rgb(1, 112, 172);
}

.feedback-modal-send:disabled {
    background: #9ca3af;
    cursor: wait;
}

/* ── Modal de ejemplos de preguntas ── */
.examples-modal {
    display: flex;
    flex-direction: column;
    max-width: 920px;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
}

.examples-modal .feedback-modal-title,
.examples-modal .feedback-modal-hint,
.examples-modal .feedback-modal-actions {
    flex-shrink: 0;
}

.examples-list {
    flex: 1 1 auto;
    overflow-y: auto;
    margin: 0 -4px 12px;
    padding: 0 4px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px 16px;
    align-items: start;
}

.examples-category {
    min-width: 0;
}

.examples-category-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 6px;
}

.examples-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-size: 0.875rem;
    color: #111827;
    cursor: pointer;
    transition: all 0.15s ease;
}

.examples-item:last-child {
    margin-bottom: 0;
}

.examples-item:hover {
    border-color: rgb(1, 129, 198);
    background: #f0f9ff;
    color: rgb(1, 129, 198);
}

/* ── Modal de instalacion iOS ── */
.ios-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.ios-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}

.ios-step-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgb(1, 129, 198);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.ios-step-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.88rem;
    color: #374151;
}

.ios-step-body strong {
    color: #111827;
    font-weight: 600;
}

.ios-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #d1d5db;
    color: rgb(1, 129, 198);
}

/* ── Banner PWA install: animaciones ── */
.pwa-install-bar {
    position: relative;
    overflow: hidden;
    animation: pwaBarSlideIn 0.55s cubic-bezier(.2, .85, .25, 1.05) both;
    background: linear-gradient(90deg, rgb(1, 129, 198) 0%, rgb(0, 149, 220) 50%, rgb(1, 129, 198) 100%);
    background-size: 200% 100%;
    box-shadow: 0 -2px 10px rgba(1, 129, 198, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Sheen que recorre la barra periodicamente */
.pwa-install-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 50%;
    height: 100%;
    background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.28) 50%, transparent 100%);
    transform: skewX(-18deg);
    animation: pwaBarSheen 3.8s ease-in-out 1s infinite;
    pointer-events: none;
}

.pwa-install-bar-icon {
    display: inline-flex;
    animation: pwaBarIconBounce 2.4s ease-in-out infinite;
}

.pwa-install-bar-btn {
    position: relative;
    animation: pwaBarBtnPulse 2.2s ease-in-out 1s infinite;
}

@keyframes pwaBarSlideIn {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pwaBarSheen {
    0% {
        left: -60%;
    }
    55%, 100% {
        left: 120%;
    }
}

@keyframes pwaBarIconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-2px);
    }
    60% {
        transform: translateY(3px);
    }
    80% {
        transform: translateY(0);
    }
}

@keyframes pwaBarBtnPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-install-bar,
    .pwa-install-bar::after,
    .pwa-install-bar-icon,
    .pwa-install-bar-btn {
        animation: none !important;
    }
}

/* Pulso de atencion del boton de ejemplos en la primera visita */
@keyframes help-btn-pulse {
    0%, 100% { box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 0 0 0 rgba(1,129,198,0.55); }
    50%      { box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 0 0 10px rgba(1,129,198,0); }
}

.help-btn-pulse {
    animation: help-btn-pulse 1.8s ease-in-out infinite;
    border-color: rgb(1,129,198) !important;
    color: rgb(1,129,198) !important;
    background-color: #f0f9ff !important;
}

@media (prefers-reduced-motion: reduce) {
    .help-btn-pulse {
        animation: none !important;
    }
}
