/* WP AI Bot Frontend Styles - Enhanced Version */

/* UC Baby Brand Colors */
:root {
    --uc-baby-primary: #EC088D;
    --uc-baby-secondary: #0755A4;
    --uc-baby-accent: #6697C5;
    --uc-baby-neutral-dark: #000000;
    --uc-baby-neutral-light: #FFFFFF;
    --uc-baby-neutral-grey: #666666;
    --uc-baby-neutral-light-grey: #F5F5F5;
    --uc-baby-message-user: #4A7FD6;
    --uc-baby-message-assistant: #F49AC2;
}

/* Reset and base styles */
.wp-ai-bot * {
    box-sizing: border-box;
}

.wp-ai-bot {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--uc-baby-neutral-dark);
}

/* Enhanced chatbot container */
.wp-ai-bot-container {
    position: fixed;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.98);
    overflow: hidden;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

/* Expand functionality */
.wp-ai-bot-container.expanded {
    width: 90vw !important;
    height: 90vh !important;
    top: 5vh !important;
    left: 5vw !important;
    right: auto !important;
    bottom: auto !important;
    border-radius: 16px !important;
    z-index: 10000 !important;
    position: fixed !important;
    transform: none !important;
}

/* Position variants */
.wp-ai-bot-container.bottom-right {
    bottom: 20px;
    right: 20px;
}

.wp-ai-bot-container.bottom-left {
    bottom: 20px;
    left: 20px;
}

.wp-ai-bot-container.top-right {
    top: 20px;
    right: 20px;
}

.wp-ai-bot-container.top-left {
    top: 20px;
    left: 20px;
}

.wp-ai-bot-container.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Improved size variants to prevent overlapping */
.wp-ai-bot-container.size-small {
    width: 360px !important;
    height: 480px !important;
}

.wp-ai-bot-container.size-medium {
    width: 420px !important;
    height: 580px !important;
}

.wp-ai-bot-container.size-large {
    width: 480px !important;
    height: 680px !important;
}

.wp-ai-bot-container.size-full {
    width: 100%;
    height: 100vh;
    border-radius: 0;
}

/* Enhanced floating widget with UC Baby branding */
.wp-ai-bot-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(236, 8, 141, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    border: 3px solid var(--uc-baby-neutral-light);
}

.wp-ai-bot-floating:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 40px rgba(236, 8, 141, 0.35);
}

.wp-ai-bot-floating.clicked {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.wp-ai-bot-floating-icon {
    font-size: 26px;
    line-height: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.wp-ai-bot-floating-icon .dashicons {
    font-size: 24px;
    color: var(--uc-baby-neutral-light);
    line-height: 1;
}

.wp-ai-bot-floating-pulse {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: var(--uc-baby-accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Enhanced chat header with UC Baby branding - ALWAYS VISIBLE */
.wp-ai-bot-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffeef7 100%);
    color: var(--uc-baby-neutral-dark);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    /* Ensure header is always visible and properly positioned */
    z-index: 10;
    min-height: 60px;
    /* Force header to stay at top */
    order: -1;
}

.wp-ai-bot-header.scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.wp-ai-bot-header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Ensure logo is visible */
    visibility: visible !important;
    opacity: 1 !important;
}

.wp-ai-bot-header-logo img {
    height: 32px;
    width: auto;
    border-radius: 4px;
    /* Ensure image is displayed */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.wp-ai-bot-header-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--uc-baby-neutral-light);
    /* Ensure title is visible */
    visibility: visible !important;
    opacity: 1 !important;
}

.wp-ai-bot-header-actions {
    display: flex;
    gap: 8px;
}

