/* FutureAI Frontend Chatbot Styles - Floating Button Design */

/* Floating Chat Button */
.futureai-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #000000 0%, #003366 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 51, 102, 0.3);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    color: white;
    font-size: 24px;
}

.futureai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 51, 102, 0.4);
}

.futureai-chat-toggle.active {
    transform: rotate(180deg);
}

/* Icon rotation for toggle button */
.futureai-chat-toggle svg {
    transition: transform 0.3s ease;
}

.futureai-chat-toggle.active svg {
    transform: rotate(180deg);
}

/* Better shadow animation */
.futureai-chat-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #000000 0%, #003366 100%);
    z-index: -1;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: scale(0.8);
    opacity: 0;
}

.futureai-chat-toggle:hover::before {
    transform: scale(1.2);
    opacity: 0.2;
}

/* Add pulse effect for attention */
.futureai-chat-toggle.pulse {
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0% {
        box-shadow: 0 4px 20px rgba(0, 51, 102, 0.3);
    }
    50% {
        box-shadow: 0 4px 30px rgba(0, 51, 102, 0.6);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 51, 102, 0.3);
    }
}

/* Chat Container - Hidden by default */
.futureai-chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    min-width: 300px;
    min-height: 400px;
    max-width: 800px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9998;
}

.futureai-chatbot-container.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Resize handle for normal chat (not fullscreen) */
.futureai-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    z-index: 1002;
    background: transparent;
    border-top-left-radius: 16px;
}

.futureai-resize-handle::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.futureai-resize-handle:hover::before {
    opacity: 1;
}

/* Hide resize handle in fullscreen mode */
.futureai-chatbot-container.fullscreen .futureai-resize-handle {
    display: none;
}

/* Visual feedback during resize */
.futureai-chatbot-container.futureai-resizing {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

/* Disable text selection during resize */
body.futureai-no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Header */
.futureai-chatbot-header {
    background: linear-gradient(135deg, #000000 0%, #003366 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.futureai-chatbot-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.futureai-chatbot-title::before {
    content: "🤖";
    font-size: 18px;
}

.futureai-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.futureai-chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Header buttons container */
.futureai-header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Help Button */
.futureai-help-button {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.futureai-help-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Messages Area */
.futureai-message.futureai-bot-message {
    float: left;
}
.futureai-message.futureai-user-message {
    float: right;
}
.futureai-chatbot-messages {
    padding: 20px;
    background: #f8fafc;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.futureai-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.futureai-bot-message {
    align-self: flex-start;
}

.futureai-user-message {
    align-self: flex-end;
}

.futureai-message-content {
    padding: 12px 16px;
    border-radius: 20px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    position: relative;
}

.futureai-bot-message .futureai-message-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.futureai-user-message .futureai-message-content {
    background: linear-gradient(135deg, #000000 0%, #003366 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.2);
}

.futureai-message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    padding: 0 16px;
}

.futureai-user-message .futureai-message-time {
    text-align: right;
    color: #94a3b8;
}

/* Input Area */
.futureai-chatbot-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* Global Search Checkbox */
.futureai-global-search-container {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.futureai-global-search-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #475569;
    margin: 0;
}

.futureai-global-search-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #003366;
    cursor: pointer;
}

.futureai-global-search-text {
    font-weight: 500;
    user-select: none;
}

/* Options Container - New Design */
.futureai-options-container {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.futureai-options-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.futureai-options-toggle:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.futureai-options-toggle.active {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.futureai-options-arrow {
    transition: transform 0.2s ease;
}

.futureai-options-toggle.active .futureai-options-arrow {
    transform: rotate(180deg);
}

.futureai-options-panel {
    margin-top: 8px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.futureai-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #475569;
    margin: 0;
    padding: 4px 0;
}

.futureai-option-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #003366;
    cursor: pointer;
}

.futureai-option-text {
    font-weight: 500;
    user-select: none;
}

.futureai-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.futureai-chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 22px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    background: #ffffff;
    line-height: 1.4;
}

.futureai-chat-input:focus {
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.futureai-chat-input::placeholder {
    color: #94a3b8;
}

/* Disabled state styles */
.futureai-chat-input:disabled,
.futureai-chat-input.disabled {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

.futureai-chat-input:disabled::placeholder,
.futureai-chat-input.disabled::placeholder {
    color: #94a3b8;
}

/* No access message styles */
.futureai-no-access-message {
    padding: 20px;
    text-align: center;
}

.futureai-no-access-message .futureai-message-content {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    text-align: center;
    font-weight: 500;
}

.futureai-send-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #000000 0%, #003366 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 16px;
}

.futureai-send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.futureai-send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: #94a3b8;
}

.futureai-send-button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: #94a3b8;
}

/* Typing Indicator */
.futureai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 13px;
    /* Remove margin-top when inside options container */
}

