/* ══════════════════════════════════════
   CHATBOT WIDGET — Rowan Berry Palette
   ══════════════════════════════════════ */

.sk-chatbot {
    --cb-primary: #C41E3A;
    --cb-primary-dark: #A01830;
    --cb-bg: #FFFFFF;
    --cb-text: #1D1D1F;
    --cb-muted: #6E6E73;
    --cb-light: #F5F5F7;
    --cb-border: #E5E5EA;
    --cb-radius: 20px;
    font-family: 'Inter', -apple-system, sans-serif;
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
}

/* Toggle Button */
.sk-chatbot__toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--cb-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(196, 30, 58, 0.35);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
    z-index: 10000;
}
.sk-chatbot__toggle:hover {
    transform: scale(1.1);
    background: var(--cb-primary-dark);
}
.sk-chatbot__toggle svg {
    width: 24px;
    height: 24px;
}
.sk-chatbot__toggle--pulse {
    animation: cb-pulse 2s ease-in-out infinite;
}
@keyframes cb-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(196, 30, 58, 0.35); }
    50% { box-shadow: 0 4px 30px rgba(196, 30, 58, 0.55); }
}

/* Chat Window */
.sk-chatbot__window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    max-height: 560px;
    background: var(--cb-bg);
    border-radius: var(--cb-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}
.sk-chatbot__window--open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.sk-chatbot__header {
    padding: 16px 20px;
    background: var(--cb-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sk-chatbot__header-title {
    font-size: 15px;
    font-weight: 600;
}
.sk-chatbot__header-subtitle {
    font-size: 12px;
    opacity: 0.8;
}
.sk-chatbot__close {
    background: rgba(255,255,255,0.2);
    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;
}
.sk-chatbot__close:hover {
    background: rgba(255,255,255,0.3);
}

/* Messages */
.sk-chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 360px;
    scroll-behavior: smooth;
}
.sk-chatbot__message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: cb-fadeIn 0.3s ease;
}
@keyframes cb-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.sk-chatbot__message--bot {
    align-self: flex-start;
    background: var(--cb-light);
    color: var(--cb-text);
    border-bottom-left-radius: 4px;
}
.sk-chatbot__message--user {
    align-self: flex-end;
    background: var(--cb-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.sk-chatbot__typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    align-self: flex-start;
}
.sk-chatbot__typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cb-muted);
    animation: cb-dots 1.2s ease-in-out infinite;
}
.sk-chatbot__typing span:nth-child(2) { animation-delay: 0.2s; }
.sk-chatbot__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cb-dots {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Quick buttons */
.sk-chatbot__quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid var(--cb-border);
}
.sk-chatbot__quick-btn {
    padding: 6px 12px;
    border: 1px solid var(--cb-border);
    border-radius: 980px;
    background: var(--cb-bg);
    color: var(--cb-text);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.sk-chatbot__quick-btn:hover {
    background: var(--cb-primary);
    color: #fff;
    border-color: var(--cb-primary);
}

/* Input */
.sk-chatbot__input-area {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid var(--cb-border);
    gap: 8px;
    align-items: center;
}
.sk-chatbot__input {
    flex: 1;
    border: 1px solid var(--cb-border);
    border-radius: 980px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.sk-chatbot__input:focus {
    border-color: var(--cb-primary);
}
.sk-chatbot__send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cb-primary);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.sk-chatbot__send:hover {
    background: var(--cb-primary-dark);
}

/* Mobile */
@media (max-width: 767px) {
    .sk-chatbot__window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 20px 20px 0 0;
    }
    .sk-chatbot__messages {
        max-height: calc(100vh - 200px);
        max-height: calc(100dvh - 200px);
    }
    .sk-chatbot__toggle {
        bottom: 16px;
        right: 16px;
    }
}

/* Print */
@media print {
    .sk-chatbot { display: none !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .sk-chatbot__toggle,
    .sk-chatbot__window,
    .sk-chatbot__message {
        animation: none !important;
        transition: none !important;
    }
}
