/* Chatbot Container */
.chatbot-wrapper {
    width: 100%;
    max-width: 100%;
    height: 640px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* Sidebar */
.chatbot-sidebar {
    width: 260px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: width 0.3s, transform 0.3s;
    flex-shrink: 0;
}

.chatbot-sidebar.collapsed {
    width: 0;
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
}

.sidebar-toggle:hover {
    background: #e5e7eb;
}

.sidebar-toggle-mobile {
    display: none;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
}

.sidebar-close-mobile {
    display: none;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    align-self: flex-start;
}

.sidebar-close-mobile:hover {
    background: #e5e7eb;
}

.new-chat-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.new-chat-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.new-chat-button svg {
    flex-shrink: 0;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-history-item {
    padding: 10px 12px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.chat-history-item:hover {
    background: #e5e7eb;
}

.chat-history-item.active {
    background: #ddd6fe;
}

.chat-history-title {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-history-preview {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-history-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.chat-history-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #ef4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-history-item:hover .chat-history-delete {
    opacity: 1;
}

.chat-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 13px;
}

/* Main Chat Area */
.chatbot-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chatbot-clear {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message */
.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: messageSlide 0.3s ease-out;
}

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

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-message {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-text {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.bot-message .message-text {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 12px 12px 12px 4px;
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 4px 12px;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    padding: 0 4px;
}

/* Typing Indicator */
.chatbot-typing {
    padding: 0 20px 10px 20px;
    background: #f9fafb;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.chatbot-input-wrapper {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 20px;
    flex-shrink: 0;
}

.chatbot-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    outline: none;
    border-color: #667eea;
}

.chatbot-input::-webkit-scrollbar {
    width: 6px;
}

.chatbot-input::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-input::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 3px;
}

.chatbot-send-button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-send-button:active:not(:disabled) {
    transform: translateY(0);
}

.chatbot-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error Message */
.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 20px;
    border: 1px solid #fecaca;
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-wrapper {
        height: 500px;
        flex-direction: column;
    }
    
    .chatbot-sidebar {
        position: absolute;
        width: 100%;
        height: 100%;
        z-index: 10;
        border-right: none;
        transform: translateX(-100%);
    }
    
    .chatbot-sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .sidebar-close-mobile {
        display: flex;
    }
    
    .sidebar-toggle-mobile {
        display: flex;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chatbot-header {
        padding: 12px 16px;
    }
    
    .chatbot-title h3 {
        font-size: 16px;
    }
    
    .chatbot-messages {
        padding: 16px;
    }
    
    .chatbot-input-wrapper {
        padding: 12px 16px;
    }
}

/* Code blocks in messages */
.message-text pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-text code {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.message-text pre code {
    background: transparent;
    padding: 0;
}

/* Layout adjustment - swap chat and ad blocks */
.row.rtb_width {
    display: flex;
    flex-direction: row-reverse;
}

.yandex_rtb_vert {
    order: 2;
}

#chatbot-container {
    order: 1;
}

/* Footer links — equal distribution */
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 0;
}

.footer-links li {
    flex: 1 1 auto;
    text-align: center;
}

.footer-links li.footer-promo {
    flex: 0 0 auto;
    margin-left: auto;
}

.footer-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    padding: 0 8px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-links li.footer-promo a {
    color: #a78bfa;
}

.footer-links li.footer-promo a:hover {
    color: #c4b5fd;
}

@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    .footer-links li,
    .footer-links li.footer-promo {
        flex: none;
        margin-left: 0;
        text-align: center;
    }
}

/* Copy button in messages */
.message-copy-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-copy-btn:hover {
    background: #f3f4f6;
    color: #4f46e5;
    border-color: #4f46e5;
}

.message-copy-btn.copied {
    color: #10b981;
    border-color: #10b981;
}

.message:hover .message-copy-btn {
    opacity: 1;
}

.message-content {
    position: relative;
}

.bot-message .message-copy-btn {
    background: rgba(255, 255, 255, 0.95);
}

.user-message .message-copy-btn {
    background: rgba(255, 255, 255, 0.95);
}

/* ===== MESSAGE ACTION BUTTONS (Copy / Delete / Share) ===== */
.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
    align-items: center;
}
.message-content:hover .message-actions {
    opacity: 1;
}
.message-action-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 7px;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.message-action-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}
.message-action-btn.copied {
    color: #059669;
    border-color: #6ee7b7;
    background: #ecfdf5;
}
.message-action-btn.delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}
.message-action-btn.share-btn:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #93c5fd;
}
/* Hide old copy button style if present */
.message-copy-btn {
    display: none !important;
}

