/* AI Chatbot Frontend Styles */

/* Widget positioning */
.aicb-widget-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.aicb-widget-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.aicb-widget-top-right {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.aicb-widget-top-left {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Chat button */
.aicb-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--widget-color, #007cba);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: none;
}

.aicb-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Chat window */
.aicb-chat-window {
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

@media (max-width: 480px) {
    .aicb-chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        position: fixed;
    }
    
    .aicb-widget-bottom-right,
    .aicb-widget-bottom-left,
    .aicb-widget-top-right,
    .aicb-widget-top-left {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
    }
}

/* Chat header */
.aicb-chat-header {
    background: var(--widget-color, #007cba);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.aicb-chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.aicb-minimize-btn,
.aicb-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.aicb-minimize-btn:hover,
.aicb-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages area */
.aicb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aicb-message {
    max-width: 85%;
    word-wrap: break-word;
}

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

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

.aicb-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.aicb-user-message .aicb-message-content {
    background: var(--widget-color, #007cba);
    color: white;
    border-bottom-right-radius: 4px;
}

.aicb-bot-message .aicb-message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 4px;
}

.aicb-message-time {
    font-size: 11px;
    color: #8c8c8c;
    text-align: right;
    margin: 0 4px;
}

.aicb-bot-message .aicb-message-time {
    text-align: left;
}

/* Gallery button in messages */
.aicb-gallery-btn {
    background: var(--widget-color, #007cba);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 8px;
    transition: background-color 0.2s;
}

.aicb-gallery-btn:hover {
    background: rgba(var(--widget-color, #007cba), 0.8);
}

/* Input area */
.aicb-chat-input {
    background: white;
    border-top: 1px solid #e1e5e9;
    padding: 16px 20px;
}

.aicb-input-wrapper {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 24px;
    padding: 4px;
    transition: border-color 0.2s;
}

.aicb-input-wrapper:focus-within {
    border-color: var(--widget-color, #007cba);
}

#aicb-message-input {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    border-radius: 20px;
}

#aicb-message-input::placeholder {
    color: #8c8c8c;
}

#aicb-send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--widget-color, #007cba);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#aicb-send-button:hover {
    background: rgba(var(--widget-color, #007cba), 0.8);
}

#aicb-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Typing indicator */
.aicb-typing-indicator {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: #8c8c8c;
    font-size: 12px;
}

.aicb-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #8c8c8c;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1.0s infinite ease-in-out both;
}

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

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

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

/* Gallery Modal */
.aicb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.aicb-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    max-height: 80vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aicb-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aicb-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.aicb-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #8c8c8c;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.aicb-modal-close:hover {
    background: #f8f9fa;
}

.aicb-gallery-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.aicb-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.aicb-gallery-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid #e1e5e9;
}

.aicb-gallery-item:hover {
    transform: scale(1.02);
}

.aicb-gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.aicb-gallery-item-info {
    padding: 12px;
    background: white;
}

.aicb-gallery-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.aicb-gallery-item-desc {
    font-size: 12px;
    color: #8c8c8c;
    line-height: 1.3;
}

/* Animation classes */
.aicb-fade-in {
    animation: fadeIn 0.3s ease;
}

.aicb-slide-up {
    animation: slideUp 0.3s ease;
}

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

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

/* Scrollbar styling */
.aicb-chat-messages::-webkit-scrollbar,
.aicb-gallery-content::-webkit-scrollbar {
    width: 6px;
}

.aicb-chat-messages::-webkit-scrollbar-track,
.aicb-gallery-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.aicb-chat-messages::-webkit-scrollbar-thumb,
.aicb-gallery-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.aicb-chat-messages::-webkit-scrollbar-thumb:hover,
.aicb-gallery-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