/* Standalone typing indicator (when no options container) */
.futureai-chatbot-input-area > .futureai-typing-indicator {
    margin-top: 8px;
    padding: 0 16px;
}

.futureai-typing-dots {
    display: flex;
    gap: 4px;
}

.futureai-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #000000 0%, #003366 100%);
    animation: futureai-typing 1.4s infinite ease-in-out;
}

.futureai-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.futureai-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes futureai-typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Welcome Message */
.futureai-welcome-message {
    text-align: left;
}

.futureai-welcome-message .futureai-message {
    max-width: 100%;
}

.futureai-welcome-message .futureai-message-content {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    color: #475569;
}

/* Online Status Indicator */
.futureai-status-indicator {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Load More Messages Button */
.futureai-load-more-container {
    padding: 5px 10px;
    text-align: center;
    margin-bottom:10px;
    order: -1;
    flex-shrink: 0;
}

.futureai-load-more-btn {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.futureai-load-more-btn:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.futureai-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.futureai-load-more-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    animation: spin 1s linear infinite;
}

/* Messages Container */
.futureai-messages-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0 0 10px 0;
}

/* Improved message history styling */
.futureai-message[data-message-id] {
    opacity: 0.9;
    border-left: 3px solid transparent;
}

/* Smooth entrance animation for history messages */
.futureai-message[data-message-id] {
    animation: fadeInHistory 0.3s ease-out;
}

@keyframes fadeInHistory {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .futureai-chat-toggle {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    
    .futureai-chatbot-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        transform: translateX(100%);
        opacity: 1;
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        z-index: 10000;
        max-height: 100vh;
        overflow: hidden;
    }
    
    .futureai-chatbot-container.open {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    
    .futureai-chatbot-header {
        position: sticky;
        top: 0;
        z-index: 10001;
        padding: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        flex-shrink: 0;
    }
    
    .futureai-chatbot-messages {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: calc(100% - 140px); /* Ajustar según altura del header + input */
        min-height: 0;
    }
    
    .futureai-chatbot-input-area {
        position: sticky;
        bottom: 0;
        padding: 16px;
        border-top: 1px solid #e2e8f0;
        background: white;
        flex-shrink: 0;
        z-index: 10001;
    }
    
    .futureai-message {
        max-width: 85%;
    }
    
    .futureai-chatbot-title {
        font-size: 15px;
    }
    
    /* Evitar zoom en inputs en iOS */
    .futureai-chatbot-input-area input,
    .futureai-chatbot-input-area textarea {
        font-size: 16px;
    }
    
    /* Manejar el teclado virtual */
    .futureai-chatbot-container {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height para navegadores compatibles */
    }
}

@media (max-width: 480px) {
    .futureai-chatbot-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }
    
    .futureai-chatbot-header {
        position: sticky;
        top: 0;
        padding: 12px 16px;
        z-index: 10001;
    }
    
    .futureai-chatbot-messages {
        padding: 12px;
        height: calc(100% - 120px);
    }
    
    .futureai-chatbot-input-area {
        position: sticky;
        bottom: 0;
        padding: 12px;
        background: white;
        z-index: 10001;
    }
    
    .futureai-chatbot-input-area input,
    .futureai-chatbot-input-area textarea {
        font-size: 16px;
    }
}

/* Scrollbar Styling */
.futureai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.futureai-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.futureai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.futureai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Error Message */
.futureai-error-message .futureai-message-content {
    background: #ef4444 !important;
    color: white !important;
    border-color: #dc2626 !important;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .futureai-chatbot-container {
        background: #1e293b;
        border-color: #334155;
    }
    
    .futureai-chatbot-messages {
        background: #0f172a;
    }
    
    .futureai-bot-message .futureai-message-content {
        background: #334155;
        color: #f1f5f9;
        border-color: #475569;
    }
    
    .futureai-chatbot-input-area {
        background: #1e293b;
        border-color: #334155;
    }
    
    .futureai-chat-input {
        background: #334155;
        color: #f5f5f5;
        border-color: #475569;
    }
    
    .futureai-chat-input::placeholder {
        color: #94a3b8;
    }
}

