/* ── RocketDock Frontend ── Mirrors original ai-site-agent approach */

:root {
    --rc-primary: #2563eb;
    --rc-primary-dark: #1d4ed8;
    --rc-chat-color: #2563eb;
    --rc-bg: #ffffff;
    --rc-surface: #f8fafc;
    --rc-border: #e2e8f0;
    --rc-text: #1e293b;
    --rc-radius: 16px;
    --rc-shadow: 0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
}

/* ═══ BAR RESET ═══ */
#rc-bar, #rc-bar *, #rc-bar *::before, #rc-bar *::after {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ═══ BAR BUTTONS ═══ */
.rc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    position: relative;
    flex-shrink: 0;
    transition: transform .15s, filter .15s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0,0,0,.28);
    padding: 0;
    margin: 0;
}
.rc-btn svg { width: 22px; height: 22px; color: #fff; stroke: currentColor; flex-shrink: 0; pointer-events: none; }
.rc-btn:hover  { transform: scale(1.08); filter: brightness(1.1); }
.rc-btn:active { transform: scale(.95); }

.rc-btn::before {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 0;
    border-radius: 0;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
    text-shadow: 0 1px 4px rgba(0,0,0,.7), 0 0px 8px rgba(0,0,0,.5);
}
.rc-btn::after {
    display: none;
}
.rc-btn:hover::before, .rc-btn:hover::after { opacity: 1; }

#rc-bar.rc-d-left-center .rc-btn::before  { bottom:auto; top:50%; transform:translateY(-50%); left:calc(100% + 10px); }
#rc-bar.rc-d-right-center .rc-btn::before { bottom:auto; top:50%; transform:translateY(-50%); left:auto; right:calc(100% + 10px); }
#rc-bar.rc-d-left-center .rc-btn::after,
#rc-bar.rc-d-right-center .rc-btn::after  { display: none; }

/* ═══ AI FLYOUT ═══ */
#rc-ai-wrap { position: relative; }
#rc-ai-flyout {
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%) translateY(6px);
    display: flex; flex-direction: column; gap: 6px; align-items: center;
    pointer-events: none; opacity: 0;
    transition: opacity .2s, transform .2s; z-index: 10;
}
#rc-ai-flyout.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
#rc-bar.rc-d-left-center  #rc-ai-flyout { bottom:auto; left:calc(100% + 8px); top:50%; transform:translateY(-50%) translateX(-6px); flex-direction:row; }
#rc-bar.rc-d-left-center  #rc-ai-flyout.open { transform:translateY(-50%) translateX(0); }
#rc-bar.rc-d-right-center #rc-ai-flyout { bottom:auto; left:auto; right:calc(100% + 8px); top:50%; transform:translateY(-50%) translateX(6px); flex-direction:row; }
#rc-bar.rc-d-right-center #rc-ai-flyout.open { transform:translateY(-50%) translateX(0); }

.rc-ai-sub-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.15);
    cursor: pointer; color: #fff; padding: 0;
    transition: transform .15s, filter .15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.rc-ai-sub-btn svg { width: 18px; height: 18px; pointer-events: none; }