.wp-ai-bot-header-button {
    background: rgba(236, 8, 141, 0.1);
    border: 1px solid rgba(236, 8, 141, 0.2);
    color: var(--uc-baby-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-ai-bot-header-button:hover {
    background: rgba(236, 8, 141, 0.2);
    border-color: rgba(236, 8, 141, 0.4);
    transform: scale(1.05);
}

.wp-ai-bot-header-button.expand {
    background: var(--uc-baby-accent);
}

.wp-ai-bot-header-button.expand:hover {
    background: var(--uc-baby-accent);
    opacity: 0.8;
}

.wp-ai-bot-header-button.clicked {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

/* Enhanced chat body with improved scrolling */
.wp-ai-bot-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

/* Enhanced messages container with custom scrollbar - ALWAYS VISIBLE */
.wp-ai-bot-messages {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 8px 0;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin !important;
    scrollbar-color: var(--uc-baby-accent) transparent !important;
    /* CRITICAL: Set a max-height to force scrolling */
    max-height: calc(100vh - 200px) !important;
    min-height: 200px;
    /* Force scrollbar to be visible */
    position: relative;
    /* Ensure messages container takes available space */
    flex-grow: 1;
    flex-shrink: 1;
    /* Force scrollbar to always be visible */
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: var(--uc-baby-accent) transparent !important;
    /* Add some content to test scrolling */
    padding-bottom: 20px;
}

.wp-ai-bot-messages::-webkit-scrollbar {
    width: 8px !important;
    display: block !important;
    /* Fix scrollbar glitching */
    background: transparent;
    /* Force scrollbar to always be visible */
    -webkit-appearance: none;
    /* Ensure scrollbar is always visible */
    visibility: visible !important;
    opacity: 1 !important;
}

.wp-ai-bot-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    /* Fix scrollbar glitching */
    margin: 0;
    padding: 0;
}

.wp-ai-bot-messages::-webkit-scrollbar-thumb {
    background: var(--uc-baby-accent);
    border-radius: 4px;
    transition: background 0.2s ease;
    /* Ensure scrollbar thumb is visible */
    opacity: 1 !important;
    visibility: visible !important;
    /* Fix scrollbar glitching */
    min-height: 20px;
    border: none;
    /* Force scrollbar thumb to be visible */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.wp-ai-bot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--uc-baby-secondary);
}

/* Scroll indicator */
.wp-ai-bot-scroll-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: var(--uc-baby-accent);
    border-radius: 50%;
    display: none;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    border: 2px solid white;
}

.wp-ai-bot-scroll-indicator:hover {
    background: var(--uc-baby-secondary);
    transform: scale(1.1);
}

.wp-ai-bot-scroll-indicator::before {
    content: '↓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Enhanced message display with UC Baby branding */
.wp-ai-bot-message {
    display: flex;
    gap: 14px;
    padding: 16px 24px;
    align-items: flex-start;
    animation: messageSlideIn 0.3s ease-out;
    /* Fix for top cut off - ensure first message is visible */
    margin-top: 4px;
}

.wp-ai-bot-message:first-child {
    margin-top: 8px;
}

.wp-ai-bot-message.user {
    flex-direction: row-reverse;
}

.wp-ai-bot-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}

.wp-ai-bot-message.user .wp-ai-bot-message-avatar {
    background: var(--uc-baby-neutral-grey);
}

.wp-ai-bot-message-content {
    background: var(--uc-baby-message-assistant);
    border-radius: 20px;
    padding: 14px 18px;
    max-width: 75%;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: var(--uc-baby-neutral-dark);
}

.wp-ai-bot-message.user .wp-ai-bot-message-content {
    background: var(--uc-baby-message-user);
    color: var(--uc-baby-neutral-light);
}

.wp-ai-bot-message-text {
    margin: 0;
    line-height: 1.5;
    font-size: 15px;
}

.wp-ai-bot-message-time {
    font-size: 12px;
    color: var(--uc-baby-neutral-grey);
    margin-top: 6px;
    opacity: 0.7;
}

.wp-ai-bot-message.user .wp-ai-bot-message-time {
    color: rgba(255, 255, 255, 0.8);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced typing indicator with UC Baby colors */
.wp-ai-bot-typing {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    animation: fadeIn 0.3s ease;
}

.wp-ai-bot-typing-dots {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: var(--uc-baby-neutral-light);
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    align-items: center;
}

.wp-ai-bot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--uc-baby-primary);
    animation: typing 1.4s infinite ease-in-out;
}

.wp-ai-bot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.wp-ai-bot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

