/* Smart Painting Chatbot — Isolated styles with .sp-chatbot-* prefix */

:root {
    --sp-primary: #2c3e50;
    --sp-primary-light: #3498db;
    --sp-bg: #ffffff;
    --sp-bg-messages: #f5f7fa;
    --sp-text: #2c3e50;
    --sp-text-light: #7f8c8d;
    --sp-border: #e0e0e0;
    --sp-bot-bubble: #ecf0f1;
    --sp-user-bubble: #3498db;
    --sp-user-text: #ffffff;
    --sp-radius: 12px;
    --sp-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

/* FAB Button */
.sp-chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #fff9f9; 
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(10, 180, 166, 0.3);
    z-index: 999999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spPulse 2s infinite;
}
.sp-chatbot-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(10, 180, 166, 0.45);
}
.sp-fab-avatar {
    width: 27px;
    height: 27px;
    pointer-events: none; 
}
@keyframes spPulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(10, 180, 166, 0.3); }
    50% { box-shadow: 0 4px 32px rgba(10, 180, 166, 0.6), 0 0 0 8px rgba(10, 180, 166, 0.15); }
}

/* Container */
.sp-chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 480px;
    max-height: 600px;
    background: var(--sp-bg);
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow);
    display: flex;
    flex-direction: column;
    z-index: 999999;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--sp-text);
}

/* Header */
.sp-chatbot-header {
    background: #0AB4A6;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.sp-chatbot-title {
    font-size: 16px;
    font-weight: 600;
}
.sp-chatbot-minimize {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.sp-chatbot-minimize:hover {
    opacity: 1;
}

/* Messages area */
.sp-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--sp-bg-messages);
    min-height: 300px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message bubbles */
.sp-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--sp-radius);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: spFadeIn 0.3s ease;
    padding-left: 0;
}
.sp-bubble-bot {
    
    color: var(--sp-text);
    align-self: flex-start;
    
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.sp-bubble-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e2e2e2;
    flex-shrink: 0;
    object-fit: cover;
}
.sp-bubble-bot-text {
    flex: 1;
    min-width: 0;
    background: var(--sp-bot-bubble);
    border-bottom-left-radius: 4px;
    padding: 10px;
}
.sp-bubble-user {
    background: var(--sp-user-bubble);
    color: var(--sp-user-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    padding-left: 15px;  
    background: linear-gradient(90deg, #0AB4A6 0%, #1E1E1E 104.12%)
     
}
.sp-bubble-system {
    background: transparent;
    color: var(--sp-text-light);
    font-style: italic;
    font-size: 13px;
    align-self: center;
    text-align: center;
}

/* Buttons group */
.sp-buttons-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    align-self: flex-start;
    max-width: 90%;
    animation: spFadeIn 0.3s ease;
}
.sp-btn-option {
    background: #0AB4A6;
    border: 2px solid #0AB4A6;
    color: #fff;
    padding: 2px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit; 
}
.sp-btn-option:hover {
    background: var(--sp-primary-light);
    color: #fff;
}
.sp-btn-option:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* Input area */
.sp-chatbot-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--sp-border);
    background: var(--sp-bg);
    flex-shrink: 0;
}
.sp-chatbot-text-input {
    display: flex;
    gap: 8px;
    align-items: center;
}
.sp-chatbot-text-input input {
    flex: 1;
    border: 1px solid var(--sp-border);
    border-radius: 50px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.sp-chatbot-text-input input:focus {
    border-color: var(--sp-primary-light);
}
.sp-btn-send {
    background: #fff;
    color: #fff;
    border: 1px solid var(--sp-border);
    border: none;
    border-radius: 50%; 
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.sp-btn-send svg{
    width: 17px; 
    height: 17px;
}
.sp-btn-send:hover {
    background: var(--sp-primary);
}

/* Actions bar */
.sp-chatbot-actions {
    padding: 8px 16px 12px;
    background: var(--sp-bg);
    flex-shrink: 0;
}
.sp-btn-recommendations {
    width: 100%;
    background: #0AB4A6; 
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}
.sp-btn-recommendations:hover {
    background: var(--sp-primary-light);
}
.sp-btn-recommendations:disabled {
    opacity: 0.5;
    cursor: default;
}
.sp-btn-restart {
    width: 100%;
    background: transparent;
    color: var(--sp-primary);
    border: 1px solid var(--sp-border);
    border-radius: 50px;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    margin-top: 6px;
}
.sp-btn-restart:hover {
    background: var(--sp-bg-messages);
}

/* Recommendations */
.sp-recommendations {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}
.sp-rec-card {
    display: flex;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 12px;
    transition: box-shadow 0.2s;
    animation: spFadeIn 0.4s ease;
}
.sp-rec-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.sp-rec-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}
.sp-rec-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sp-rec-info {
    flex: 1;
    min-width: 0;
}
.sp-rec-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-rec-score {
    position: relative;
    background: #ecf0f1;
    border-radius: 10px;
    height: 18px;
    margin-bottom: 6px;
    overflow: hidden;
}
.sp-rec-score-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    border-radius: 10px;
    transition: width 0.6s ease;
}
.sp-rec-score span {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    padding-left: 8px;
    color: var(--sp-text);
}
.sp-rec-reason {
    font-size: 12px;
    color: var(--sp-text-light);
    line-height: 1.4;
    margin-bottom: 6px;
}
.sp-rec-link {
    font-size: 13px;
    color: var(--sp-primary-light);
    text-decoration: none;
    font-weight: 500;
}
.sp-rec-link:hover {
    text-decoration: underline;
}

/* Typing indicator */
.sp-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}
.sp-typing span {
    width: 8px;
    height: 8px;
    background: #bdc3c7;
    border-radius: 50%;
    animation: spBounce 1.2s infinite;
}
.sp-typing span:nth-child(2) { animation-delay: 0.2s; }
.sp-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Animations */
@keyframes spFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Scrollbar */
.sp-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.sp-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.sp-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Mobile */
@media (max-width: 768px) {
    .sp-chatbot-container {
        bottom: 0;
        right: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .sp-chatbot-messages {
        max-height: calc(100vh - 200px);
    }
    .sp-chatbot-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    .sp-fab-avatar {
        width: 27px;
        height: 27px;
    }
}
