/* ===== CHATBOT WIDGET REFINED UI ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

:root {
    /* Color palette - refined pastel theme */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --secondary: #7c3aed;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Background colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    /* Text colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-inverse: #ffffff;
    
    /* Border and shadow */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== CHATBOT CONTAINER ===== */
.chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
}

/* ===== TOGGLE BUTTON ===== */
.chatbot-toggle-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
    padding: 16px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    transform-origin: center;
}

.chatbot-toggle-btn:hover {
    box-shadow: var(--shadow-xl), 0 0 0 6px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.chatbot-toggle-btn:active {
    transform: translateY(0) scale(0.98);
}

.chatbot-toggle-btn .status-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: var(--success);
    border-radius: var(--radius-full);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* ===== CHATBOT WINDOW ===== */
.chatbot-window {
    width: 416px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 624px;
    transition: all var(--transition-normal);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    animation: windowFadeIn 0.3s ease forwards;
}

@keyframes windowFadeIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-window.minimized {
    height: 56px;
}

/* ===== CHATBOT HEADER ===== */
.chatbot-header {
    background: linear-gradient(to right, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-title {
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
}

.connection-status {
    height: 8px;
    width: 8px;
    border-radius: var(--radius-full);
    position: relative;
}

.connection-status.connected {
    background-color: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.connection-status.connecting {
    background-color: var(--warning);
    animation: pulse 1.5s infinite;
}

.connection-status.disconnected,
.connection-status.error {
    background-color: var(--error);
    animation: pulse 1s infinite;
}

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

.chatbot-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-header-btn {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.minimize-btn .icon {
    transition: transform var(--transition-normal);
}

.minimize-btn .icon.rotated {
    transform: rotate(180deg);
}

/* ===== MESSAGES CONTAINER ===== */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages.hidden {
    display: none;
}

/* ===== MESSAGE BUBBLES ===== */
.message {
    display: flex;
    animation: messageFadeIn 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    position: relative;
    line-height: 1.5;
    transition: transform var(--transition-fast);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-bubble.user {
    background: linear-gradient(to right, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    border-bottom-right-radius: var(--radius-sm);
}

.message-bubble.bot {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    white-space: pre-wrap;
}

.message-time {
    font-size: 0.75rem;
    margin-top: 6px;
    opacity: 0.7;
    align-self: flex-end;
}

.message.user .message-time {
    align-self: flex-end;
}

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

/* ===== HTML LIST STYLING ===== */
.message-bubble.bot ol,
.message-bubble.bot ul {
    margin: 10px 0;
    padding-left: 18px; /* reduced further */
}

.message-bubble.bot ol {
    list-style-type: decimal;
}

.message-bubble.bot ul {
    list-style-type: disc;
}

.message-bubble.bot li {
    margin: 5px 0;
    line-height: 1.6;
    padding-left: 0;
}

.message-bubble.bot li b {
    font-weight: 600;
    color: var(--text-primary);
    display: inline-block;
    margin-bottom: 3px;
}

/* ---- Nested lists ---- */
.message-bubble.bot li ul,
.message-bubble.bot li ol {
    margin: 2px 0 2px 6px; /* much tighter */
    padding-left: 10px; /* almost flush alignment */
}

.message-bubble.bot li li {
    margin: 2px 0;
    font-size: 0.95em;
}

/* ---- Style for deeper nesting ---- */
.message-bubble.bot ol ol {
    list-style-type: lower-alpha;
}

.message-bubble.bot ol ol ol {
    list-style-type: lower-roman;
}


/* ===== BUTTONS CONTAINER ===== */
.message-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    justify-content: flex-start;
    align-items: stretch;
}

/* If there are exactly two buttons, show them side by side (for Yes/No style) */
.message-buttons:has(.message-button:nth-child(2)):not(:has(.message-button:nth-child(3))) {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
}

/* For main action buttons (like Yes/No in option 4), show side by side */
.message-buttons.side-by-side {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
}

/* For multi-select and nested options, keep vertical stacking */
.message-buttons.multi-select,
.message-buttons.options,
.options-container,
.feedback-component .message-buttons {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
}

/* ===== BUTTON STYLES ===== */
.message-button {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    border: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    max-width: 140px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    transition: all var(--transition-normal);
    z-index: 1;
    margin: 0;
    font-family: inherit;
}

.message-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
}

.message-button:hover::before {
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.message-button .button-icon {
    margin-right: 10px;
    font-size: 1.1em;
    display: inline-flex;
    align-items: center;
    transition: transform var(--transition-fast);
}

.message-button:hover .button-icon {
    transform: translateX(2px);
}

.message-button span {
    position: relative;
    z-index: 1;
}

.message-button:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-sm);
}

.message-button:hover, .message-button:focus {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Ripple effect */
.message-button .ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: 2;
}

@keyframes ripple {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Primary Action Button */
.message-button.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
}

.message-button.primary:hover, .message-button.primary:focus {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

/* Secondary Action Button */
.message-button.secondary {
    background: var(--bg-primary);
    color: var(--primary);
    border: 1.5px solid var(--border-light);
}

.message-button.secondary:hover, .message-button.secondary:focus {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
    color: var(--primary-dark);
}

/* Link Button */
.message-button.link {
    background: transparent;
    color: var(--primary);
    border: 1.5px dashed var(--primary-light);
    justify-content: flex-start;
    gap: 10px;
    font-weight: 500;
    box-shadow: none;
}

.message-button.link:hover, .message-button.link:focus {
    background: rgba(79, 70, 229, 0.05);
    border-style: solid;
    box-shadow: var(--shadow-sm);
}

.message-button.link .link-icon {
    font-size: 1.1rem;
    margin-left: 8px;
    transition: transform var(--transition-fast);
}

.message-button.link:hover .link-icon {
    transform: translateX(3px);
}

/* Option Button (for nested options) */
.message-button.option {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-light);
    font-weight: 500;
    text-align: left;
    justify-content: flex-start;
}

.message-button.option:hover, .message-button.option:focus {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
}

/* Multi-select Button */
.message-button.multi-select {
    position: relative;
    padding-left: 48px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    text-align: left;
    justify-content: flex-start;
    transition: all var(--transition-fast);
}

.message-button.multi-select:hover {
    background-color: var(--bg-tertiary);
}

.message-button.multi-select::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background-color: var(--bg-primary);
    transition: all var(--transition-fast);
}

.message-button.multi-select.selected {
    background-color: rgba(79, 70, 229, 0.08);
    border-color: var(--primary-light);
}

.message-button.multi-select.selected::before {
    background-color: var(--primary);
    border-color: var(--primary);
}

.message-button.multi-select.selected::after {
    content: "";
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 6px;
    height: 12px;
    border: solid var(--bg-primary);
    border-width: 0 2px 2px 0;
}

/* Chevron for buttons with options */
.message-button.has-options::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f46e5'%3E%3Cpath d='M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform var(--transition-fast);
    margin-left: auto;
}

.message-button.has-options.expanded::after {
    transform: rotate(180deg);
}

/* Options container */
.options-container {
    display: none;
    margin-top: 8px;
    margin-left: 16px;
    padding-left: 12px;
    border-left: 2px solid var(--border-light);
}

.options-container.visible {
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeIn var(--transition-normal);
}

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

/* Submit button for multi-select */
.submit-selections-btn {
    margin-top: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-normal);
    width: 100%;
    box-shadow: var(--shadow-md);
    display: none; /* Hidden by default */
}

.submit-selections-btn.visible {
    display: block;
}

.submit-selections-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.submit-selections-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* ===== CUSTOM CONTENT ===== */
.custom-section {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.custom-image {
    margin: 12px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: 100%;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.custom-image:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.custom-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

.image-caption {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
}

/* ===== LOADING INDICATOR ===== */
.loading-indicator {
    display: flex;
    justify-content: flex-start;
}

.loading-bubble {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.loading-dots {
    display: flex;
    gap: 5px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: var(--radius-full);
    animation: bounce 1s infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* ===== INPUT FORM ===== */
.chatbot-input-form {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.chatbot-input-form.hidden {
    display: none;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    font-size: 0.95rem;
    background-color: var(--bg-secondary);
    outline: none;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.chatbot-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ===== ACTION BUTTONS ===== */
.send-btn,
.mic-btn,
.attachment-btn {
    padding: 14px;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
}

.send-btn:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.send-btn:active {
    transform: translateY(0) scale(0.97);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.mic-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-light);
}

.mic-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
    color: var(--primary);
}

.mic-btn.listening {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: var(--text-inverse);
    border-color: var(--error);
    animation: pulse 2s infinite;
}

.mic-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.attachment-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-light);
}

.attachment-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
    color: var(--primary);
}

.attachment-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.connection-status-text {
    font-size: 0.8rem;
    color: var(--error);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== IMAGE GALLERY ===== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.gallery-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 120px;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.gallery-image:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== IMAGE ATTACHMENT CARD STYLES ===== */
.image-attachment {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachment-icon {
    font-size: 1.1rem;
}

.attachment-filename {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.view-image-btn {
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    align-self: flex-start;
}

.view-image-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.view-image-btn i {
    font-size: 0.9rem;
}

/* Fullscreen image overlay */
.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.image-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.image-overlay-close {
    position: absolute;
    top: 24px;
    right: 24px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-full);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.image-overlay-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

/* ===== THUMBNAIL BUTTONS ===== */
.thumbnail-button {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius-lg);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-light);
    transition: all var(--transition-normal);
    text-align: left;
    width: 100%;
    cursor: pointer;
}

.thumbnail-button:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.thumbnail-button .thumbnail {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
    margin-right: 14px;
    flex-shrink: 0;
}

.thumbnail-button .button-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.thumbnail-button .button-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.thumbnail-button .button-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.thumbnail-button .link-icon {
    margin-left: 10px;
    color: var(--primary);
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.thumbnail-button:hover .link-icon {
    transform: translateX(3px);
}

/* ===== CUSTOM CONTENT CONTAINER ===== */
.custom-content-container {
    margin-top: 16px;
    padding: 20px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    max-width: 400px;
    animation: fadeIn var(--transition-normal);
}

.input-form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-form-container label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-form-container input {
    padding: 12px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all var(--transition-fast);
    background: var(--bg-secondary);
    font-family: inherit;
}

.input-form-container input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.input-form-container button {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-top: 8px;
}

.input-form-container button:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.input-form-container button:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== FEEDBACK COMPONENT ===== */
.feedback-component {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feedback-component .message-buttons {
    margin-bottom: 12px;
}

.feedback-form-container {
    margin-top: 0;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.feedback-form-container label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.feedback-form-container input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    font-family: inherit;
}

.feedback-form-container input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.feedback-form-container button {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.feedback-form-container button:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feedback-form-container button:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== GUIDE CONTAINER STYLES ===== */
.guide-container {
    margin-top: 12px;
    border-left: 3px solid var(--accent);
    padding-left: 18px;
}

.guide-section {
    margin-bottom: 18px;
}

.os-toggle-header {
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color var(--transition-fast);
}

.os-toggle-header:hover {
    color: var(--primary);
}

.guide-steps {
    margin-left: 20px;
    padding: 10px 0;
    display: block;
}

.guide-steps li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 24px;
    line-height: 1.6;
}

.guide-steps li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.2rem;
}

.copy-guide-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    margin-top: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.copy-guide-btn:hover {
    background: var(--bg-primary);
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.copy-guide-btn i {
    font-size: 1em;
}

/* ===== IMAGE PREVIEW ===== */
.image-preview {
    margin-top: 12px;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--bg-secondary);
    animation: slideDown 0.3s ease;
}

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

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.remove-preview-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-md);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.remove-preview-btn:hover {
    background: var(--error);
    color: white;
}

#previewImage {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    display: block;
    margin: 0 auto;
}

.preview-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.send-image-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-inverse);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 6px;
}