.rc-ai-sub-btn:hover { transform: scale(1.12); filter: brightness(1.15); }
.rc-sub-chatgpt { background: #10a37f; }
.rc-sub-grok    { background: #1a1a2e; }
.rc-sub-claude  { background: #d4762f; }

/* ═══ CHAT PANEL SHELL ═══ */
#rc-chat-panel {
    position: absolute;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 140px);
    background: var(--rc-bg);
    border-radius: var(--rc-radius);
    box-shadow: var(--rc-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99998;
    color: var(--rc-text);
    font-size: 14px;
    line-height: 1.5;
}

.rc-panel-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(.95);
    transition: opacity .3s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
#rc-chat-panel:not(.rc-panel-hidden) {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
    transition: opacity .3s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}

#rc-chat-panel.rc-dp-bottom-center,
#rc-chat-panel.rc-dp-bottom-left,
#rc-chat-panel.rc-dp-bottom-right { bottom: calc(100% + 14px); right: 0; }
#rc-chat-panel.rc-dp-bottom-left  { right: auto; left: 0; }
#rc-chat-panel.rc-dp-bottom-center { right: auto; left: 50%; }
#rc-chat-panel.rc-dp-bottom-center.rc-panel-hidden { transform: translateX(-50%) translateY(20px) scale(.95); }
#rc-chat-panel.rc-dp-bottom-center:not(.rc-panel-hidden) { transform: translateX(-50%) translateY(0) scale(1); }
#rc-chat-panel.rc-dp-left-center  { left: calc(100% + 14px); right:auto; bottom:auto; top:50%; }
#rc-chat-panel.rc-dp-left-center.rc-panel-hidden { transform: translateY(-50%) translateX(-10px) scale(.95); }
#rc-chat-panel.rc-dp-left-center:not(.rc-panel-hidden)  { transform: translateY(-50%) translateX(0) scale(1); }
#rc-chat-panel.rc-dp-right-center { right: calc(100% + 14px); left:auto; bottom:auto; top:50%; }
#rc-chat-panel.rc-dp-right-center.rc-panel-hidden { transform: translateY(-50%) translateX(10px) scale(.95); }
#rc-chat-panel.rc-dp-right-center:not(.rc-panel-hidden) { transform: translateY(-50%) translateX(0) scale(1); }

@media (max-width: 480px) {
    #rc-chat-panel {
        position: fixed !important;
        width: calc(100vw - 16px) !important;
        height: calc(100vh - 100px) !important;
        max-height: calc(100vh - 100px) !important;
        bottom: 88px !important;
        right: 8px !important;
        left: 8px !important;
        border-radius: 12px !important;
        top: auto !important;
        transform: none !important;
    }
    #rc-chat-panel.rc-panel-hidden { opacity: 0 !important; pointer-events: none !important; transform: translateY(20px) !important; }
    #rc-chat-panel:not(.rc-panel-hidden) { opacity: 1 !important; transform: none !important; }
}

/* ═══ HEADER — color:#fff set inline via PHP so it cascades ═══ */
#rc-chat-panel .rc-chat-header {
    /* bg + color set inline */
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#rc-chat-panel .rc-chat-header-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
#rc-chat-panel .rc-chat-header-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
#rc-chat-panel .rc-chat-header-avatar svg { width: 24px; height: 24px; } /* color inherited from header */

#rc-chat-panel .rc-chat-header-info { flex: 1; min-width: 0; }
#rc-chat-panel .rc-chat-header-name { font-weight: 700; font-size: 16px; line-height: 1.2; margin: 0; }
#rc-chat-panel .rc-chat-header-status { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
#rc-chat-panel .rc-chat-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #4ade80;
    display: inline-block; flex-shrink: 0;
}
#rc-chat-panel .rc-chat-status-text { font-size: 12px; opacity: .85; }

#rc-chat-panel .rc-chat-close {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: inherit; /* inherits #fff from header */
    transition: background .15s;
}
#rc-chat-panel .rc-chat-close:hover { background: rgba(255,255,255,.3); }
#rc-chat-panel .rc-chat-close svg { width: 16px; height: 16px; display: block; }

/* ═══ MESSAGES ═══ */
#rc-chat-panel .rc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: var(--rc-bg);
}
#rc-chat-panel .rc-chat-messages::-webkit-scrollbar { width: 5px; }
#rc-chat-panel .rc-chat-messages::-webkit-scrollbar-track { background: transparent; }
#rc-chat-panel .rc-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

#rc-chat-panel .rc-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: rc-fadeIn .3s ease;
}
@keyframes rc-fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

#rc-chat-panel .rc-msg-bot  { align-self: flex-start; }
#rc-chat-panel .rc-msg-user { align-self: flex-end; flex-direction: row-reverse; }

#rc-chat-panel .rc-msg-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #dbeafe;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden;
    margin-top: 2px;
}
#rc-chat-panel .rc-msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
#rc-chat-panel .rc-msg-avatar svg { width: 16px; height: 16px; color: var(--rc-primary); }
#rc-chat-panel .rc-msg-user .rc-msg-avatar { display: none; }