/* Notification Badge */
.futureai-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Loading Spinner */
.futureai-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    border-top-color: #003366;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* PDF Button Styles */
.futureai-pdf-button-container {
    margin-top: 10px;
}

.futureai-pdf-button {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
    max-width: 100%;
    text-decoration: none;
}

.futureai-pdf-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    box-shadow: 0 3px 12px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

.futureai-pdf-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.futureai-pdf-button svg {
    flex-shrink: 0;
    margin-right: 5px;
}

.futureai-pdf-button .button-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.futureai-pdf-button .button-loading {
    display: none;
    font-size: 11px;
    margin-left: 5px;
}

.futureai-pdf-button:disabled .button-loading {
    display: inline;
}

/* Animation for PDF button appearance */
.futureai-pdf-button-container {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fullscreen mode styles */
.futureai-chatbot-container.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    transform: none !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
}

.futureai-chatbot-container.fullscreen .futureai-chatbot-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* Full width, not just 75% */
    z-index: 10000; /* Above PDF */
    border-radius: 0;
    flex-shrink: 0;
    background: linear-gradient(135deg, #000000 0%, #003366 100%); /* Mantener el degradado original */
    backdrop-filter: blur(10px);
}

/* PDF viewer takes 3/4 of the screen width */
.futureai-pdf-viewer {
    position: absolute;
    left: 0;
    top: 0; /* Start from the very top, no gap */
    width: 75% !important;
    height: 100vh !important;
    background: #f5f5f5;
    border-right: 1px solid #ddd;
    overflow: hidden; /* Hide overflow to prevent scroll issues */
    padding: 0; /* Remove padding to eliminate gaps */
}

/* Chat section takes 1/4 of the right side */
.futureai-chatbot-container.fullscreen .futureai-chat-section {
    position: absolute;
    right: 0;
    top: 60px; /* Below header */
    width: 25% !important;
    height: calc(100vh - 60px) !important;
    display: flex;
    flex-direction: column;
    background: white;
}

.futureai-chatbot-container.fullscreen .futureai-chatbot-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    max-height: none !important;
}

.futureai-chatbot-container.fullscreen .futureai-chatbot-input-area {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

.futureai-pdf-viewer iframe {
    width: 100% !important;
    height: calc(100% - 60px) !important; /* Account for header height */
    border: none !important;
    display: block;
    margin-top: 60px; /* Space for the floating header */
}

.futureai-pdf-iframe {
    background: #f5f5f5;
}

.futureai-chatbot-container.fullscreen .futureai-chatbot-input-area {
    flex-shrink: 0 !important;    margin-top: auto !important;
}

.fullscreen button.futureai-help-button {
    margin-right: 40px;
}

/* Responsive adjustments for fullscreen */
@media (max-width: 768px) {
    .futureai-pdf-viewer {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 60% !important;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .futureai-chatbot-container.fullscreen .futureai-chat-section {
        position: relative !important;
        right: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 40% !important;
    }
    
    .futureai-chatbot-container.fullscreen {
        flex-direction: column !important;
    }
}

/* Fullscreen close button */
.futureai-fullscreen-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px 5px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    z-index: 1001;
}

.futureai-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mejorar la robustez de los botones PDF */
.futureai-pdf-button {
    /* Asegurar que el botón sea completamente clickeable */
    position: relative;
    pointer-events: auto;
    overflow: hidden;
    word-wrap: break-word;
    white-space: normal;
}

.futureai-pdf-button * {
    /* Asegurar que todos los elementos internos no bloqueen clicks */
    pointer-events: none;
}

.futureai-pdf-button .button-text {
    /* Mejorar la visualización del texto largo */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.3;
}

/* Asegurar que los botones con caracteres especiales funcionen */
.futureai-pdf-button[id*="pdf-btn"] {
    /* Estilo específico para todos los botones PDF */
    cursor: pointer !important;
    user-select: none;
}

.futureai-pdf-button[id*="pdf-btn"]:hover:not(:disabled) {
    /* Asegurar hover en todos los botones PDF */
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
    box-shadow: 0 3px 12px rgba(220, 38, 38, 0.3) !important;
    transform: translateY(-1px) !important;
}

/* Hide body scroll when chatbot is in fullscreen */
body.futureai-fullscreen-active {
    overflow: hidden !important;
}
 
/* PDF loading overlay */
.futureai-pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    z-index: 200;
}

