/**
 * WC Cart Recovery Pro - AI Chat Widget Modern Styles
 *
 * Ultra-modern design with glassmorphism, smooth animations,
 * and dynamic CSS variables for full customization.
 *
 * @package WC_Cart_Recovery_Pro
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Variables (Dynamically set via PHP)
   ========================================================================== */

:root {
    --wcrp-primary: #7f54b3;
    --wcrp-secondary: #9b59b6;
    --wcrp-text: #1a1a2e;
    --wcrp-bg: #ffffff;
    --wcrp-messages-bg: #f8f9fa;
    --wcrp-window-width: 400px;
    --wcrp-window-height: 520px;
    --wcrp-border-radius: 20px;
    --wcrp-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --wcrp-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --wcrp-shadow-hover: 0 30px 60px -15px rgba(0, 0, 0, 0.3);
}

/* Font Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   Widget Container
   ========================================================================== */

.wcrp-ai-chat {
    position: fixed;
    z-index: 999999;
    font-family: var(--wcrp-font-family);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Position variants */
.wcrp-ai-chat.position-bottom-right {
    bottom: 24px;
    right: 24px;
}

.wcrp-ai-chat.position-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* State classes */
.wcrp-ai-chat .wcrp-ai-window {
    display: none !important;
}

.wcrp-ai-chat .wcrp-ai-bubble {
    display: flex !important;
}

.wcrp-ai-chat.hidden .wcrp-ai-window {
    display: none !important;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

.wcrp-ai-chat.hidden .wcrp-ai-bubble {
    display: flex !important;
}

.wcrp-ai-chat.open .wcrp-ai-bubble {
    display: none !important;
}

.wcrp-ai-chat.open .wcrp-ai-window {
    display: flex !important;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.wcrp-ai-chat.minimized .wcrp-ai-bubble {
    display: flex !important;
}

.wcrp-ai-chat.minimized .wcrp-ai-window {
    display: none !important;
}

/* ==========================================================================
   Chat Bubble - Modern Floating Button
   ========================================================================== */

.wcrp-ai-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px !important;
    background: linear-gradient(135deg, var(--wcrp-primary) 0%, var(--wcrp-secondary) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer;
    box-shadow: var(--wcrp-shadow) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    outline: none !important;
    position: relative;
    overflow: hidden;
}

.wcrp-ai-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wcrp-ai-bubble:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--wcrp-shadow-hover);
}

.wcrp-ai-bubble:hover::before {
    opacity: 1;
}

.wcrp-ai-bubble:active {
    transform: translateY(-1px) scale(0.98);
}

/* Pulse animation for attention */
.wcrp-ai-bubble.pulse {
    animation: wcrp-bubble-pulse 2s ease-in-out infinite;
}

@keyframes wcrp-bubble-pulse {
    0%, 100% {
        box-shadow: var(--wcrp-shadow), 0 0 0 0 rgba(127, 84, 179, 0.4);
    }
    50% {
        box-shadow: var(--wcrp-shadow), 0 0 0 15px rgba(127, 84, 179, 0);
    }
}

/* Notification dot */
.wcrp-ai-bubble.has-notification::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #ffffff;
    animation: wcrp-notification-bounce 1s ease infinite;
}

@keyframes wcrp-notification-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.wcrp-ai-bubble svg {
    flex-shrink: 0;
    width: 24px !important;
    height: 24px !important;
    fill: #ffffff !important;
    color: #ffffff !important;
}

.wcrp-ai-bubble svg path,
.wcrp-ai-bubble svg circle {
    fill: #ffffff !important;
}

.wcrp-ai-bubble-text {
    white-space: nowrap;
}

/* ==========================================================================
   Preview Message Bubble (Teaser before opening chat)
   ========================================================================== */

.wcrp-ai-preview-bubble {
    display: none;
    position: absolute;
    bottom: 80px;
    right: 0;
    max-width: 280px;
    background: var(--wcrp-bg);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 16px 20px;
    padding-right: 36px;
    animation: wcrp-preview-enter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 1;
}

.wcrp-ai-preview-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 50px rgba(0, 0, 0, 0.18), 0 4px 15px rgba(0, 0, 0, 0.12);
}

.wcrp-ai-preview-bubble.active {
    display: block;
}

/* Position adjustment for bottom-left */
.wcrp-ai-chat.position-bottom-left .wcrp-ai-preview-bubble {
    right: auto;
    left: 0;
}

.wcrp-ai-chat.position-bottom-left .wcrp-ai-preview-arrow {
    right: auto;
    left: 20px;
}

