/* SaniSafe Chatbot Widget — Gold/Warm Theme */
.ss-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    font-family: 'DM Sans', system-ui, sans-serif;
}

/* Floating Button */
.ss-chat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #a38144, #e3bd5f, #c9a050);
    color: #312d29;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(163, 129, 68, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 2;
}
.ss-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(163, 129, 68, 0.55);
}
.ss-chat-btn-icon,
.ss-chat-btn-close {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.ss-chat-btn-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}
.ss-chatbot.open .ss-chat-btn-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}
.ss-chatbot.open .ss-chat-btn-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Pulse animation */
.ss-chat-btn-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(163, 129, 68, 0.3);
    animation: ssChatPulse 2s ease-out infinite;
    z-index: -1;
}
.ss-chatbot.open .ss-chat-btn-pulse {
    display: none;
}
@keyframes ssChatPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Chat Panel */
.ss-chat-panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(163, 129, 68, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.ss-chatbot.open .ss-chat-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.ss-chat-header {
    background: linear-gradient(135deg, #a38144, #c9a050);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ss-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ss-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.ss-chat-header strong {
    display: block;
    font-size: 1rem;
}
.ss-chat-status {
    font-size: 0.78rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}
.ss-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}
.ss-chat-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.ss-chat-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Messages Area */
.ss-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #faf8f5;
}
.ss-chat-messages::-webkit-scrollbar {
    width: 4px;
}
.ss-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(163,129,68,0.25);
    border-radius: 4px;
}

/* Message bubbles */
.ss-msg {
    max-width: 85%;
    animation: ssMsgIn 0.35s ease;
}
@keyframes ssMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.ss-msg-bot {
    align-self: flex-start;
}
.ss-msg-user {
    align-self: flex-end;
}
.ss-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.55;
}
.ss-msg-bot .ss-msg-bubble {
    background: #ffffff;
    color: #312d29;
    border: 1px solid rgba(163,129,68,0.12);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.ss-msg-user .ss-msg-bubble {
    background: linear-gradient(135deg, #a38144, #c9a050);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Options buttons */
.ss-msg-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.ss-msg-option {
    background: #ffffff;
    border: 1.5px solid #a38144;
    color: #a38144;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}
.ss-msg-option:hover {
    background: #a38144;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(163,129,68,0.25);
}

/* Typing indicator */
.ss-typing {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    align-self: flex-start;
}
.ss-typing span {
    width: 8px;
    height: 8px;
    background: #c9a050;
    border-radius: 50%;
    animation: ssTyping 1.2s infinite;
}
.ss-typing span:nth-child(2) { animation-delay: 0.2s; }
.ss-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ssTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.ss-chat-input {
    padding: 12px 16px;
    border-top: 1px solid rgba(163,129,68,0.12);
    display: flex;
    gap: 8px;
    background: #ffffff;
    flex-shrink: 0;
}
.ss-chat-input input {
    flex: 1;
    border: 1.5px solid rgba(163,129,68,0.2);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #faf8f5;
}
.ss-chat-input input:focus {
    border-color: #a38144;
}
.ss-chat-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #a38144, #c9a050);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.ss-chat-input button:hover {
    transform: scale(1.05);
}

/* Form inside chat */
.ss-chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.ss-chat-form input {
    border: 1.5px solid rgba(163,129,68,0.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    background: #faf8f5;
    transition: border-color 0.2s;
}
.ss-chat-form input:focus {
    border-color: #a38144;
}
.ss-chat-form button {
    background: linear-gradient(135deg, #a38144, #c9a050);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    transition: opacity 0.2s;
}
.ss-chat-form button:hover {
    opacity: 0.9;
}

/* Urgency banner */
.ss-urgency {
    background: linear-gradient(135deg, rgba(163,129,68,0.08), rgba(227,189,95,0.12));
    border: 1px solid rgba(163,129,68,0.2);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.84rem;
    color: #5c4a26;
    text-align: center;
    animation: ssMsgIn 0.4s ease;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .ss-chatbot {
        bottom: 16px;
        right: 16px;
    }
    .ss-chat-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }
    .ss-chatbot.open .ss-chat-btn {
        display: none;
    }
}