.wp-ai-bot-typing-text {
    font-size: 12px;
    color: var(--uc-baby-neutral-grey);
    margin-left: 8px;
    font-style: italic;
}

/* Enhanced chat input with UC Baby branding */
.wp-ai-bot-input-container {
    padding: 24px;
    background: var(--uc-baby-neutral-light);
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 16px;
    align-items: flex-end;
    position: relative;
    flex-shrink: 0;
    min-height: 96px;
    /* Ensure input stays at bottom */
    margin-top: auto;
}

.wp-ai-bot-input-container.focused {
    border-top-color: var(--uc-baby-primary);
}

.wp-ai-bot-input-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;
}

.wp-ai-bot-input {
    width: 100%;
    padding: 16px 22px;
    border: 2px solid #e9ecef;
    border-radius: 26px;
    font-size: 15px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    max-height: 120px;
    min-height: 52px;
    font-family: inherit;
    background: var(--uc-baby-neutral-light);
    box-sizing: border-box;
    color: var(--uc-baby-neutral-dark);
    overflow: hidden;
}

.wp-ai-bot-input:focus {
    border-color: var(--uc-baby-primary);
    box-shadow: 0 0 0 3px rgba(236, 8, 141, 0.1);
}

.wp-ai-bot-input-button {
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(236, 8, 141, 0.3);
    position: relative;
    z-index: 1;
}

.wp-ai-bot-input-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(236, 8, 141, 0.4);
}

.wp-ai-bot-input-button.sending {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.wp-ai-bot-input-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wp-ai-bot-input-button.has-text {
    background: linear-gradient(135deg, #28a745, #20c997);
}

/* Enhanced quick actions with UC Baby colors */
.wp-ai-bot-quick-actions {
    background: var(--uc-baby-neutral-light-grey);
    border-top: 1px solid #e9ecef;
    transition: all 0.3s ease;
    /* Now part of scrollable content */
    margin-top: 16px;
}

.wp-ai-bot-quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 24px 24px;
}

.wp-ai-bot-quick-action {
    background: var(--uc-baby-neutral-light);
    border: 1px solid #e9ecef;
    border-radius: 14px;
    padding: 16px 18px;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    color: var(--uc-baby-neutral-dark);
    min-height: 52px;
    display: flex;
    align-items: center;
}

.wp-ai-bot-quick-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    transition: left 0.5s ease;
}

.wp-ai-bot-quick-action:hover::before {
    left: 100%;
}

.wp-ai-bot-quick-action:hover {
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 8, 141, 0.25);
    border-color: var(--uc-baby-primary);
}

.wp-ai-bot-quick-action.clicked {
    transform: scale(0.95);
}

/* Welcome message styles with UC Baby branding */
.wp-ai-bot-welcome-container {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--uc-baby-neutral-light-grey) 0%, #e9ecef 100%);
    border-radius: 16px;
    margin: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* Ensure welcome container is scrollable */
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wp-ai-bot-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--uc-baby-primary), var(--uc-baby-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: welcomeIcon 2s ease-in-out infinite alternate;
}

@keyframes welcomeIcon {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.wp-ai-bot-welcome-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--uc-baby-neutral-dark);
    margin-bottom: 8px;
}

.wp-ai-bot-welcome-subtitle {
    font-size: 14px;
    color: var(--uc-baby-neutral-grey);
    margin-bottom: 24px;
    line-height: 1.6;
    max-width: 100%;
    word-wrap: break-word;
}

/* Loading states with UC Baby colors */
.wp-ai-bot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--uc-baby-neutral-grey);
}

.wp-ai-bot-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top: 3px solid var(--uc-baby-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Error and success states */
.wp-ai-bot-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 8px 0;
    font-size: 14px;
    border-left: 4px solid #dc3545;
    animation: slideInError 0.3s ease;
}

.wp-ai-bot-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 8px 0;
    font-size: 14px;
    border-left: 4px solid #28a745;
    animation: slideInSuccess 0.3s ease;
}

