/**
 * WICW Chatbot - CSS Styles
 * Modern, responsive chat widget styles
 */

/* Widget Container */
.wicw-chatbot-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Position variants */
.wicw-chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

.wicw-chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

.wicw-chatbot-top-right {
    top: 20px;
    right: 20px;
}

.wicw-chatbot-top-left {
    top: 20px;
    left: 20px;
}

/* Chat Button */
.wicw-chatbot-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
}

.wicw-chatbot-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

/* Chat Interface */
.wicw-chatbot-interface {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.wicw-chatbot-open .wicw-chatbot-interface {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Header */
.wicw-chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.wicw-chatbot-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.wicw-chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.wicw-chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
.wicw-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

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

.wicw-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wicw-chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

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

/* Message Styles */
.wicw-chatbot-message {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease;
}

.wicw-chatbot-message:last-child {
    margin-bottom: 0;
}

.wicw-chatbot-message.wicw-chatbot-user {
    flex-direction: row-reverse;
}

.wicw-chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.wicw-chatbot-message.wicw-chatbot-user .wicw-chatbot-avatar {
    background: #6c757d;
}

.wicw-chatbot-message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 70%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    line-height: 1.5;
}

/* List styling for bot messages */
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ul,
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content li {
    margin: 4px 0;
    line-height: 1.4;
}

.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ul li {
    list-style-type: disc;
    color: inherit;
}

.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ol li {
    list-style-type: decimal;
    color: inherit;
}

/* Nested list styling */
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ul ul,
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ol ul {
    margin: 2px 0;
    padding-left: 16px;
}

.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ul ul li {
    list-style-type: circle;
}

.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ol ol,
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ul ol {
    margin: 2px 0;
    padding-left: 16px;
}

/* Ensure proper spacing between list and other content */
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content p + ul,
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content p + ol {
    margin-top: 8px;
}

.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ul + p,
.wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ol + p {
    margin-top: 8px;
}

.wicw-chatbot-message.wicw-chatbot-user .wicw-chatbot-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Typing Indicator */
.wicw-chatbot-typing {
    display: flex;
    gap: 4px;
    align-items: center;
}

.wicw-chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c1c1c1;
    animation: typing 1.4s infinite ease-in-out;
}

.wicw-chatbot-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.wicw-chatbot-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Input Container */
.wicw-chatbot-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.wicw-chatbot-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wicw-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

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

.wicw-chatbot-input::placeholder {
    color: #6c757d;
}

.wicw-chatbot-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wicw-chatbot-send:hover {
    transform: scale(1.05);
}

.wicw-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Theme Variants */
.wicw-chatbot-dark {
    color-scheme: dark;
}

.wicw-chatbot-dark .wicw-chatbot-interface {
    background: #2d3748;
    color: white;
}

.wicw-chatbot-dark .wicw-chatbot-messages {
    background: #1a202c;
}

.wicw-chatbot-dark .wicw-chatbot-message-content {
    background: #4a5568;
    color: white;
}

/* Dark theme list styling */
.wicw-chatbot-dark .wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ul li,
.wicw-chatbot-dark .wicw-chatbot-message.wicw-chatbot-bot .wicw-chatbot-message-content ol li {
    color: white;
}

.wicw-chatbot-dark .wicw-chatbot-input {
    background: #4a5568;
    border-color: #718096;
    color: white;
}

.wicw-chatbot-dark .wicw-chatbot-input::placeholder {
    color: #a0aec0;
}

.wicw-chatbot-dark .wicw-chatbot-input-container {
    background: #2d3748;
    border-top-color: #4a5568;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .wicw-chatbot-interface {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .wicw-chatbot-message-content {
        max-width: 85%;
    }
    
    .wicw-chatbot-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .wicw-chatbot-button {
        width: 50px;
        height: 50px;
    }
}

/* Loading State */
.wicw-chatbot-loading .wicw-chatbot-message-content {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

/* Accessibility */
.wicw-chatbot-button:focus,
.wicw-chatbot-close:focus,
.wicw-chatbot-send:focus,
.wicw-chatbot-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wicw-chatbot-button {
        border: 2px solid #000;
    }
    
    .wicw-chatbot-interface {
        border: 2px solid #000;
    }
    
    .wicw-chatbot-message-content {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .wicw-chatbot-widget * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
