/**
 * Workshop AI Chat Panel - v2026-01-30a
 * Side-tab trigger + slide-in chat panel for workshop microsites
 */

/* ============================================
   SIDE TAB TRIGGER
   ============================================ */
.workshop-chat-trigger {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    background: #1A1A1A;
    color: white;
    border: none;
    padding: 16px 10px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    z-index: 9998;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.2s;
}

.workshop-chat-trigger:hover {
    background: #333;
}

.workshop-chat-trigger svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.workshop-chat-trigger.hidden {
    transform: translateY(-50%) translateX(100%);
    pointer-events: none;
}

/* ============================================
   PANEL CONTAINER
   ============================================ */
.workshop-chat-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.workshop-chat-panel.open {
    pointer-events: auto;
    opacity: 1;
}

/* Overlay */
.workshop-chat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

/* Panel Content */
.workshop-chat-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 70%;
    max-width: 900px;
    min-width: 380px;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

.workshop-chat-panel.open .workshop-chat-content {
    transform: translateX(0);
}

/* ============================================
   HEADER
   ============================================ */
.workshop-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #E5E7EB);
    background: #fff;
    flex-shrink: 0;
}

.workshop-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1A1A1A);
}

.workshop-chat-title svg {
    color: var(--primary, #9810FA);
    width: 20px;
    height: 20px;
}

.workshop-chat-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    transition: background 0.15s;
}

.workshop-chat-close:hover {
    background: #F3F4F6;
}

/* ============================================
   MESSAGES AREA
   ============================================ */
.workshop-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome message */
.workshop-chat-welcome {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary, #666);
    font-size: 14px;
    line-height: 1.5;
}

.workshop-chat-welcome strong {
    display: block;
    color: var(--text-primary, #1A1A1A);
    font-size: 15px;
    margin-bottom: 4px;
}

/* Message bubble */
.workshop-chat-msg {
    display: flex;
    gap: 8px;
    max-width: 100%;
}

.workshop-chat-msg.user {
    flex-direction: row-reverse;
}

.workshop-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
}

.workshop-chat-msg.assistant .workshop-chat-msg-avatar {
    background: var(--primary, #9810FA);
    color: white;
}

.workshop-chat-msg.user .workshop-chat-msg-avatar {
    background: var(--primary, #9810FA);
    color: white;
}

.workshop-chat-msg-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    max-width: calc(100% - 44px);
    word-wrap: break-word;
}

.workshop-chat-msg.assistant .workshop-chat-msg-content {
    background: #F3F4F6;
    color: var(--text-primary, #1A1A1A);
    border-bottom-left-radius: 4px;
}

.workshop-chat-msg.user .workshop-chat-msg-content {
    background: var(--primary, #9810FA);
    color: white;
    border-bottom-right-radius: 4px;
}

.workshop-chat-msg-content strong {
    font-weight: 600;
}

.workshop-chat-msg-content ul {
    margin: 6px 0;
    padding-left: 18px;
}

.workshop-chat-msg-content li {
    margin: 3px 0;
}

/* ============================================
   QUICK ACTION PILLS
   ============================================ */
.workshop-chat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border, #E5E7EB);
    flex-shrink: 0;
    background: #fff;
}

.workshop-chat-pills:empty {
    display: none;
}

.workshop-chat-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid var(--border, #E5E7EB);
    background: #fff;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #666);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s;
}

.workshop-chat-pill:hover {
    border-color: var(--primary, #9810FA);
    color: var(--primary, #9810FA);
    background: rgba(152, 16, 250, 0.05);
}

/* ============================================
   INPUT AREA
   ============================================ */
.workshop-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border, #E5E7EB);
    background: #fff;
    flex-shrink: 0;
}

.workshop-chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 100px;
    transition: border-color 0.15s;
}

.workshop-chat-input-area textarea:focus {
    border-color: var(--primary, #9810FA);
}

.workshop-chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: var(--primary, #9810FA);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}

.workshop-chat-send-btn:hover:not(:disabled) {
    background: var(--primary-dark, #7A0DC8);
    transform: scale(1.05);
}

.workshop-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   LOADING DOTS
   ============================================ */
.workshop-chat-loading-dots {
    display: flex;
    gap: 4px;
}

.workshop-chat-loading-dots span {
    width: 7px;
    height: 7px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: workshopChatBounce 1.4s infinite ease-in-out both;
}

.workshop-chat-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.workshop-chat-loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes workshopChatBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ============================================
   EMAIL PROMPT (when user hasn't provided email)
   ============================================ */
.workshop-chat-email-prompt {
    padding: 24px 16px;
    text-align: center;
}

.workshop-chat-email-prompt p {
    font-size: 14px;
    color: var(--text-secondary, #666);
    margin-bottom: 12px;
}

.workshop-chat-email-form {
    display: flex;
    gap: 8px;
}

.workshop-chat-email-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.workshop-chat-email-form input:focus {
    border-color: var(--primary, #9810FA);
}

.workshop-chat-email-form button {
    padding: 10px 16px;
    background: var(--primary, #9810FA);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.workshop-chat-email-form button:hover {
    background: var(--primary-dark, #7A0DC8);
}

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 640px) {
    .workshop-chat-content {
        width: 100%;
        min-width: unset;
    }

    .workshop-chat-trigger {
        padding: 12px 8px;
        font-size: 13px;
    }

    .workshop-chat-pills {
        padding: 8px 12px;
    }
}