@keyframes slideInError {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInSuccess {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive design */
@media (max-width: 768px) {
    .wp-ai-bot-container {
        width: 100% !important;
        height: 100vh !important;
        border-radius: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
    }
    
    .wp-ai-bot-container.expanded {
        width: 100% !important;
        height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
    }
    
    .wp-ai-bot-floating {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .wp-ai-bot-floating-icon {
        font-size: 22px;
    }
    
    .wp-ai-bot-message-content {
        max-width: 85%;
    }
    
    .wp-ai-bot-quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .wp-ai-bot-header {
        padding: 16px 20px;
    }
    
    .wp-ai-bot-header-title {
        font-size: 16px;
    }
    
    .wp-ai-bot-header-logo img {
        height: 28px;
    }
}

/* Theme variants */
.wp-ai-bot-container.theme-dark {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ecf0f1;
}

.wp-ai-bot-container.theme-dark .wp-ai-bot-body {
    background: linear-gradient(135deg, #34495e, #2c3e50);
}

.wp-ai-bot-container.theme-dark .wp-ai-bot-message-content {
    background: #34495e;
    color: #ecf0f1;
}

.wp-ai-bot-container.theme-dark .wp-ai-bot-input-container {
    background: #2c3e50;
    border-top-color: #34495e;
}

.wp-ai-bot-container.theme-dark .wp-ai-bot-input {
    background: #34495e;
    border-color: #34495e;
    color: #ecf0f1;
}

/* Accessibility improvements */
.wp-ai-bot-container:focus-within {
    outline: 2px solid var(--uc-baby-primary);
    outline-offset: 2px;
}

.wp-ai-bot-input:focus {
    outline: none;
}

.wp-ai-bot-quick-action:focus,
.wp-ai-bot-header-button:focus,
.wp-ai-bot-input-button:focus {
    outline: 2px solid var(--uc-baby-primary);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .wp-ai-bot-container {
        border: 2px solid #000;
    }
    
    .wp-ai-bot-message-content {
        border: 1px solid #000;
    }
    
    .wp-ai-bot-floating {
        border: 3px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wp-ai-bot-container,
    .wp-ai-bot-message,
    .wp-ai-bot-floating,
    .wp-ai-bot-input-button,
    .wp-ai-bot-quick-action {
        transition: none;
        animation: none;
    }
    
    .wp-ai-bot-spinner {
        animation: none;
    }
    
    .wp-ai-bot-floating-pulse {
        animation: none;
    }
}

/* Additional enhancements */
.wp-ai-bot-floating:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.wp-ai-bot-message-content::selection {
    background: rgba(236, 8, 141, 0.2);
}

.wp-ai-bot-input::placeholder {
    color: var(--uc-baby-neutral-grey);
    font-style: italic;
}

/* Fast streaming animation optimizations */
.wp-ai-bot-message-text.streaming {
    position: relative;
}

.wp-ai-bot-message-text.streaming::after {
    content: '▋';
    animation: streamingCursor 1s infinite;
    color: var(--uc-baby-primary);
    margin-left: 1px;
}

@keyframes streamingCursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Performance optimizations for smooth streaming */
.wp-ai-bot-messages {
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.wp-ai-bot-message-text {
    will-change: contents;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Button-based UI components for structured data collection */
.wp-ai-bot-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.wp-ai-bot-button {
    background: var(--uc-baby-neutral-light);
    border: 2px solid var(--uc-baby-primary);
    color: var(--uc-baby-primary);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.wp-ai-bot-button:hover {
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 8, 141, 0.25);
}

.wp-ai-bot-button.active {
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    box-shadow: 0 2px 8px rgba(236, 8, 141, 0.3);
}

/* Email collection form */
.wp-ai-bot-email-form {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

.wp-ai-bot-email-input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
}

.wp-ai-bot-email-input:focus {
    border-color: var(--uc-baby-primary);
    box-shadow: 0 0 0 3px rgba(236, 8, 141, 0.1);
}

.wp-ai-bot-email-submit {
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.wp-ai-bot-email-submit:hover {
    background: var(--uc-baby-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 8, 141, 0.25);
}

/* Responsive button layout */
@media (max-width: 768px) {
    .wp-ai-bot-button-group {
        flex-direction: column;
    }
    
    .wp-ai-bot-button {
        min-width: auto;
        width: 100%;
    }
    
    .wp-ai-bot-email-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .wp-ai-bot-email-submit {
        width: 100%;
    }
}

/* Message count warning styles */
.wp-ai-bot-message-count-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 8px 12px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 12px;
    text-align: center;
}

.wp-ai-bot-message-count-warning.limit-reached {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Progressive conversation flow indicators */
.wp-ai-bot-flow-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
    padding: 0 16px;
}

.wp-ai-bot-flow-step {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e9ecef;
    transition: all 0.3s ease;
}

.wp-ai-bot-flow-step.active {
    background: var(--uc-baby-primary);
    transform: scale(1.2);
}

.wp-ai-bot-flow-step.completed {
    background: var(--uc-baby-secondary);
}

/* Abandoned cart lead capture */
.wp-ai-bot-lead-capture {
    background: linear-gradient(135deg, var(--uc-baby-primary), var(--uc-baby-secondary));
    color: var(--uc-baby-neutral-light);
    padding: 20px;
    border-radius: 12px;
    margin: 16px 0;
    text-align: center;
}

.wp-ai-bot-lead-capture h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.wp-ai-bot-lead-capture p {
    margin: 0 0 16px 0;
    font-size: 14px;
    opacity: 0.9;
}

.wp-ai-bot-lead-capture .wp-ai-bot-email-form {
    margin-top: 0;
}

/* Enhanced quick actions for UC Baby */
.wp-ai-bot-quick-action.uc-baby-specific {
    background: linear-gradient(135deg, var(--uc-baby-primary), var(--uc-baby-secondary));
    color: var(--uc-baby-neutral-light);
    border: none;
    font-weight: 600;
}

.wp-ai-bot-quick-action.uc-baby-specific:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 8, 141, 0.3);
}

/* Location-specific branding */
.wp-ai-bot-location-branding {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    font-size: 12px;
    text-align: center;
}

.wp-ai-bot-location-branding::before {
    content: "📍 ";
    margin-right: 4px;
}

/* Safety information styling */
.wp-ai-bot-safety-info {
    background: #e8f5e8;
    border-left: 4px solid #27ae60;
    padding: 12px;
    margin: 12px 0;
    border-radius: 4px;
}

.wp-ai-bot-safety-info h5 {
    margin: 0 0 8px 0;
    color: #27ae60;
    font-size: 14px;
}

.wp-ai-bot-safety-info p {
    margin: 0;
    font-size: 13px;
    color: #2c3e50;
    line-height: 1.4;
}

/* Message limit counter */
.wp-ai-bot-message-counter {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.1);
    color: var(--uc-baby-neutral-grey);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Enhanced welcome message for UC Baby */
.wp-ai-bot-welcome-container.uc-baby-enhanced {
    background: linear-gradient(135deg, var(--uc-baby-primary), var(--uc-baby-secondary));
    color: var(--uc-baby-neutral-light);
    text-align: center;
    padding: 30px 20px;
    border-radius: 16px;
    margin: 20px;
}

.wp-ai-bot-welcome-container.uc-baby-enhanced .wp-ai-bot-welcome-title {
    color: var(--uc-baby-neutral-light);
    font-size: 24px;
    margin-bottom: 8px;
}

.wp-ai-bot-welcome-container.uc-baby-enhanced .wp-ai-bot-welcome-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin-bottom: 20px;
}

.wp-ai-bot-welcome-container.uc-baby-enhanced .wp-ai-bot-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

/* Scientific backing information */
.wp-ai-bot-scientific-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.5;
}

.wp-ai-bot-scientific-info strong {
    color: var(--uc-baby-primary);
}

/* First-time mother focus styling */
.wp-ai-bot-first-time-mother {
    background: linear-gradient(135deg, #F49AC2, #4A7FD6);
    color: var(--uc-baby-neutral-light);
    padding: 16px;
    border-radius: 12px;
    margin: 12px 0;
    text-align: center;
}

.wp-ai-bot-first-time-mother h5 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.wp-ai-bot-first-time-mother p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Question Suggestions */
.wp-ai-bot-question-suggestions {
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    border-left: 4px solid var(--uc-baby-primary);
}

.wp-ai-bot-question-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wp-ai-bot-question-button {
    background: var(--uc-baby-message-assistant);
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
}

.wp-ai-bot-question-button:hover {
    background: var(--uc-baby-secondary);
    color: white;
    border-color: var(--uc-baby-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(7, 85, 164, 0.2);
}

.wp-ai-bot-question-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(7, 85, 164, 0.3);
}

@media (max-width: 768px) {
    .wp-ai-bot-question-button {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Markdown formatting styles for chat messages */
.wp-ai-bot-message-text strong {
    font-weight: 700;
    color: inherit;
}

.wp-ai-bot-message-text em {
    font-style: italic;
    color: inherit;
}

.wp-ai-bot-message-text code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: inherit;
}

.wp-ai-bot-message-text a {
    color: var(--uc-baby-secondary);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.wp-ai-bot-message-text a:hover {
    color: var(--uc-baby-primary);
}

.wp-ai-bot-message-text ul,
.wp-ai-bot-message-text ol {
    margin: 8px 0;
    padding-left: 20px;
}

.wp-ai-bot-message-text li {
    margin: 4px 0;
    line-height: 1.4;
}

.wp-ai-bot-message-text br {
    margin: 4px 0;
}

/* Enhanced spacing for markdown content */
.wp-ai-bot-message-text {
    margin: 0;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure proper spacing between markdown elements */
.wp-ai-bot-message-text > * + * {
    margin-top: 8px;
}

/* Mobile responsive adjustments for markdown */
@media (max-width: 768px) {
    .wp-ai-bot-message-text ul,
    .wp-ai-bot-message-text ol {
        padding-left: 16px;
    }
    
    .wp-ai-bot-message-text code {
        font-size: 0.85em;
        padding: 1px 4px;
    }
}

/* Error and Success Messages */
.wp-ai-bot-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 8px 24px;
    font-size: 14px;
    line-height: 1.4;
}

.wp-ai-bot-success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 8px 24px;
    font-size: 14px;
    line-height: 1.4;
}

/* Mobile responsive adjustments for markdown */

/* Booking Form Styles - UC Baby Branded */
.wp-ai-bot-booking-form {
    background: var(--uc-baby-neutral-light);
    border-radius: 16px;
    padding: 24px;
    margin: 8px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(236, 8, 141, 0.1);
    position: relative;
    overflow: hidden;
}

.wp-ai-bot-booking-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--uc-baby-primary), var(--uc-baby-secondary));
    border-radius: 16px 16px 0 0;
}

.wp-ai-bot-booking-form h4 {
    color: var(--uc-baby-primary);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px 0;
    text-align: center;
    position: relative;
}

.wp-ai-bot-booking-form h4::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--uc-baby-primary);
    border-radius: 1px;
}

