/* =============================================
   SSW Lighting - AI Chat Widget Styles
   ============================================= */

/* --- Floating Button --- */
.ssw-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 180, 216, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}
.ssw-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 180, 216, 0.55);
}
.ssw-chat-btn svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

/* Pulse animation ring */
.ssw-chat-btn::before {
    content: '';
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 180, 216, 0.35);
    animation: ssw-pulse 2s ease-out infinite;
}
@keyframes ssw-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Badge */
.ssw-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    z-index: 2;
    display: none;
}
.ssw-chat-badge.show {
    display: flex;
}

/* --- Chat Window --- */
.ssw-chat-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 400px;
    height: 550px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
}
.ssw-chat-window.open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* --- Header --- */
.ssw-chat-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #0a1628 0%, #0d2137 100%);
    color: #fff;
    flex-shrink: 0;
}
.ssw-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
}
.ssw-chat-header-avatar svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}
.ssw-chat-header-info {
    flex: 1;
    min-width: 0;
}
.ssw-chat-header-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}
.ssw-chat-header-status {
    font-size: 12px;
    color: #6ee7b7;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ssw-chat-header-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6ee7b7;
    flex-shrink: 0;
}
.ssw-chat-header-actions {
    display: flex;
    gap: 6px;
    margin-left: 8px;
}
.ssw-chat-header-actions button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, color 0.2s;
}
.ssw-chat-header-actions button:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* --- Messages Area --- */
.ssw-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    scroll-behavior: smooth;
}
.ssw-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.ssw-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 119, 182, 0.2);
    border-radius: 3px;
}

/* Message wrapper */
.ssw-msg {
    display: flex;
    margin-bottom: 14px;
    align-items: flex-start;
    animation: ssw-msg-in 0.3s ease;
}
@keyframes ssw-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.ssw-msg.bot {
    justify-content: flex-start;
}
.ssw-msg.user {
    justify-content: flex-end;
}

/* Bot avatar in chat */
.ssw-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 8px;
}
.ssw-msg-avatar svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* Bubbles */
.ssw-msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
.ssw-msg.bot .ssw-msg-bubble {
    background: #e3f2fd;
    color: #0a1628;
    border-bottom-left-radius: 4px;
}
.ssw-msg.user .ssw-msg-bubble {
    background: #f0f0f0;
    color: #1a1a1a;
    border-bottom-right-radius: 4px;
}

/* --- Typing Indicator --- */
.ssw-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}
.ssw-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0077b6;
    animation: ssw-typing-bounce 1.4s ease-in-out infinite;
}
.ssw-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.ssw-typing-dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes ssw-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* --- Product Card --- */
.ssw-product-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: box-shadow 0.2s;
    max-width: 100%;
}
.ssw-product-card:hover {
    box-shadow: 0 2px 8px rgba(0, 119, 182, 0.12);
}
.ssw-product-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ssw-product-card-icon svg {
    width: 20px;
    height: 20px;
    fill: #0077b6;
}
.ssw-product-card-info {
    flex: 1;
    min-width: 0;
}
.ssw-product-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #0a1628;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ssw-product-card-model {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}
.ssw-product-card-price {
    font-size: 14px;
    font-weight: 700;
    color: #d4a574;
    margin-top: 2px;
}
.ssw-product-card-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #00b4d8;
    background: transparent;
    color: #00b4d8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.ssw-product-card-btn:hover {
    background: #00b4d8;
    color: #fff;
}

/* --- Quick Actions --- */
.ssw-chat-quick {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.ssw-chat-quick-btn {
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.ssw-chat-quick-btn:hover {
    border-color: #00b4d8;
    color: #00b4d8;
    background: #e0f7fa;
}

/* --- Input Area --- */
.ssw-chat-input-area {
    display: flex;
    align-items: flex-end;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.ssw-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 80px;
    line-height: 1.4;
    transition: border-color 0.2s;
    background: #f8fafc;
}
.ssw-chat-input:focus {
    border-color: #00b4d8;
    background: #fff;
}
.ssw-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 8px;
    transition: opacity 0.2s, transform 0.15s;
}
.ssw-chat-send:hover {
    transform: scale(1.05);
}
.ssw-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.ssw-chat-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* --- Mobile Responsive --- */
@media (max-width: 480px) {
    .ssw-chat-btn {
        bottom: 16px;
        right: 16px;
    }
    .ssw-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
    }
    .ssw-chat-quick {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }
}

/* --- Dark theme adjustments --- */
@media (prefers-color-scheme: dark) {
    .ssw-chat-window {
        background: rgba(15, 23, 42, 0.97);
        border-color: rgba(255, 255, 255, 0.08);
    }
    .ssw-chat-messages {
        background: #0f172a;
    }
    .ssw-chat-input {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }
    .ssw-chat-input:focus {
        background: #1e293b;
        border-color: #00b4d8;
    }
    .ssw-chat-input-area {
        background: #0f172a;
        border-color: #1e293b;
    }
    .ssw-msg.bot .ssw-msg-bubble {
        background: #1e293b;
        color: #e2e8f0;
    }
    .ssw-msg.user .ssw-msg-bubble {
        background: #334155;
        color: #f1f5f9;
    }
    .ssw-chat-quick {
        background: #0f172a;
        border-color: #1e293b;
    }
    .ssw-chat-quick-btn {
        background: #1e293b;
        border-color: #334155;
        color: #cbd5e1;
    }
    .ssw-chat-quick-btn:hover {
        border-color: #00b4d8;
        color: #00b4d8;
        background: rgba(0, 180, 216, 0.1);
    }
    .ssw-product-card {
        background: #1e293b;
        border-color: #334155;
    }
    .ssw-product-card-name { color: #e2e8f0; }
    .ssw-product-card-model { color: #94a3b8; }
    .ssw-product-card-icon {
        background: rgba(0, 180, 216, 0.15);
    }
    .ssw-product-card-icon svg { fill: #00b4d8; }
}
