/**
 * CapeStart Chatbot Widget - Styles
 */

/* Root styles */
#capestart-chat-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    z-index: 9999;
    position: fixed;
}

/* Position variants */
#capestart-chat-widget.capestart-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#capestart-chat-widget.capestart-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

#capestart-chat-widget.capestart-position-top-right {
    top: 20px;
    right: 20px;
}

#capestart-chat-widget.capestart-position-top-left {
    top: 20px;
    left: 20px;
}

/* Chat button */
.capestart-chat-btn {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--capestart-button-color, #2563eb);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    font-size: 24px;
    padding: 0;
}

.capestart-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.capestart-chat-btn:active {
    transform: scale(0.95);
}

/* Chat box */
.capestart-chatbox {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

.capestart-chatbox.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header */
.capestart-chat-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.capestart-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.capestart-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.capestart-close-btn:hover {
    opacity: 0.7;
}

/* Messages area */
.capestart-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #fafafa;
}

/* Message styles */
.capestart-message {
    display: flex;
    margin-bottom: 5px;
    animation: messageAppear 0.3s ease-in;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.capestart-message p {
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 85%;
    word-wrap: break-word;
}

.user-message {
    justify-content: flex-end;
}

.user-message p {
    background-color: #2563eb;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.bot-message {
    justify-content: flex-start;
}

.bot-message p {
    background-color: #e5e7eb;
    color: #1f2937;
    border-radius: 18px 18px 18px 4px;
}

.error-message {
    justify-content: flex-start;
}

.error-message p {
    background-color: #fee2e2;
    color: #991b1b;
    border-radius: 12px;
    font-size: 13px;
}

/* Input area */
.capestart-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 10px;
    display: flex;
    gap: 8px;
    background: white;
}

.capestart-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.capestart-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.capestart-input::placeholder {
    color: #9ca3af;
}

/* Send button */
.capestart-send-btn {
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.capestart-send-btn:hover {
    background-color: #1d4ed8;
    transform: scale(1.05);
}

.capestart-send-btn:active {
    transform: scale(0.95);
}

/* Scrollbar styling */
.capestart-messages::-webkit-scrollbar {
    width: 6px;
}

.capestart-messages::-webkit-scrollbar-track {
    background: transparent;
}

.capestart-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.capestart-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive design */
@media (max-width: 768px) {
    .capestart-chatbox {
        width: 320px;
        height: 450px;
    }

    .capestart-message p {
        max-width: 90%;
        font-size: 13px;
    }

    .capestart-input {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .capestart-chatbox {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .capestart-chat-header {
        border-radius: 0;
    }

    .capestart-chat-btn {
        width: 50px;
        height: 50px;
    }
}

/* Disable text selection in UI */
.capestart-chat-header,
.capestart-chat-btn,
.capestart-send-btn {
    user-select: none;
    -webkit-user-select: none;
}
