﻿        /* ==============================
           CHAT WIDGET
        ============================== */
        .chat-fab {
            position: fixed;
            bottom: calc(60px + 56px + env(safe-area-inset-bottom, 0px));
            right: var(--space-lg);
            width: auto;
            height: auto;
            border-radius: var(--radius-lg);
            background: var(--surface);
            border: 1px solid var(--border);
            cursor: pointer;
            z-index: 998;
            transition: all 0.35s var(--ease-spring);
            padding: 0;
            box-shadow: var(--shadow-lg);
        }

        .chat-fab-label {
            position: relative;
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: var(--space-sm);
            padding: var(--space-sm) var(--space-md);
            pointer-events: none;
        }

        .chat-fab-label .continue-icon {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background: var(--primary-light);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.3s var(--ease-spring);
        }

        .chat-fab:hover .continue-icon {
            transform: scale(1.1) rotate(-8deg);
        }

        .chat-fab-label .continue-icon .material-icons-round {
            font-size: 16px;
            color: var(--primary);
        }

        .chat-fab-label::after {
            content: 'Chat Bíblico';
            display: block;
            color: var(--text);
            font-size: var(--text-xs);
            font-weight: 700;
            letter-spacing: 0.3px;
            text-transform: uppercase;
            white-space: nowrap;
        }

        .chat-fab.active {
            transform: none;
            background: var(--surface);
            box-shadow: var(--shadow-md);
        }

        .chat-fab.active .chat-fab-label { opacity: 0; transform: scale(0.8); pointer-events: none; }

        .chat-fab:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow-xl);
        }

        .chat-fab:active {
            transform: scale(0.96);
        }

        #chat-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 999;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s var(--ease-standard);
        }

        #chat-overlay.open {
            opacity: 1;
            pointer-events: auto;
        }

        .chat-panel {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            max-height: 75dvh;
            background: var(--bg);
            border-radius: var(--radius-xl) var(--radius-xl) 0 0;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            transform: translateY(100%);
            transition: transform 0.4s var(--ease-snap-out);
            box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
        }

        .chat-panel.open {
            transform: translateY(0);
        }

        .chat-handle {
            width: 40px;
            height: 4px;
            border-radius: var(--radius-full);
            background: var(--surface2);
            margin: var(--space-sm) auto var(--space-xs);
            flex-shrink: 0;
            transition: background 0.2s ease;
        }

        .chat-header {
            display: flex;
            align-items: center;
            gap: var(--space-md);
            padding: var(--space-sm) var(--space-xl) var(--space-lg);
            flex-shrink: 0;
        }

        .chat-header-icon {
            width: 40px;
            height: 40px;
            border-radius: var(--radius-md);
            background: var(--primary-light);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .chat-header-icon .material-icons-round {
            font-size: 20px;
            color: var(--primary);
        }

        .chat-header-info { flex: 1; min-width: 0; }

        .chat-header-title {
            font-weight: 700;
            font-size: var(--text-md);
        }

        .chat-header-sub {
            font-size: var(--text-xs);
            color: var(--text-secondary);
        }

        .chat-header-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: var(--space-sm);
            border-radius: 50%;
            transition: all 0.2s var(--ease-standard);
            flex-shrink: 0;
            min-width: 36px;
            min-height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .chat-header-close:hover {
            background: var(--surface);
            color: var(--text);
        }

        .chat-header-close:active {
            transform: scale(0.9);
        }

        #chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: var(--space-xs) var(--space-xl) var(--space-sm);
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
            scroll-behavior: smooth;
        }

        .chat-msg {
            max-width: 88%;
            padding: var(--space-md) var(--space-lg);
            border-radius: var(--radius-lg);
            font-size: var(--text-base);
            line-height: 1.6;
            animation: msgIn 0.3s var(--ease-spring) both;
            word-wrap: break-word;
        }

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

        .chat-msg.ai {
            align-self: flex-start;
            background: var(--surface);
            border: 1px solid var(--border);
            color: var(--text);
            border-bottom-left-radius: var(--radius-xs);
        }

        .chat-msg.user {
            align-self: flex-end;
            background: var(--primary);
            color: white;
            border-bottom-right-radius: var(--radius-xs);
        }

        .chat-msg.ai .msg-label {
            font-size: var(--text-xs);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--primary);
            display: block;
            margin-bottom: var(--space-xs);
        }

        .chat-msg.ai .msg-ref {
            display: inline-block;
            margin-top: var(--space-sm);
            padding: var(--space-xs) var(--space-sm);
            font-size: var(--text-xs);
            font-weight: 600;
            color: var(--primary);
            cursor: pointer;
            background: var(--primary-light);
            border-radius: var(--radius-xs);
            transition: all 0.2s ease;
        }

        .chat-msg.ai .msg-ref:hover {
            background: var(--primary);
            color: white;
        }

        .msg-source {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            margin-top: var(--space-md);
            padding: var(--space-sm) var(--space-md);
            background: var(--surface2);
            border-radius: var(--radius-sm);
            font-size: var(--text-xs);
            color: var(--text-secondary);
            border: 1px solid var(--border);
        }

        .msg-source .source-icon {
            font-size: 14px;
        }

        .msg-source .source-link {
            color: var(--primary);
            text-decoration: none;
            font-weight: 600;
            transition: color 0.2s;
        }

        .msg-source .source-link:hover {
            text-decoration: underline;
        }

        .chat-suggestions {
            display: flex;
            gap: var(--space-sm);
            padding: var(--space-xs) var(--space-xl) var(--space-md);
            flex-wrap: wrap;
            flex-shrink: 0;
        }

        .chat-suggestion-btn {
            background: var(--primary-light);
            border: 1px solid transparent;
            border-radius: var(--radius-full);
            padding: var(--space-sm) var(--space-md);
            font-size: var(--text-xs);
            font-weight: 600;
            color: var(--primary);
            cursor: pointer;
            transition: all 0.2s var(--ease-standard);
            font-family: var(--font-main);
            white-space: nowrap;
        }

        .chat-suggestion-btn:hover {
            background: var(--primary);
            color: white;
            transform: translateY(-1px);
            box-shadow: var(--shadow-sm);
        }

        .chat-suggestion-btn:active {
            transform: scale(0.96);
        }

        .chat-input-area {
            display: flex;
            align-items: flex-end;
            gap: var(--space-sm);
            padding: var(--space-md) var(--space-xl) calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
            border-top: 1px solid var(--border);
            flex-shrink: 0;
            background: var(--bg);
        }

        #chat-input {
            flex: 1;
            background: var(--surface);
            border: 1.5px solid var(--border);
            border-radius: var(--radius-lg);
            padding: var(--space-md) var(--space-lg);
            font-size: var(--text-base);
            font-family: var(--font-main);
            color: var(--text);
            resize: none;
            outline: none;
            max-height: 80px;
            min-height: 42px;
            transition: border-color 0.2s var(--ease-standard), box-shadow 0.2s var(--ease-standard);
            line-height: 1.5;
        }

        #chat-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px var(--primary-light);
        }

        #chat-input::placeholder {
            color: var(--text-secondary);
        }

        .chat-send-btn {
            width: 42px;
            height: 42px;
            min-width: 42px;
            border-radius: 50%;
            background: var(--primary);
            border: none;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.25s var(--ease-spring);
            flex-shrink: 0;
            box-shadow: var(--shadow-sm);
        }

        .chat-send-btn:disabled {
            opacity: 0.3;
            pointer-events: none;
        }

        .chat-send-btn:hover {
            transform: scale(1.08);
            box-shadow: var(--shadow-md), 0 0 20px var(--primary-glow);
        }

        .chat-send-btn:active {
            transform: scale(0.92);
        }

        .chat-send-btn .material-icons-round {
            font-size: 20px;
        }

        .typing-indicator {
            align-self: flex-start;
            display: flex;
            align-items: center;
            gap: 5px;
            padding: var(--space-md) var(--space-lg);
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            border-bottom-left-radius: var(--radius-xs);
            animation: msgIn 0.25s var(--ease-spring) both;
        }

        .typing-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--text-secondary);
            animation: dotBounce 1.2s ease-in-out infinite;
        }

        .typing-dot:nth-child(2) { animation-delay: 0.15s; }
        .typing-dot:nth-child(3) { animation-delay: 0.3s; }

        @keyframes dotBounce {
            0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
            40% { transform: translateY(-5px); opacity: 1; }
        }

        .chat-empty {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: var(--space-xl);
            text-align: center;
            gap: var(--space-sm);
        }

        .chat-empty .material-icons-round {
            font-size: 40px;
            color: var(--primary-light);
            margin-top: var(--space-sm);
        }

        .chat-empty-title {
            font-weight: 700;
            font-size: var(--text-md);
        }

        .chat-empty-sub {
            font-size: var(--text-sm);
            color: var(--text-secondary);
            max-width: 260px;
            line-height: 1.5;
        }

        @media (min-width: 600px) {
            .chat-panel {
                left: auto;
                right: var(--space-xl);
                bottom: 80px;
                width: 400px;
                max-height: 540px;
                border-radius: var(--radius-xl);
                box-shadow: var(--shadow-xl), 0 0 0 1px var(--border);
                transform: translateY(20px) scale(0.96);
                opacity: 0;
                transition: all 0.35s var(--ease-snap-out);
            }
            .chat-panel.open {
                transform: translateY(0) scale(1);
                opacity: 1;
            }
            .chat-fab {
                bottom: 24px;
                right: 24px;
            }
            .chat-handle { display: none; }
        }

        .section-title {
            font-size: var(--text-xs);
            font-weight: 700;
            margin: var(--space-2xl) 0 var(--space-md);
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.8px;
            position: relative;
            padding-left: var(--space-lg);
        }

        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 1px;
            bottom: 1px;
            width: 3px;
            border-radius: var(--radius-full);
            background: var(--primary);
        }

        .continue-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            padding: var(--space-lg);
            display: flex;
            align-items: center;
            gap: var(--space-lg);
            cursor: pointer;
            box-shadow: var(--shadow-sm);
            transition: all 0.25s var(--ease-standard);
        }

        .continue-card:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
            border-color: var(--primary-light);
        }

        .continue-card:active {
            transform: scale(0.98);
        }

        .continue-icon {
            width: 44px;
            height: 44px;
            border-radius: var(--radius-md);
            background: var(--primary-light);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: transform 0.3s var(--ease-spring);
        }

        .continue-card:hover .continue-icon {
            transform: scale(1.05);
        }

        .continue-icon .material-icons-round {
            font-size: 22px;
            color: var(--primary);
        }

        .continue-info {
            display: flex;
            flex-direction: column;
            gap: 2px;
            flex: 1;
            min-width: 0;
        }

        .continue-title {
            font-size: var(--text-md);
            font-weight: 700;
        }

        .continue-sub {
            font-size: var(--text-xs);
            color: var(--text-secondary);
        }

        .continue-arrow {
            color: var(--text-secondary);
            flex-shrink: 0;
            transition: transform 0.3s var(--ease-spring), color 0.2s ease;
        }

        .continue-card:hover .continue-arrow {
            transform: translateX(4px);
            color: var(--primary);
        }

        /* ==============================
           PWA INSTALL BANNER
        ============================== */
        .pwa-install-banner {
            position: fixed;
            left: 16px;
            right: 16px;
            bottom: calc(80px + env(safe-area-inset-bottom, 0px));
            z-index: 1010;
            display: flex;
            align-items: center;
            gap: 12px;
            background: #1e293b;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: var(--radius-lg, 16px);
            padding: 14px 16px;
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
            transform: translateY(140%);
            opacity: 0;
            pointer-events: none;
            transition: transform .4s cubic-bezier(.2, .8, .2, 1), opacity .3s ease;
        }

        .pwa-install-banner.show {
            transform: translateY(0);
            opacity: 1;
            pointer-events: auto;
            z-index: 1010;
        }

        .pwa-install-banner .pwa-install-icon {
            flex-shrink: 0;
            width: 44px;
            height: 44px;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
        }

        .pwa-install-banner .pwa-install-icon img {
            width: 100%;
            height: 100%;
            display: block;
            object-fit: cover;
        }

        .pwa-install-banner .pwa-install-text {
            flex: 1;
            min-width: 0;
        }

        .pwa-install-banner .pwa-install-title {
            font-weight: 700;
            font-size: 16px;
            color: var(--text-primary, #fff);
            margin-bottom: 3px;
        }

        .pwa-install-banner .pwa-install-subtitle {
            font-size: 14px;
            color: var(--text-secondary, #94a3b8);
            line-height: 1.3;
        }

        .pwa-install-banner .pwa-install-btn {
            flex-shrink: 0;
            background: var(--primary, #3b82f6);
            color: #fff;
            border: none;
            padding: 10px 18px;
            border-radius: 999px;
            font-weight: 700;
            font-size: 13px;
            cursor: pointer;
            white-space: nowrap;
        }

        .pwa-install-banner .pwa-install-btn:active {
            transform: scale(0.96);
        }

        .pwa-install-banner .pwa-install-close {
            position: absolute;
            top: 6px;
            right: 6px;
            width: 22px;
            height: 22px;
            border: none;
            background: none;
            color: var(--text-secondary, #94a3b8);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        .pwa-install-banner .pwa-install-close:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .pwa-install-banner .pwa-install-close .material-icons-round {
            font-size: 15px;
        }

        @media (min-width: 480px) {
            .pwa-install-banner {
                left: auto;
                right: 24px;
                width: 360px;
                bottom: 24px;
            }
        }

