/* ScanIt Parts AI Chat Widget */

/* Chat bubble button */
.sip-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #E31B23;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sip-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
}

.sip-chat-bubble svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: opacity 0.2s ease;
}

.sip-chat-bubble .sip-chat-icon-close {
    display: none;
}

.sip-chat-bubble.open .sip-chat-icon-open {
    display: none;
}

.sip-chat-bubble.open .sip-chat-icon-close {
    display: block;
}

/* Unread badge */
.sip-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #1e3a5f;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    font-family: 'Inter', sans-serif;
}

/* Chat window */
.sip-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 580px;
    min-width: 320px;
    min-height: 400px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    resize: both;
    transition: none;
}

.sip-chat-window.fullscreen {
    bottom: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    resize: none;
}

.sip-chat-window.open {
    display: flex;
    animation: sip-chat-slide-up 0.25s ease-out;
}

@keyframes sip-chat-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.sip-chat-header {
    background: #1e3a5f;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sip-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #E31B23;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sip-chat-header-avatar svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.sip-chat-header-info {
    flex: 1;
    min-width: 0;
}

.sip-chat-header-title {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.sip-chat-header-subtitle {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.3;
}

.sip-chat-header-actions {
    display: flex;
    gap: 2px;
    align-items: center;
}

.sip-chat-header-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.sip-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sip-chat-header-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.sip-chat-fullscreen-exit {
    display: none;
}

.sip-chat-window.fullscreen .sip-chat-fullscreen-enter {
    display: none;
}

.sip-chat-window.fullscreen .sip-chat-fullscreen-exit {
    display: block;
}

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

.sip-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.sip-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.sip-chat-messages::-webkit-scrollbar-thumb {
    background: #c4c8cf;
    border-radius: 3px;
}

/* Message bubbles */
.sip-chat-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    align-items: flex-end;
}

.sip-chat-msg.bot {
    align-self: flex-start;
}

.sip-chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.sip-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e3a5f;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sip-chat-msg-avatar svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.sip-chat-msg.user .sip-chat-msg-avatar {
    display: none;
}

.sip-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.sip-chat-msg.bot .sip-chat-msg-bubble {
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e2e5ea;
    border-bottom-left-radius: 4px;
}

.sip-chat-msg.user .sip-chat-msg-bubble {
    background: #E31B23;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Formatted markdown in bot messages */
.sip-chat-msg.bot .sip-chat-msg-bubble p {
    margin: 0 0 8px;
}

.sip-chat-msg.bot .sip-chat-msg-bubble p:last-child {
    margin-bottom: 0;
}

.sip-chat-msg.bot .sip-chat-msg-bubble br {
    display: block;
    content: "";
    margin: 4px 0;
}

.sip-chat-msg.bot .sip-chat-msg-bubble ul,
.sip-chat-msg.bot .sip-chat-msg-bubble ol {
    margin: 6px 0;
    padding-left: 20px;
}

.sip-chat-msg.bot .sip-chat-msg-bubble li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.sip-chat-msg.bot .sip-chat-msg-bubble li:last-child {
    margin-bottom: 0;
}

.sip-chat-msg.bot .sip-chat-msg-bubble strong {
    font-weight: 600;
    color: #1e3a5f;
}

/* Typing indicator */
.sip-chat-typing {
    display: none;
    align-self: flex-start;
    gap: 8px;
    align-items: flex-end;
    max-width: 85%;
}

.sip-chat-typing.active {
    display: flex;
}

.sip-chat-typing-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e3a5f;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sip-chat-typing-avatar svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.sip-chat-typing-dots {
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 12px 18px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.sip-chat-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: sip-chat-bounce 1.4s infinite;
}

.sip-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.sip-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes sip-chat-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* Input area */
.sip-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e2e5ea;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
    flex-shrink: 0;
}

.sip-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s;
}

.sip-chat-input:focus {
    border-color: #E31B23;
}

.sip-chat-input::placeholder {
    color: #9ca3af;
}

.sip-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #E31B23;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.sip-chat-send:hover {
    background: #c91620;
}

.sip-chat-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.sip-chat-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Registration form */
.sip-chat-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sip-chat-register {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 24px;
    background: #f7f8fa;
}

.sip-chat-register-header {
    text-align: center;
    margin-bottom: 24px;
}

.sip-chat-register-icon {
    margin-bottom: 12px;
}

.sip-chat-register-icon svg {
    width: 48px;
    height: 48px;
}

.sip-chat-register-title {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 8px;
}

.sip-chat-register-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

.sip-chat-register-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sip-chat-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sip-chat-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.sip-chat-form-input {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.sip-chat-form-input:focus {
    border-color: #E31B23;
}

.sip-chat-form-input::placeholder {
    color: #9ca3af;
}

.sip-chat-start-btn {
    background: #E31B23;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}

.sip-chat-start-btn:hover {
    background: #c91620;
}

/* Powered by footer */
.sip-chat-footer {
    text-align: center;
    padding: 6px 16px 10px;
    font-size: 11px;
    color: #9ca3af;
    background: #fff;
    flex-shrink: 0;
}

/* Welcome message */
.sip-chat-welcome {
    text-align: center;
    padding: 8px 0;
}

.sip-chat-welcome-text {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* Quick action buttons */
.sip-chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 4px 0 8px;
}

.sip-chat-quick-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: #1e3a5f;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.sip-chat-quick-btn:hover {
    background: #f0f4ff;
    border-color: #1e3a5f;
}

/* Feedback buttons */
.sip-chat-feedback {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0 2px;
    margin-left: 36px;
}

.sip-chat-feedback-text {
    font-size: 12px;
    color: #9ca3af;
}

.sip-chat-feedback-done {
    color: #6b7280;
    font-style: italic;
}

.sip-chat-feedback-btn {
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 3px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.sip-chat-feedback-btn:hover {
    border-color: #9ca3af;
}

.sip-chat-feedback-yes:hover {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.sip-chat-feedback-no:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Error message */
.sip-chat-error {
    font-size: 12px;
    color: #dc2626;
    text-align: center;
    padding: 4px 8px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .sip-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .sip-chat-bubble {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .sip-chat-bubble svg {
        width: 24px;
        height: 24px;
    }
}