.futureai-pdf-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Help Modal */
.futureai-help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.futureai-help-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.futureai-help-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: helpModalFadeIn 0.3s ease-out;
}

@keyframes helpModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.futureai-help-modal-header {
    background: linear-gradient(135deg, #000000 0%, #003366 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.futureai-help-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.futureai-help-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.futureai-help-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.futureai-help-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.futureai-help-content {
    line-height: 1.6;
    color: #334155;
}

.futureai-help-content h1,
.futureai-help-content h2,
.futureai-help-content h3,
.futureai-help-content h4,
.futureai-help-content h5,
.futureai-help-content h6 {
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 12px;
}

.futureai-help-content h1 {
    font-size: 24px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.futureai-help-content h2 {
    font-size: 20px;
    margin-top: 24px;
}

.futureai-help-content h3 {
    font-size: 16px;
    margin-top: 20px;
}

.futureai-help-content p {
    margin-bottom: 16px;
}

.futureai-help-content ul,
.futureai-help-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.futureai-help-content li {
    margin-bottom: 8px;
}

.futureai-help-content strong {
    color: #1e293b;
    font-weight: 600;
}

.futureai-help-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.futureai-help-content blockquote {
    border-left: 4px solid #003366;
    margin: 16px 0;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .futureai-help-modal {
        padding: 10px;
    }
    
    .futureai-help-modal-content {
        max-height: 90vh;
    }
    
    .futureai-help-modal-header {
        padding: 16px;
    }
    
    .futureai-help-modal-body {
        padding: 20px;
    }
    
    .futureai-help-content h1 {
        font-size: 20px;
    }
    
    .futureai-help-content h2 {
        font-size: 18px;
    }
}

/* Prevent body scroll when modal is open */
body.futureai-modal-open {
    overflow: hidden;
}

/* PDF Navigation Controls */
.futureai-pdf-navigation {
    position: absolute !important;
    bottom: 20px !important; /* Position at bottom */
    left: 50% !important;
    transform: translateX(-50%) !important; /* Center horizontally */
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.9) !important;
    border-radius: 25px;
    padding: 12px 20px;
    z-index: 99999 !important; /* Very high z-index */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-width: 200px;
}

.futureai-pdf-navigation:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.05);
}

.futureai-pdf-navigation .nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    margin: 0 5px;
}

.futureai-pdf-navigation .nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.futureai-pdf-navigation .nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.futureai-pdf-navigation .page-info {
    color: white;
    margin: 0 12px;
    text-align: center;
    font-size: 12px;
    line-height: 1.2;
    min-width: 60px;
}

.futureai-pdf-navigation .page-info .current-page {
    font-weight: bold;
    font-size: 14px;
}

.futureai-pdf-navigation .page-info small {
    display: block;
    opacity: 0.8;
    font-size: 10px;
    margin-top: 2px;
}

/* Animation for navigation appearance */
.futureai-pdf-navigation {
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Responsive adjustments for navigation */
@media (max-width: 768px) {
    .futureai-pdf-navigation {
        padding: 6px 12px;
        border-radius: 20px;
    }
    
    .futureai-pdf-navigation .nav-btn {
        width: 28px;
        height: 28px;
        padding: 6px;
    }
    
    .futureai-pdf-navigation .page-info {
        margin: 0 8px;
        min-width: 50px;
        font-size: 11px;
    }
    
    .futureai-pdf-navigation .page-info .current-page {
        font-size: 13px;
    }
    
    .futureai-pdf-navigation .page-info small {
        font-size: 9px;
    }
}

/* Ensure navigation is visible on PDF viewer - make more specific */
.futureai-chatbot-container.fullscreen .futureai-pdf-viewer {
    position: relative;
}

.futureai-chatbot-container.fullscreen .futureai-pdf-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Make sure navigation is always on top */
.futureai-chatbot-container.fullscreen .futureai-pdf-navigation {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 99999 !important;
    pointer-events: auto !important;
}