.wp-ai-bot-form-group {
    margin-bottom: 20px;
    position: relative;
}

.wp-ai-bot-form-group label {
    display: block;
    color: var(--uc-baby-neutral-dark);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    position: relative;
}

.wp-ai-bot-form-group label::after {
    content: ' *';
    color: var(--uc-baby-primary);
    font-weight: 700;
}

.wp-ai-bot-form-group label[for="booking-phone"]::after,
.wp-ai-bot-form-group label[for="booking-notes"]::after {
    content: '';
}

.wp-ai-bot-form-group input,
.wp-ai-bot-form-group select,
.wp-ai-bot-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--uc-baby-neutral-light-grey);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    background: var(--uc-baby-neutral-light);
    color: var(--uc-baby-neutral-dark);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.wp-ai-bot-form-group input:focus,
.wp-ai-bot-form-group select:focus,
.wp-ai-bot-form-group textarea:focus {
    outline: none;
    border-color: var(--uc-baby-primary);
    box-shadow: 0 0 0 3px rgba(236, 8, 141, 0.1);
    background: var(--uc-baby-neutral-light);
}

.wp-ai-bot-form-group input:hover,
.wp-ai-bot-form-group select:hover,
.wp-ai-bot-form-group textarea:hover {
    border-color: var(--uc-baby-accent);
}