/* ===== FOOTER: 3 equal links, Продвижение сайта — far right ===== */
.footer-links-main {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
}
.footer-links-main li {
    flex: 1;
    text-align: center;
}
.footer-links-main li.footer-promo {
    text-align: right;
}
.footer-links-main li:first-child {
    text-align: left;
}
.footer-links-main a {
    color: #b0b8c9;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}
.footer-links-main a:hover {
    color: #ffffff;
    text-decoration: underline;
}
.footer-links-main li.footer-promo a {
    color: #b0b8c9;
}
.footer-links-main li.footer-promo a:hover {
    color: #ffffff;
}
@media (max-width: 600px) {
    .footer-links-main {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .footer-links-main li,
    .footer-links-main li.footer-promo,
    .footer-links-main li:first-child {
        text-align: center;
    }
}


/* ===== FOOTER: 3 links evenly centered ===== */
.footer-links-main {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    width: 100%;
}
.footer-links-main li {
    flex: 1;
    text-align: center;
}
.footer-links-main li:first-child {
    text-align: center;
}
.footer-links-main li.footer-promo {
    text-align: center;
}
.footer-links-main a {
    color: #b0b8c9;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    display: block;
    padding: 4px 0;
    transition: color 0.2s;
}
.footer-links-main a:hover {
    color: #ffffff;
    text-decoration: underline;
}
@media (max-width: 600px) {
    .footer-links-main {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .footer-links-main li {
        flex: none;
        width: 100%;
        text-align: center;
    }
}

/* ===== MARKDOWN RENDERING in chat messages ===== */
.message-text h1, .message-text h2, .message-text h3,
.message-text h4, .message-text h5, .message-text h6 {
    margin: 12px 0 6px;
    font-weight: 700;
    line-height: 1.3;
    color: inherit;
}
.message-text h1 { font-size: 1.4em; }
.message-text h2 { font-size: 1.25em; }
.message-text h3 { font-size: 1.1em; }
.message-text h4, .message-text h5, .message-text h6 { font-size: 1em; }

.message-text ul, .message-text ol {
    margin: 6px 0 6px 20px;
    padding: 0;
}
.message-text li {
    margin-bottom: 3px;
}
.message-text strong { font-weight: 700; }
.message-text em { font-style: italic; }
.message-text blockquote {
    border-left: 3px solid #6366f1;
    margin: 8px 0;
    padding: 4px 12px;
    color: #9ca3af;
    background: rgba(99,102,241,0.06);
    border-radius: 0 4px 4px 0;
}
.message-text hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin: 10px 0;
}
/* Markdown tables */
.md-table-wrap {
    overflow-x: auto;
    margin: 8px 0;
    border-radius: 6px;
}
.md-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
}
.md-table th, .md-table td {
    border: 1px solid rgba(255,255,255,0.15);
    padding: 7px 10px;
    text-align: left;
}
.md-table th {
    background: rgba(99,102,241,0.2);
    font-weight: 600;
    color: #c4b5fd;
}
.md-table tr:nth-child(even) td {
    background: rgba(255,255,255,0.03);
}

/* ============================================================
   PATCH v2.1: Fixes for menu visibility, copy hover,
   footer centering, mobile sidebar overflow
   ============================================================ */

/* FIX 2: Copy button hover — dark text on light background (visible) */
.message-action-btn:hover {
    background: #e5e7eb !important;
    color: #111827 !important;
    border-color: #9ca3af !important;
}
.message-action-btn.copy-btn:hover {
    background: #ede9fe !important;
    color: #4c1d95 !important;
    border-color: #7c3aed !important;
}

/* FIX 3: Footer — all links in 1 centered row with even spacing */
.footer-links-main {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 32px !important;
    flex-wrap: nowrap !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    width: 100% !important;
}
.footer-links-main li {
    flex: 0 0 auto !important;
    text-align: center !important;
}
.footer-links-main li:first-child,
.footer-links-main li.footer-promo {
    text-align: center !important;
    margin-left: 0 !important;
}
.footer-links-main a {
    color: #9ca3af !important;
    font-size: 13px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: color 0.2s !important;
}
.footer-links-main a:hover {
    color: #ffffff !important;
    text-decoration: underline !important;
}
@media (max-width: 600px) {
    .footer-links-main {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: center !important;
    }
}

/* FIX 4: Mobile chat-history sidebar overflow with scroll */
@media (max-width: 768px) {
    .chatbot-sidebar {
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    .chat-history {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(100% - 70px) !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .sidebar-header {
        flex-shrink: 0 !important;
    }
}
/* General: also fix desktop sidebar overflow */
.chatbot-sidebar {
    display: flex;
    flex-direction: column;
}
.chat-history {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* ============================================================
   v2.2 PATCHES: light header restore, green menu, slide-up,
   copy-chat button, frame block CSP meta
   ============================================================ */

/* ===== RESTORE ORIGINAL LIGHT NAVBAR ===== */
/* Undo dark override — let styles.css white navbar prevail */
.navbar-custom {
    background: #ffffff !important;
    border-bottom: 2px solid #e9ecef !important;
    padding: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07) !important;
}
.navbar-custom .container {
    padding-left: 15px !important;
    padding-right: 15px !important;
}
.navbar-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    padding: 8px 0 !important;
    width: 100% !important;
    float: none !important;
}
/* Spacer — pushes dropdown to the right */
.navbar-header .custom-logo-link {
    flex-shrink: 0 !important;
}
.navbar-header .dropdown {
    margin-left: auto !important;
}
.custom-logo-link {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}
.custom-logo {
    height: 34px !important;
    width: auto !important;
}

/* Green dropdown button */
.dropbtn {
    background: #4CAF50 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    transition: background 0.2s, box-shadow 0.2s !important;
    text-transform: none !important;
    font-family: inherit !important;
    letter-spacing: 0.01em !important;
}
.dropbtn:hover {
    background: #43a047 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(76,175,80,0.35) !important;
}

/* Dropdown items — green accent on hover */
.dropdown-content {
    display: none !important;
    position: absolute !important;
    visibility: visible !important;
    opacity: 1 !important;
    left: 0 !important;
    top: calc(100% + 4px) !important;
    min-width: 240px !important;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.13) !important;
    z-index: 99999 !important;
    padding: 6px 0 !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
}
.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
    display: block !important;
}
.dropdown-content a {
    display: block !important;
    padding: 9px 18px !important;
    color: #333333 !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    transition: background 0.15s, color 0.15s !important;
    border: none !important;
    white-space: nowrap !important;
}
.dropdown-content a:hover {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
}