#rc-chat-panel .rc-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--rc-text);
}
#rc-chat-panel .rc-msg-bot .rc-msg-bubble {
    background: var(--rc-surface);
    border: 1px solid var(--rc-border);
    border-bottom-left-radius: 4px;
}
#rc-chat-panel .rc-msg-user .rc-msg-bubble {
    background: var(--rc-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing */
#rc-chat-panel .rc-msg-typing .rc-msg-bubble { background: var(--rc-surface); border: 1px solid var(--rc-border); }
#rc-chat-panel .rc-dots { display: flex; gap: 4px; padding: 4px 0; }
#rc-chat-panel .rc-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: #94a3b8;
    animation: rc-bounce 1.4s infinite;
}
#rc-chat-panel .rc-dots span:nth-child(2) { animation-delay: .2s; }
#rc-chat-panel .rc-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes rc-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* Booking confirm */
#rc-chat-panel .rc-booking-confirm {
    background: #f0fdf4; border: 1px solid #bbf7d0;
    border-radius: 10px; padding: 12px 14px;
    font-size: 13px; color: #15803d;
}
#rc-chat-panel .rc-booking-confirm strong { display: block; font-size: 14px; margin-bottom: 6px; }

/* ═══ CTA BUTTONS ═══ */
#rc-chat-panel .rc-chat-ctas {
    display: flex; flex-direction: column; gap: 8px;
    margin-top: 10px; padding: 0 0 4px;
}
#rc-chat-panel .rc-cta-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    border: none; transition: background .2s, transform .15s;
}
#rc-chat-panel .rc-cta-btn:hover { transform: translateY(-1px); }
#rc-chat-panel .rc-cta-btn svg { width: 14px; height: 14px; }
#rc-chat-panel .rc-cta-contact { background: var(--rc-primary); color: #fff; }
#rc-chat-panel .rc-cta-contact:hover { background: var(--rc-primary-dark); }
#rc-chat-panel .rc-cta-call { background: #16a34a; color: #fff; }
#rc-chat-panel .rc-cta-call:hover { background: #15803d; }

/* Panels that show ctas use a separate container */
#rc-chat-panel #rc-chat-ctas {
    padding: 10px 16px;
    border-top: 1px solid var(--rc-border);
    background: var(--rc-surface);
    flex-shrink: 0;
}

/* ═══ SCHEDULING CHIPS ═══ */
#rc-chat-panel .rc-scheduling-options {
    padding: 8px 16px 12px 54px;
    border-top: 1px solid var(--rc-border);
    background: var(--rc-bg);
    flex-shrink: 0;
}
#rc-chat-panel .rc-scheduling-options-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; margin-bottom: 8px; }
#rc-chat-panel .rc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
#rc-chat-panel .rc-chip {
    display: inline-block; padding: 8px 16px;
    background: var(--rc-bg); color: var(--rc-primary);
    border: 1.5px solid var(--rc-primary); border-radius: 20px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: background .2s, color .2s, transform .15s;
    white-space: nowrap;
}
#rc-chat-panel .rc-chip:hover { background: var(--rc-primary); color: #fff; transform: translateY(-1px); }

/* ═══ INPUT ═══ */
#rc-chat-panel .rc-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--rc-border);
    background: var(--rc-bg);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
#rc-chat-panel #rc-chat-input {
    flex: 1;
    border: 1px solid var(--rc-border);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    line-height: 1.4;
    transition: border-color .2s, box-shadow .2s;
    background: var(--rc-bg);
    color: var(--rc-text);
    box-shadow: none;
    display: block;
    width: auto;
}
#rc-chat-panel #rc-chat-input:focus {
    border-color: var(--rc-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
#rc-chat-panel #rc-chat-input::placeholder { color: #94a3b8; }

#rc-chat-panel #rc-chat-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--rc-primary);
    color: #fff; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .2s, transform .15s;
}
#rc-chat-panel #rc-chat-send:hover { background: var(--rc-primary-dark); transform: scale(1.05); }
#rc-chat-panel #rc-chat-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#rc-chat-panel #rc-chat-send svg { width: 18px; height: 18px; color: #fff; stroke: #fff; display: block; }

/* ═══ FOOTER ═══ */
#rc-chat-panel .rc-chat-footer {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: #94a3b8;
    background: var(--rc-surface);
    border-top: 1px solid var(--rc-border);
    flex-shrink: 0;
}
#rc-chat-panel .rc-chat-footer strong { font-weight: 600; color: #64748b; }
