/* ════════════════════════════════════════════
   Olo Chat Widget — Olorun Group
   Premium glassmorphism chat with dark theme
   ════════════════════════════════════════════ */

:root {
    --olo-primary: #6366f1;
    --olo-primary-hover: #818cf8;
    --olo-bg-dark: #0f0f23;
    --olo-bg-card: rgba(15, 15, 35, 0.92);
    --olo-bg-glass: rgba(255, 255, 255, 0.05);
    --olo-border: rgba(99, 102, 241, 0.2);
    --olo-text: #e2e8f0;
    --olo-text-muted: #94a3b8;
    --olo-success: #10b981;
    --olo-warning: #f59e0b;
    --olo-bubble-user: linear-gradient(135deg, #6366f1, #8b5cf6);
    --olo-bubble-bot: rgba(30, 30, 60, 0.8);
    --olo-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    --olo-radius: 16px;
    --olo-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ── */
#olo-chat-widget, #olo-chat-widget * {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: var(--olo-font);
}

/* ── FAB Button ── */
#olo-chat-fab {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--olo-bubble-user);
    border: none;
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: olo-pulse 2s infinite;
}

#olo-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.6);
}

#olo-chat-fab svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}

#olo-chat-fab.olo-open svg {
    transform: rotate(180deg);
}

@keyframes olo-pulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 8px 32px rgba(99, 102, 241, 0.7), 0 0 0 12px rgba(99, 102, 241, 0.1); }
}

/* ── Notification Badge ── */
#olo-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    animation: olo-bounce 0.5s ease;
}

@keyframes olo-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ── Chat Container ── */
#olo-chat-container {
    position: fixed;
    bottom: 166px;
    right: 24px;
    width: 400px;
    max-height: 600px;
    height: 70vh;
    background: var(--olo-bg-card);
    border: 1px solid var(--olo-border);
    border-radius: var(--olo-radius);
    box-shadow: var(--olo-shadow);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#olo-chat-container.olo-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ── */
#olo-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border-bottom: 1px solid var(--olo-border);
    flex-shrink: 0;
}

#olo-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--olo-bubble-user);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: white;
    position: relative;
    flex-shrink: 0;
}

#olo-chat-avatar::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: var(--olo-success);
    border-radius: 50%;
    border: 2px solid var(--olo-bg-card);
}

#olo-chat-header-info {
    flex: 1;
    min-width: 0;
}

#olo-chat-header-info h3 {
    color: white;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

#olo-chat-header-info p {
    color: var(--olo-success);
    font-size: 12px;
    margin: 2px 0 0;
}

#olo-chat-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--olo-text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
}

#olo-chat-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* ── Messages Area ── */
#olo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

#olo-chat-messages::-webkit-scrollbar {
    width: 4px;
}
#olo-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
#olo-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
}

/* ── Message Bubbles ── */
.olo-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: olo-fadeIn 0.3s ease;
}

@keyframes olo-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.olo-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.olo-msg-bot {
    align-self: flex-start;
}

.olo-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* HTML content in bubbles needs normal whitespace */
.olo-msg-bubble.olo-html {
    white-space: normal;
}
.olo-msg-bubble.olo-html h3,
.olo-msg-bubble.olo-html h4 {
    font-size: 15px;
    font-weight: 700;
    color: white;
    margin: 10px 0 6px;
}
.olo-msg-bubble.olo-html h3:first-child,
.olo-msg-bubble.olo-html h4:first-child {
    margin-top: 0;
}
.olo-msg-bubble.olo-html p {
    margin: 6px 0;
}
.olo-msg-bubble.olo-html ul,
.olo-msg-bubble.olo-html ol {
    margin: 6px 0;
    padding-left: 20px;
}
.olo-msg-bubble.olo-html li {
    margin: 3px 0;
}
.olo-msg-bubble.olo-html blockquote {
    border-left: 3px solid var(--olo-primary);
    margin: 8px 0;
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 0 8px 8px 0;
    font-size: 13px;
}
.olo-msg-bubble.olo-html table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}
.olo-msg-bubble.olo-html th,
.olo-msg-bubble.olo-html td {
    padding: 6px 8px;
    border: 1px solid var(--olo-border);
    text-align: left;
}
.olo-msg-bubble.olo-html th {
    background: rgba(99, 102, 241, 0.15);
    font-weight: 600;
    color: white;
}
.olo-msg-bubble.olo-html a {
    color: var(--olo-primary-hover);
    text-decoration: underline;
}

.olo-msg-user .olo-msg-bubble {
    background: var(--olo-bubble-user);
    color: white;
    border-bottom-right-radius: 4px;
}

.olo-msg-bot .olo-msg-bubble {
    background: var(--olo-bubble-bot);
    color: var(--olo-text);
    border: 1px solid var(--olo-border);
    border-bottom-left-radius: 4px;
}

.olo-msg-bot .olo-msg-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--olo-bubble-user);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    margin-top: 4px;
}

.olo-msg-time {
    font-size: 10px;
    color: var(--olo-text-muted);
    margin-top: 4px;
    text-align: right;
}

/* ── Typing Indicator ── */
.olo-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-items: center;
}

.olo-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--olo-primary);
    animation: olo-typing 1.4s infinite ease-in-out;
}

.olo-typing span:nth-child(2) { animation-delay: 0.2s; }
.olo-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes olo-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick Actions ── */
.olo-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 8px;
}

.olo-quick-btn {
    padding: 6px 14px;
    border: 1px solid var(--olo-border);
    background: var(--olo-bg-glass);
    color: var(--olo-primary-hover);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.olo-quick-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--olo-primary);
}

/* ── Input Area ── */
#olo-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--olo-border);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

#olo-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--olo-border);
    background: var(--olo-bg-glass);
    color: var(--olo-text);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 80px;
    min-height: 40px;
    font-family: var(--olo-font);
}

#olo-chat-input::placeholder {
    color: var(--olo-text-muted);
}

#olo-chat-input:focus {
    border-color: var(--olo-primary);
}

#olo-chat-send {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--olo-bubble-user);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#olo-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

#olo-chat-send:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

#olo-chat-send svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* ── Lead/Ticket Forms ── */
.olo-form-card {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--olo-border);
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
}

.olo-form-card h4 {
    color: white;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.olo-form-card input,
.olo-form-card textarea {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--olo-border);
    background: var(--olo-bg-glass);
    color: var(--olo-text);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    font-family: var(--olo-font);
}

.olo-form-card input:focus,
.olo-form-card textarea:focus {
    border-color: var(--olo-primary);
}

.olo-form-card textarea {
    min-height: 60px;
    resize: vertical;
}

.olo-form-card button {
    width: 100%;
    padding: 10px;
    background: var(--olo-bubble-user);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.olo-form-card button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ── Powered by ── */
#olo-chat-footer {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: var(--olo-text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

#olo-chat-footer a {
    color: var(--olo-primary-hover);
    text-decoration: none;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    #olo-chat-container {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 80px;
        max-height: calc(100vh - 100px);
        height: calc(100vh - 100px);
        border-radius: 12px;
    }

    #olo-chat-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
}

/* ── Google Font Import ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
