/* =============================================
   ShutterPhrase — CHATBOT.CSS
   ============================================= */

/* ================= CHATBOT TOGGLE BUTTON ================= */
#sp-chat-widget { position: fixed; bottom: 30px; right: 30px; z-index: 9999; font-family: Inter, sans-serif; }

/* ================= CHATBOT MOBILE OVERRIDES ================= */
@media (max-width: 600px) {
    
/* ═══════════ CHATBOT ═══════════ */
.sp-chat-widget { bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; }

    .sp-chat-header { padding: 16px 20px; padding-top: max(20px, env(safe-area-inset-top)); }
    
    .sp-chat-input-area input { font-size: 16px; padding: 14px 12px; border-radius: 12px; }


    #sp-chat-window {
        position: fixed !important;
        top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
        width: 100% !important; max-width: 100% !important;
        height: 100dvh !important; max-height: 100dvh !important;
        border-radius: 0 !important;
        transform-origin: bottom center !important;
    }

}
#sp-chat-toggle-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
    padding-bottom: env(safe-area-inset-bottom);
}
#sp-chat-logo-btn {
    position: relative; width: 58px; height: 58px; border-radius: 50%;
    background: #0a0a0a; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
}
#sp-chat-logo-btn img { width: 36px; height: 36px; border-radius: 50%; object-fit: contain; position: relative; z-index: 2; }
.sp-pulse-ring {
    position: absolute; inset: -6px; border-radius: 50%;
    border: 1.5px solid rgba(203,167,116,0.6);
    animation: goldPulse 2.2s ease-out infinite;
}
.sp-pulse-ring:nth-child(2) { animation-delay: 0.7s; inset: -12px; border-color: rgba(203,167,116,0.3); }
@keyframes goldPulse {
    0%   { transform: scale(1);    opacity: 0.8; }
    70%  { transform: scale(1.15); opacity: 0;   }
    100% { transform: scale(1.15); opacity: 0;   }
}
#sp-chat-label {
    font-family: Inter, sans-serif; font-size: 0.7rem; letter-spacing: 1.5px;
    text-transform: uppercase; color: rgba(255,255,255,0.7);
    background: rgba(10,10,10,0.8); border: 1px solid rgba(203,167,116,0.25);
    padding: 5px 12px; border-radius: 20px; backdrop-filter: blur(8px);
    transition: color 0.3s, border-color 0.3s; white-space: nowrap;
}
#sp-chat-toggle-wrap:hover #sp-chat-label { color: #ffdf85; border-color: rgba(203,167,116,0.6); }

/* ================= CHATBOT UI ================= */
#sp-chat-window {
    position: absolute; bottom: 70px; right: 0; width: calc(100vw - 40px); max-width: 400px; height: 640px; max-height: calc(100vh - 120px);
    background: rgba(14,14,16,0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    display: flex; flex-direction: column; overflow: hidden; transform-origin: bottom right;
    transition: opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0; transform: scale(0.8) translateY(20px); pointer-events: none;
}
#sp-chat-window.open { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }

