/* ==========================================
   SHAKE HAVEN: LUXURY DESIGN SYSTEM
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Mulish:wght@400;500;600;700&family=MuseoModerno:wght@300;400;600&display=swap');

:root {
    /* Linear / Stripe / Apple Inspired Token System */
    
    /* Brand Core */
    --brand-blue: rgb(74, 87, 191);
    --brand-blue-hover: rgb(41, 48, 105);
    --brand-yellow: rgb(253, 200, 106);
    --brand-dark: rgb(30, 31, 58);
    --brand-cream: rgb(249, 241, 230);
    
    /* Semantic Colors */
    --surface-base: rgba(255, 255, 255, 0.85);
    --surface-elevated: #ffffff;
    --surface-user: var(--brand-blue);
    --surface-bot: rgba(249, 241, 230, 0.5);
    
    /* Borders & Shadows */
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-focus: var(--brand-blue);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 24px 48px -12px rgba(30, 31, 58, 0.25);
    --shadow-glow: 0 8px 24px rgba(74, 87, 191, 0.3);
    
    /* Typography */
    --font-body: 'Mulish', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-head: 'MuseoModerno', sans-serif;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-tertiary: #9CA3AF;
    --text-inverse: #ffffff;
    
    /* Motion */
    --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.2s;
    --duration-base: 0.4s;
    
    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
}

/* ------------------------------------------
   BASE COMPONENT RESET
   ------------------------------------------ */
#shea-widget-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 999999;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#shea-widget-container * {
    box-sizing: border-box;
}

/* ------------------------------------------
   FLOATING ACTION BUTTON
   ------------------------------------------ */
#shea-toggle-btn {
    background: var(--brand-dark);
    color: var(--text-inverse);
    border: none;
    padding: 16px 32px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--duration-base) var(--ease-apple);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 0.5px;
}

#shea-toggle-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 32px 64px -12px rgba(30, 31, 58, 0.35);
    background: var(--brand-blue);
}

.shea-toggle-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ------------------------------------------
   MAIN CHAT WINDOW (THE CANVAS)
   ------------------------------------------ */
#shea-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    height: 650px;
    max-height: calc(100vh - 120px);
    background: var(--surface-base);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: opacity var(--duration-base) var(--ease-apple), 
                transform var(--duration-base) var(--ease-apple);
}

#shea-chat-window.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(20px);
}

/* ------------------------------------------
   PREMIUM HEADER
   ------------------------------------------ */
.shea-header {
    background: transparent;
    padding: 24px 24px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.shea-header-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.shea-avatar-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
}

.shea-avatar {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--surface-elevated);
    box-shadow: var(--shadow-sm);
}

.shea-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border: 2px solid var(--surface-elevated);
    border-radius: var(--radius-full);
    animation: pulse-green 2s infinite var(--ease-apple);
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.shea-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.shea-header-text p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

#shea-close-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-apple);
}

#shea-close-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

#shea-close-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

/* ------------------------------------------
   MESSAGE CANVAS
   ------------------------------------------ */
#shea-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

#shea-messages::-webkit-scrollbar {
    width: 6px;
}
#shea-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: var(--radius-full);
}

.shea-msg {
    max-width: 88%;
    font-size: 15px;
    line-height: 1.6;
    animation: slide-up var(--duration-base) var(--ease-apple) forwards;
    will-change: transform, opacity;
}

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

.shea-msg.user {
    background: var(--surface-user);
    color: var(--text-inverse);
    align-self: flex-end;
    padding: 14px 20px;
    border-radius: 20px 20px 4px 20px;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.shea-msg.bot {
    color: var(--text-primary);
    align-self: flex-start;
}

/* Plain Text Bot Messages */
.shea-msg.bot > p {
    margin: 0;
    padding: 14px 20px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 20px 20px 20px 4px;
    box-shadow: var(--shadow-sm);
}

/* ------------------------------------------
   LUXURY RECIPE & CONTENT CARDS
   ------------------------------------------ */
.shea-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-md);
    width: 100%;
}

.shea-card h4 {
    margin: 0 0 16px 0;
    font-family: var(--font-head);
    font-size: 22px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.shea-badge-row {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.shea-badge {
    background: rgba(0,0,0,0.04);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(0,0,0,0.02);
}

.shea-badge.highlight {
    background: rgba(253, 200, 106, 0.15);
    color: rgb(180, 120, 20);
}

.shea-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 20px 0;
}

.shea-list-title {
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.shea-card ul, .shea-card ol {
    margin: 0 0 20px 0;
    padding-left: 0;
    list-style: none;
}

.shea-card ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.shea-card ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--brand-blue);
    font-weight: bold;
}

.shea-card ol {
    counter-reset: shea-counter;
}

.shea-card ol li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.shea-card ol li::before {
    counter-increment: shea-counter;
    content: counter(shea-counter) ".";
    position: absolute;
    left: 0;
    color: var(--brand-blue);
    font-weight: 700;
    font-family: var(--font-head);
}

.shea-tip-box {
    background: var(--surface-bot);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    margin: 24px 0;
    border-left: 4px solid var(--brand-yellow);
    display: flex;
    gap: 12px;
}

.shea-tip-icon {
    font-size: 18px;
    line-height: 1;
}

.shea-cta-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: var(--brand-dark);
    color: var(--text-inverse) !important;
    text-decoration: none;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    width: 100%;
    transition: all var(--duration-fast) var(--ease-apple);
    box-shadow: var(--shadow-sm);
}

.shea-cta-btn:hover {
    background: var(--brand-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ------------------------------------------
   INPUT AREA
   ------------------------------------------ */
.shea-input-area {
    padding: 16px 24px 24px;
    background: transparent;
    position: relative;
}

.shea-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration-fast) var(--ease-apple),
                border-color var(--duration-fast) var(--ease-apple);
}

.shea-input-wrapper:focus-within {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(74, 87, 191, 0.15);
}

#shea-input {
    flex: 1;
    padding: 16px 48px 16px 20px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: var(--font-body);
    color: var(--text-primary);
    outline: none;
    resize: none;
    min-height: 52px;
    max-height: 120px;
    line-height: 1.5;
}

#shea-input::placeholder {
    color: var(--text-tertiary);
}

#shea-send {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: var(--brand-blue);
    color: var(--text-inverse);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-apple);
    opacity: 0.5;
    pointer-events: none; /* Disabled until text is typed */
}

#shea-send.active {
    opacity: 1;
    pointer-events: auto;
}

#shea-send.active:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

#shea-send svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    margin-left: 2px;
}

/* ------------------------------------------
   TYPING INDICATOR
   ------------------------------------------ */
.shea-typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 20px 20px 20px 4px;
    width: fit-content;
}

.shea-dot {
    width: 6px;
    height: 6px;
    background: var(--text-tertiary);
    border-radius: var(--radius-full);
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.shea-dot:nth-child(1) { animation-delay: -0.32s; }
.shea-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ------------------------------------------
   RESPONSIVENESS
   ------------------------------------------ */
@media (max-width: 480px) {
    #shea-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    #shea-widget-container {
        bottom: 20px;
        right: 20px;
    }
}