/* Hide Bootstrap collapse toggle */
.navbar-toggle { display: none !important; }
/* Make dropdown always visible in navbar-header */
.navbar-header .dropdown {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Desktop: dropdown left-aligned */
@media (min-width: 769px) {
    .dropdown-content { left: 0 !important; right: auto !important; }
}
/* Mobile: right-aligned to avoid overflow */
@media (max-width: 768px) {
    .dropdown-content {
        left: auto !important;
        right: 0 !important;
        min-width: 210px !important;
        max-height: 60vh !important;
    }
    .navbar-header {
        justify-content: space-between !important;
        padding: 8px 12px !important;
        width: 100% !important;
    }
}

/* ===== COPY BUTTON HOVER — readable dark text ===== */
.message-action-btn:hover {
    background: #f0fdf4 !important;
    color: #14532d !important;
    border-color: #86efac !important;
}
.message-action-btn.copy-btn:hover {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border-color: #4ade80 !important;
}

/* ===== FOOTER — 3 links centered in 1 row ===== */
.footer-links-main {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 28px !important;
    flex-wrap: nowrap !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    width: 100% !important;
}
.footer-links-main li {
    flex: 0 0 auto !important;
    text-align: center !important;
}
.footer-links-main a {
    color: #9ca3af !important;
    font-size: 13px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: color 0.2s !important;
}
.footer-links-main a:hover {
    color: #4CAF50 !important;
    text-decoration: underline !important;
}
@media (max-width: 600px) {
    .footer-links-main {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: center !important;
    }
}

/* ===== MOBILE CHAT SIDEBAR OVERFLOW ===== */
@media (max-width: 768px) {
    .chatbot-sidebar {
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    .chat-history {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(100% - 70px) !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .sidebar-header { flex-shrink: 0 !important; }
}
.chatbot-sidebar { display: flex; flex-direction: column; }
.chat-history { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }

/* ===== SLIDE-UP ANIMATION FOR INCOMING MESSAGES ===== */
@keyframes msgSlideUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.msg-slide-in {
    opacity: 0;
    transform: translateY(18px);
}
.msg-slide-in-active {
    animation: msgSlideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ===== COPY CHAT BUTTON LABEL ===== */
.message-action-btn.share-btn:hover {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border-color: #4ade80 !important;
}

/* ============================================================
   v2.4 PATCHES: table mobile scroll, blockquote text fix
   ============================================================ */

/* TABLE: horizontal scroll on mobile */
.tool-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0 28px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.tool-table-wrap .tool-table {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    min-width: 420px;
}
/* Also wrap any .tool-table without wrapper via CSS */
.body_text .tool-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}
.body_text .tool-table thead,
.body_text .tool-table tbody,
.body_text .tool-table tr {
    white-space: normal;
}
@media (max-width: 768px) {
    .body_text .tool-table {
        font-size: 13px;
    }
    .body_text .tool-table th,
    .body_text .tool-table td {
        padding: 8px 10px;
    }
}

/* BLOCKQUOTE: visible text on page sections */
.body_text blockquote {
    border-left: 4px solid #4CAF50 !important;
    background: #1e2235 !important;
    color: #e5e7eb !important;
    padding: 14px 18px !important;
    margin: 20px 0 !important;
    border-radius: 0 8px 8px 0 !important;
    font-style: italic !important;
    line-height: 1.6 !important;
}
.body_text blockquote strong {
    color: #86efac !important;
    font-style: normal !important;
}
.section-padding .body_text blockquote {
    background: rgba(255,255,255,0.07) !important;
    color: #f3f4f6 !important;
    border-left-color: #4CAF50 !important;
}

/* ===== v2.4 FIXES: mobile table scroll + blockquote text ===== */
/* Horizontal scroll for tool-tables on mobile */
.tool-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0 28px;
    border-radius: 10px;
}
.tool-table-wrap .tool-table {
    margin: 0;
    min-width: 480px;
}
/* Also wrap any plain table inside body_text */
.body_text table:not(.tool-table-wrap table) {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}
/* Blockquote: readable text on colored background */
.body_text blockquote,
blockquote.wp-block-quote,
section blockquote {
    background: #f3f0ff !important;
    border-left: 4px solid #667eea !important;
    color: #2d2d3a !important;
    padding: 14px 20px !important;
    margin: 16px 0 !important;
    border-radius: 0 8px 8px 0 !important;
}
.body_text blockquote p,
.body_text blockquote span,
blockquote.wp-block-quote p {
    color: #2d2d3a !important;
}
/* Dark-mode override: keep blockquote readable */
@media (prefers-color-scheme: dark) {
    .body_text blockquote,
    blockquote.wp-block-quote {
        background: #2a2440 !important;
        color: #e8e0ff !important;
    }
    .body_text blockquote p { color: #e8e0ff !important; }
}

/* v2.5 table full-width fix */
.tool-table thead, .tool-table tbody { width: 100%; display: table; }
.tool-table { table-layout: fixed; }