@keyframes wcrp-preview-enter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.wcrp-ai-preview-close {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    background: rgba(0, 0, 0, 0.06) !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #9ca3af !important;
    line-height: 1 !important;
    box-shadow: none !important;
    outline: none !important;
}

.wcrp-ai-preview-close:hover {
    background: rgba(0, 0, 0, 0.12) !important;
    color: #6b7280 !important;
    transform: scale(1.1);
}

.wcrp-ai-preview-close:active {
    transform: scale(0.95);
}

.wcrp-ai-preview-close svg {
    width: 10px !important;
    height: 10px !important;
    fill: currentColor !important;
    color: inherit !important;
    flex-shrink: 0;
}

.wcrp-ai-preview-close svg path {
    fill: currentColor !important;
}

.wcrp-ai-preview-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.wcrp-ai-preview-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--wcrp-text);
    display: block;
}

/* Arrow pointing to bubble */
.wcrp-ai-preview-arrow {
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 16px;
    height: 16px;
    background: var(--wcrp-bg);
    transform: rotate(45deg);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.08);
}

/* Hide preview when chat is open */
.wcrp-ai-chat.open .wcrp-ai-preview-bubble {
    display: none !important;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .wcrp-ai-preview-bubble {
        bottom: 90px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .wcrp-ai-preview-arrow {
        right: 35px;
    }

    .wcrp-ai-chat.position-bottom-left .wcrp-ai-preview-bubble {
        right: 10px;
        left: 10px;
    }
}

/* ==========================================================================
   Chat Window - Glassmorphism Design
   ========================================================================== */

.wcrp-ai-window {
    display: flex;
    flex-direction: column;
    width: var(--wcrp-window-width);
    max-width: calc(100vw - 48px);
    height: var(--wcrp-window-height);
    max-height: calc(100vh - 120px);
    background: var(--wcrp-bg);
    border-radius: var(--wcrp-border-radius);
    box-shadow: var(--wcrp-shadow);
    overflow: hidden;
    animation: wcrp-window-enter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

@keyframes wcrp-window-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Header - Gradient with Glassmorphism
   ========================================================================== */

.wcrp-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--wcrp-primary) 0%, var(--wcrp-secondary) 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.wcrp-ai-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: wcrp-header-shine 8s linear infinite;
}

@keyframes wcrp-header-shine {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.wcrp-ai-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.wcrp-ai-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.wcrp-ai-avatar:hover {
    transform: scale(1.05);
}

.wcrp-ai-avatar svg {
    color: #ffffff;
    width: 26px;
    height: 26px;
}

.wcrp-ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcrp-ai-avatar-initials {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
}

.wcrp-ai-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wcrp-ai-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.wcrp-ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    opacity: 0.9;
}

.wcrp-ai-status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
    animation: wcrp-status-pulse 2s ease-in-out infinite;
}

@keyframes wcrp-status-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(34, 197, 94, 0.5); }
    50% { opacity: 0.7; box-shadow: 0 0 20px rgba(34, 197, 94, 0.8); }
}

.wcrp-ai-header-actions {
    display: flex;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.wcrp-ai-minimize,
.wcrp-ai-close {
    width: 32px !important;
    height: 32px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease;
    padding: 0 !important;
    line-height: 1 !important;
    min-width: 32px !important;
    min-height: 32px !important;
}

.wcrp-ai-minimize:hover,
.wcrp-ai-close:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #ffffff !important;
    transform: scale(1.05);
}

.wcrp-ai-minimize:active,
.wcrp-ai-close:active {
    transform: scale(0.95);
}