.sp-chat-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; }
.sp-chat-header div { display: flex; flex-direction: column; }
.sp-chat-title { font-family: "Cormorant Garamond", serif; font-family: "Cormorant Garamond", serif; font-size: 1.3rem; color: #ffdf85; line-height: 1; }
.sp-chat-subtitle { font-family: "Cormorant Garamond", serif; font-size: 0.7rem; color: rgba(255,255,255,0.5); letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; }
.sp-chat-close { background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; font-size: 24px; transition: 0.3s; line-height: 1; padding: 0; }
.sp-chat-close:hover { color: white; transform: rotate(90deg); }

.sp-chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent; }
.sp-chat-body::-webkit-scrollbar { width: 6px; }
.sp-chat-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.sp-msg { max-width: 85%; padding: 12px 16px; border-radius: 14px; font-size: 0.9rem; line-height: 1.4; animation: msgFadeIn 0.3s ease forwards; }
@keyframes msgFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.sp-msg.bot { background: rgba(255,255,255,0.06); color: #fff; align-self: flex-start; border-bottom-left-radius: 4px; }
.sp-msg.user { background: linear-gradient(135deg, #cba774, #d48300); color: #000; align-self: flex-end; border-bottom-right-radius: 4px; font-weight: 500; }
.sp-msg.sys { align-self: center; background: transparent; color: rgba(255,255,255,0.4); font-size: 0.75rem; text-align: center; }

.sp-chat-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.sp-opt-btn { background: transparent; border: 1px solid rgba(203,167,116,0.4); color: #ffdf85; padding: 8px 14px; border-radius: 20px; font-family: Inter, sans-serif; font-size: 0.8rem; cursor: pointer; transition: 0.3s; }
.sp-opt-btn:hover { background: rgba(203,167,116,0.15); border-color: #cba774; }

/* Multi-Select */
.sp-multiselect-wrapper { display: flex; flex-direction: column; gap: 10px; margin-top: 5px; width: 100%; }
.sp-checkbox-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid rgba(203,167,116,0.3); border-radius: 12px; cursor: pointer; transition: 0.25s; background: rgba(255,255,255,0.03); }
.sp-checkbox-item:hover { background: rgba(203,167,116,0.08); border-color: rgba(203,167,116,0.6); }
.sp-checkbox-item.selected { background: rgba(203,167,116,0.12); border-color: #cba774; }
.sp-checkbox-item input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid rgba(203,167,116,0.5); border-radius: 5px; background: transparent; cursor: pointer; flex-shrink: 0; position: relative; transition: 0.2s; }
.sp-checkbox-item.selected input[type="checkbox"] { background: #cba774; border-color: #cba774; }
.sp-checkbox-item.selected input[type="checkbox"]::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #000; font-size: 11px; font-weight: 700; line-height: 1; }
.sp-checkbox-label { font-size: 0.85rem; color: #f5f5f5; flex: 1; }
.sp-confirm-btn { background: linear-gradient(135deg, #cba774, #d48300); border: none; border-radius: 20px; color: #000; font-family: Inter, sans-serif; font-size: 0.8rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; padding: 11px 22px; cursor: pointer; transition: 0.3s; margin-top: 4px; align-self: flex-start; }
.sp-confirm-btn:hover { opacity: 0.85; transform: scale(1.03); }

.sp-chat-input-area { padding: 15px; border-top: 1px solid rgba(255,255,255,0.05); display: flex; gap: 8px; background: rgba(0,0,0,0.2); box-sizing: border-box; width: 100%; overflow: hidden; }
.sp-chat-input-area input { flex: 1; min-width: 0; max-width: calc(100% - 60px); background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 12px; color: white; font-family: Inter, sans-serif; font-size: 0.9rem; outline: none; transition: 0.3s; }
.sp-chat-input-area input:focus { border-color: rgba(203,167,116,0.5); }
.sp-chat-send { background: linear-gradient(135deg, #cba774, #d48300); border: none; border-radius: 10px; width: 45px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.3s; }
.sp-chat-send:hover { opacity: 0.8; }
.sp-chat-send svg { width: 18px; height: 18px; fill: #000; }

.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; background: rgba(255,255,255,0.06); border-radius: 14px; border-bottom-left-radius: 4px; width: fit-content; align-self: flex-start; margin-bottom: 10px; }
.typing-dot { width: 6px; height: 6px; background: rgba(255,255,255,0.5); border-radius: 50%; animation: typing 1.4s infinite ease-in-out both; }
.typing-dot:nth-child(1) { animation-delay: -0.32s; } .typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

@media (max-width: 480px) {
    #sp-chat-widget { bottom: 20px; right: 20px; }
    #sp-chat-window { position: fixed; bottom: 0; right: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: none; padding-bottom: env(safe-area-inset-bottom); }
}

/* =================