.wp-ai-bot-form-group input::placeholder,
.wp-ai-bot-form-group textarea::placeholder {
    color: var(--uc-baby-neutral-grey);
    opacity: 0.7;
}

.wp-ai-bot-form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.wp-ai-bot-form-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.wp-ai-bot-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.wp-ai-bot-form-actions .wp-ai-bot-button {
    flex: 1;
    min-width: 120px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.wp-ai-bot-form-actions .wp-ai-bot-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.wp-ai-bot-form-actions .wp-ai-bot-button:hover::before {
    left: 100%;
}

.wp-ai-bot-form-actions .wp-ai-bot-button {
    background: var(--uc-baby-primary);
    color: var(--uc-baby-neutral-light);
    box-shadow: 0 4px 12px rgba(236, 8, 141, 0.3);
}

.wp-ai-bot-form-actions .wp-ai-bot-button:hover {
    background: #d4077e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 8, 141, 0.4);
}

.wp-ai-bot-form-actions .wp-ai-bot-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(236, 8, 141, 0.3);
}

.wp-ai-bot-form-actions .wp-ai-bot-button-secondary {
    background: var(--uc-baby-neutral-light);
    color: var(--uc-baby-neutral-dark);
    border: 2px solid var(--uc-baby-neutral-grey);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wp-ai-bot-form-actions .wp-ai-bot-button-secondary:hover {
    background: var(--uc-baby-neutral-light-grey);
    border-color: var(--uc-baby-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wp-ai-bot-form-actions .wp-ai-bot-button-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Form validation styles */
.wp-ai-bot-form-group input:invalid,
.wp-ai-bot-form-group select:invalid,
.wp-ai-bot-form-group textarea:invalid,
.wp-ai-bot-form-group input.invalid,
.wp-ai-bot-form-group select.invalid,
.wp-ai-bot-form-group textarea.invalid {
    border-color: #ff4444;
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.1);
}

.wp-ai-bot-form-group input:invalid:focus,
.wp-ai-bot-form-group select:invalid:focus,
.wp-ai-bot-form-group textarea:invalid:focus,
.wp-ai-bot-form-group input.invalid:focus,
.wp-ai-bot-form-group select.invalid:focus,
.wp-ai-bot-form-group textarea.invalid:focus {
    border-color: #ff4444;
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.2);
}

/* Loading state for form submission */
.wp-ai-bot-form-actions .wp-ai-bot-button.loading {
    position: relative;
    color: transparent;
}

.wp-ai-bot-form-actions .wp-ai-bot-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success/Error states for form */
.wp-ai-bot-booking-form.success {
    border-color: #28a745;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.15);
}

.wp-ai-bot-booking-form.error {
    border-color: #ff4444;
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.15);
}