.wcrp-ai-minimize svg,
.wcrp-ai-close svg {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0;
    fill: #ffffff !important;
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.wcrp-ai-minimize svg path,
.wcrp-ai-close svg path {
    fill: #ffffff !important;
    stroke: none !important;
}

/* ==========================================================================
   Fixed Pills Container (Below Header)
   ========================================================================== */

.wcrp-ai-pills-container {
    display: none !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 0 !important;
    background: linear-gradient(180deg, rgba(127, 84, 179, 0.08) 0%, transparent 100%) !important;
    border-bottom: 1px solid rgba(127, 84, 179, 0.1) !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
}

.wcrp-ai-pills-container.active {
    display: flex !important;
    max-height: 200px !important;
    padding: 12px 16px !important;
    animation: wcrp-pills-slide-down 0.3s ease !important;
}

@keyframes wcrp-pills-slide-down {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

.wcrp-ai-pills-container .wcrp-ai-pill {
    padding: 8px 14px !important;
    font-size: 12px !important;
    background: var(--wcrp-bg) !important;
    border: 1px solid rgba(127, 84, 179, 0.2) !important;
    border-radius: 16px !important;
    color: var(--wcrp-primary) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    font-weight: 500 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
}

.wcrp-ai-pills-container .wcrp-ai-pill:hover {
    background: var(--wcrp-primary) !important;
    color: #ffffff !important;
    border-color: var(--wcrp-primary) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(127, 84, 179, 0.25) !important;
}

/* ==========================================================================
   Messages Area
   ========================================================================== */

.wcrp-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--wcrp-messages-bg);
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.wcrp-ai-messages::-webkit-scrollbar {
    width: 6px;
}

.wcrp-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wcrp-ai-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.wcrp-ai-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   Messages
   ========================================================================== */

.wcrp-ai-message {
    max-width: 85%;
    animation: wcrp-message-enter 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes wcrp-message-enter {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.wcrp-ai-message-assistant {
    align-self: flex-start;
}

.wcrp-ai-message-content {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
}

/* User messages */
.wcrp-ai-message-user .wcrp-ai-message-content {
    background: linear-gradient(135deg, var(--wcrp-primary) 0%, var(--wcrp-secondary) 100%);
    color: #ffffff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 15px rgba(127, 84, 179, 0.3);
}

/* Assistant messages */
.wcrp-ai-message-assistant .wcrp-ai-message-content {
    background: var(--wcrp-bg);
    color: var(--wcrp-text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Error message */
.wcrp-ai-message-assistant.error .wcrp-ai-message-content {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Message timestamp */
.wcrp-ai-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
    padding: 0 4px;
}

.wcrp-ai-message-user .wcrp-ai-message-time {
    text-align: right;
}

/* Links in messages */
.wcrp-ai-message-content a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s ease;
    word-break: break-word;
}

.wcrp-ai-message-content a:hover {
    opacity: 0.8;
}

.wcrp-ai-message-user .wcrp-ai-message-content a {
    color: #ffffff;
}

.wcrp-ai-message-assistant .wcrp-ai-message-content a {
    color: var(--wcrp-primary);
    font-weight: 500;
}

/* Phone links */
.wcrp-ai-message-content a.wcrp-phone-link {
    white-space: nowrap;
}

.wcrp-ai-message-content a.wcrp-phone-link::before {
    content: '📞 ';
    text-decoration: none;
}

/* ==========================================================================
   Typing Indicator
   ========================================================================== */

.wcrp-ai-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--wcrp-bg);
    border-radius: 18px;
    width: fit-content;
    margin: 0 20px 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.wcrp-ai-typing.hidden {
    display: none;
}

.wcrp-ai-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--wcrp-primary);
    border-radius: 50%;
    animation: wcrp-typing-bounce 1.4s ease-in-out infinite both;
}

.wcrp-ai-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.wcrp-ai-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes wcrp-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Input Form
   ========================================================================== */

.wcrp-ai-input-form {
    display: flex;
    padding: 16px 20px;
    gap: 12px;
    background: var(--wcrp-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    align-items: center;
}

.wcrp-ai-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 25px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    background: var(--wcrp-messages-bg);
    color: var(--wcrp-text);
}

.wcrp-ai-input:focus {
    border-color: var(--wcrp-primary);
    box-shadow: 0 0 0 4px rgba(127, 84, 179, 0.1);
    background: var(--wcrp-bg);
}

.wcrp-ai-input::placeholder {
    color: #9ca3af;
}

.wcrp-ai-send {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    background: linear-gradient(135deg, var(--wcrp-primary) 0%, var(--wcrp-secondary) 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    color: #ffffff !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(127, 84, 179, 0.3) !important;
    padding: 0 !important;
}

.wcrp-ai-send:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(127, 84, 179, 0.4) !important;
    background: linear-gradient(135deg, var(--wcrp-primary) 0%, var(--wcrp-secondary) 100%) !important;
    color: #ffffff !important;
}

.wcrp-ai-send:active {
    transform: scale(0.95);
}

.wcrp-ai-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.wcrp-ai-send svg {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    fill: #ffffff !important;
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.wcrp-ai-send svg path {
    fill: #ffffff !important;
    stroke: none !important;
}

.wcrp-ai-send:hover svg {
    transform: translateX(2px);
}

/* ==========================================================================
   Powered By Footer
   ========================================================================== */

.wcrp-ai-powered {
    padding: 10px;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    background: var(--wcrp-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.wcrp-ai-powered.hidden {
    display: none;
}

/* ==========================================================================
   Quick Actions (Optional)
   ========================================================================== */

.wcrp-ai-quick-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: var(--wcrp-messages-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.wcrp-ai-quick-actions::-webkit-scrollbar {
    display: none;
}

.wcrp-ai-quick-action {
    padding: 8px 16px;
    background: var(--wcrp-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    font-size: 13px;
    color: var(--wcrp-text);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.wcrp-ai-quick-action:hover {
    background: var(--wcrp-primary);
    color: #ffffff;
    border-color: var(--wcrp-primary);
}

/* ==========================================================================
   Quick Question Pills
   ========================================================================== */

.wcrp-ai-quick-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 12px;
    animation: wcrp-pills-enter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.wcrp-ai-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--wcrp-bg);
    border: 1.5px solid rgba(127, 84, 179, 0.25);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--wcrp-primary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    text-align: left;
    line-height: 1.4;
    font-family: inherit;
}

.wcrp-ai-pill:hover {
    background: linear-gradient(135deg, var(--wcrp-primary) 0%, var(--wcrp-secondary) 100%);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 84, 179, 0.3);
}

.wcrp-ai-pill:active {
    transform: translateY(0) scale(0.98);
}

/* Stagger animation for individual pills */
.wcrp-ai-pill:nth-child(1) { animation-delay: 0.05s; }
.wcrp-ai-pill:nth-child(2) { animation-delay: 0.1s; }
.wcrp-ai-pill:nth-child(3) { animation-delay: 0.15s; }
.wcrp-ai-pill:nth-child(4) { animation-delay: 0.2s; }
.wcrp-ai-pill:nth-child(5) { animation-delay: 0.25s; }
.wcrp-ai-pill:nth-child(6) { animation-delay: 0.3s; }

.wcrp-ai-pill {
    animation: wcrp-pill-stagger 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

@keyframes wcrp-pill-stagger {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile adjustments for pills */
@media (max-width: 480px) {
    .wcrp-ai-quick-pills {
        gap: 6px;
    }

    .wcrp-ai-pill {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* Dark mode for pills */
@media (prefers-color-scheme: dark) {
    .wcrp-ai-chat.auto-dark-mode .wcrp-ai-pill {
        background: #374151;
        border-color: rgba(127, 84, 179, 0.4);
    }

    .wcrp-ai-chat.auto-dark-mode .wcrp-ai-pill:hover {
        background: linear-gradient(135deg, var(--wcrp-primary) 0%, var(--wcrp-secondary) 100%);
        color: #ffffff;
    }
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .wcrp-ai-chat {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
    }

    .wcrp-ai-bubble {
        position: fixed;
        bottom: 16px;
        right: 16px;
    }

    .wcrp-ai-bubble-text {
        display: none;
    }

    .wcrp-ai-bubble {
        padding: 16px;
        border-radius: 50%;
        width: 60px;
        height: 60px;
        justify-content: center;
    }

    .wcrp-ai-window {
        width: 100%;
        max-width: none;
        height: calc(100vh - 20px);
        max-height: none;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .wcrp-ai-header {
        padding: 16px;
    }

    .wcrp-ai-messages {
        padding: 16px;
    }

    .wcrp-ai-message {
        max-width: 90%;
    }

    .wcrp-ai-input-form {
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    }

    .wcrp-ai-input {
        padding: 12px 16px;
    }

    .wcrp-ai-send {
        width: 44px;
        height: 44px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .wcrp-ai-chat.auto-dark-mode {
        --wcrp-bg: #1f2937;
        --wcrp-messages-bg: #111827;
        --wcrp-text: #f3f4f6;
    }

    .wcrp-ai-chat.auto-dark-mode .wcrp-ai-input {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }

    .wcrp-ai-chat.auto-dark-mode .wcrp-ai-input::placeholder {
        color: #9ca3af;
    }

    .wcrp-ai-chat.auto-dark-mode .wcrp-ai-message-assistant .wcrp-ai-message-content {
        background: #374151;
        border-color: #4b5563;
    }

    .wcrp-ai-chat.auto-dark-mode .wcrp-ai-typing {
        background: #374151;
    }

    .wcrp-ai-chat.auto-dark-mode .wcrp-ai-quick-action {
        background: #374151;
        border-color: #4b5563;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .wcrp-ai-bubble,
    .wcrp-ai-window,
    .wcrp-ai-message,
    .wcrp-ai-send,
    .wcrp-ai-input,
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wcrp-ai-chat {
        display: none !important;
    }
}