.send-image-btn:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== ATTACHMENT MENU ===== */
.attachment-menu {
    position: relative;
    display: inline-block;
}

.attachment-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 8px;
    z-index: 1000;
    min-width: 180px;
    animation: dropdownFadeIn 0.2s ease;
}

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

.dropdown-option {
    width: 100%;
    background: none;
    border: none;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    text-align: left;
}

.dropdown-option:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.dropdown-option i {
    font-size: 1.1rem;
    width: 20px;
}

/* ===== VOICE STATUS ===== */
.voice-status {
    font-size: 0.8rem;
    color: var(--primary);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.voice-status.listening {
    color: var(--error);
    font-weight: 500;
}

.voice-status.error {
    color: var(--error);
}

.voice-status.success {
    color: var(--success);
}

/* ===== CAMERA MODAL ===== */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: inherit;
}

.camera-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.camera-preview video {
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    background: #000;
}

.camera-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.camera-capture-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all var(--transition-normal);
}

.camera-capture-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(79, 70, 229, 0.2);
}

.camera-cancel-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-light);
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-normal);
}

.camera-cancel-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--error);
    color: var(--error);
}

.camera-switch-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-light);
    padding: 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.camera-switch-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    
    .chatbot-window {
        width: 100%;
        height: 70vh;
        max-height: 600px;
        border-radius: var(--radius-xl);
    }
    
    .chatbot-messages {
        padding: 16px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-bubble {
        padding: 12px 16px;
    }
    
    .input-container {
        flex-direction: column;
    }
    
    .send-btn,
    .mic-btn,
    .attachment-btn {
        width: 100%;
        padding: 12px;
    }
    
    .message-buttons:has(.message-button:nth-child(2)):not(:has(.message-button:nth-child(3))) {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    
    .message-buttons.side-by-side {
        flex-direction: column !important;
    }
    
    .message-button {
        max-width: 100%;
    }
    
    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .attachment-dropdown {
        left: -50px;
        min-width: 160px;
    }
    
    .camera-container {
        padding: 16px;
    }
    
    .camera-controls {
        flex-wrap: wrap;
    }
    
    .camera-capture-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1e293b;
        --bg-secondary: #0f172a;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --border-light: #334155;
        --border-medium: #475569;
    }
    
    .message-bubble.bot {
        background-color: var(--bg-tertiary);
        border-color: var(--border-medium);
        color: var(--text-secondary);
        white-space: pre-wrap;
    }
    
    .loading-bubble {
        background-color: var(--bg-tertiary);
    }
    
    .chatbot-input {
        background-color: var(--bg-tertiary);
        color: var(--text-primary);
    }
    
    .thumbnail-button {
        background-color: var(--bg-tertiary);
    }
    
    /* Dark mode list styling */
    .message-bubble.bot li b {
        color: var(--text-primary);
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Enhanced pulse animation for listening state */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Loading animations */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Send image button states */
.send-image-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.send-image-btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Image preview enhancements */
.preview-source {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 8px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.preview-source i {
    font-size: 0.9rem;
}

.preview-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.retake-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-light);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 6px;
}

.retake-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

/* Camera preview specific styles */
.camera-preview {
    border: 2px solid var(--primary);
}

.camera-preview .preview-source {
    color: var(--primary);
    font-weight: 500;
}

/* Voice message indicator */
.voice-indicator {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 6px;
    font-style: italic;
}

.voice-indicator i {
    margin-right: 5px;
}

/* ===== COPY BUTTON STYLES (Overlay, non-intrusive) ===== */
.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    color: var(--text-secondary);
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
}

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

.copy-btn:hover {
    background: var(--bg-primary);
    border-color: var(--primary-light);
    color: var(--primary);
    transform: scale(1.05);
}

.copy-btn.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.copy-btn.copied i::before {
    content: "\eb7d"; /* ri-check-line */
}

/* Prevent bubble shifting due to copy button */
.message-bubble.bot {
    position: relative;
}

/* DO NOT add extra right padding — keep original bubble spacing */
.message.user .message-bubble {
    padding-right: 16px;
}