/* Responsive design for booking form */
@media (max-width: 768px) {
    .wp-ai-bot-booking-form {
        padding: 20px;
        margin: 6px 0;
    }
    
    .wp-ai-bot-booking-form h4 {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .wp-ai-bot-form-group {
        margin-bottom: 16px;
    }
    
    .wp-ai-bot-form-group input,
    .wp-ai-bot-form-group select,
    .wp-ai-bot-form-group textarea {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .wp-ai-bot-form-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    .wp-ai-bot-form-actions .wp-ai-bot-button {
        width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }
}

/* Animation for form appearance */
@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.wp-ai-bot-booking-form {
    animation: formSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus management for accessibility */
.wp-ai-bot-form-group input:focus,
.wp-ai-bot-form-group select:focus,
.wp-ai-bot-form-group textarea:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wp-ai-bot-booking-form {
        border: 2px solid var(--uc-baby-primary);
    }
    
    .wp-ai-bot-form-group input,
    .wp-ai-bot-form-group select,
    .wp-ai-bot-form-group textarea {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .wp-ai-bot-booking-form {
        animation: none;
    }
    
    .wp-ai-bot-form-actions .wp-ai-bot-button::before {
        display: none;
    }
    
    .wp-ai-bot-form-actions .wp-ai-bot-button:hover {
        transform: none;
    }
}