/* ========================================
   Dashbot Widget — Side-Panel Chat 
   ======================================== */

:root {
    --db-primary: #7a003f;
    --db-primary-light: #9c1259;
    --db-primary-dark: #5a002f;
    --db-accent: #623cea;
    --db-panel-width: 25vw;
    --db-panel-min: 340px;
    --db-panel-max: 520px;
    --db-radius: 14px;
    --db-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashbot-avatar {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.dashbot-avatar:hover {
    transform: scale(1.08);
}

.dashbot-avatar.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.avatar-glow {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--db-primary), var(--db-accent), var(--db-primary));
    animation: dashbot-spin 4s linear infinite;
    opacity: 0.7;
}

@keyframes dashbot-spin {
    to { transform: rotate(360deg); }
}

.avatar-inner {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--db-primary), var(--db-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(122, 0, 63, 0.45);
    color: white;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Segoe UI', system-ui, sans-serif;
    text-align: center;
    line-height: 1.1;
}

.avatar-status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #43e97b;
    border: 3px solid white;
    z-index: 1;
}

.avatar-tooltip {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #1a1d27;
    color: #e2e8f0;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Segoe UI', system-ui, sans-serif;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.25s ease;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.avatar-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 22px;
    width: 10px;
    height: 10px;
    background: #1a1d27;
    transform: rotate(45deg);
}

.dashbot-avatar:hover .avatar-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Chat Side Panel ---- */

.dashbot-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--db-panel-width);
    min-width: var(--db-panel-min);
    max-width: var(--db-panel-max);
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform var(--db-transition);
    background: #fff;
    box-shadow: -4px 0 30px rgba(0,0,0,0.12);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.dashbot-panel.open {
    transform: translateX(0);
}

.dashbot-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--db-primary), var(--db-primary-dark));
    flex-shrink: 0;
}

.dashbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashbot-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashbot-header-avatar svg {
    width: 20px;
    height: 20px;
}

.dashbot-header-info h2 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}

.dashbot-header-status {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    gap: 5px;
}

.dashbot-header-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #43e97b;
}

.dashbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashbot-reset-btn {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.dashbot-reset-btn:hover {
    background: rgba(255,255,255,0.25);
}

.dashbot-close-btn {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 18px;
    line-height: 1;
}

.dashbot-close-btn:hover {
    background: rgba(255,255,255,0.25);
}

.dashbot-messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: #f7f8fa;
    scroll-behavior: smooth;
}

.dashbot-messages::-webkit-scrollbar {
    width: 5px;
}
.dashbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.dashbot-messages::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 10px;
}

.dashbot-welcome {
    text-align: center;
    padding: 28px 8px;
}

.dashbot-welcome-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(122,0,63,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.dashbot-welcome h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1d27;
    margin: 0 0 6px;
}

.dashbot-welcome p {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0 0 18px;
}

.dashbot-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dashbot-quick-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: inherit;
}

.dashbot-quick-btn:hover {
    border-color: var(--db-primary);
    background: #fdf2f8;
    transform: translateY(-1px);
}

.dashbot-quick-btn .q-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.dashbot-msg {
    margin-bottom: 14px;
    animation: dashbot-msg-in 0.25s ease;
}

@keyframes dashbot-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dashbot-msg.user {
    display: flex;
    justify-content: flex-end;
}

.dashbot-msg.bot {
    display: flex;
    justify-content: flex-start;
}

.dashbot-bubble {
    max-width: 92%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
    font-size: 13px;
}

.dashbot-msg.user .dashbot-bubble {
    background: linear-gradient(135deg, var(--db-primary), var(--db-accent));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dashbot-msg.bot .dashbot-bubble {
    background: #fff;
    color: #1a1d27;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.dashbot-msg-time {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 4px;
}

.dashbot-msg.user .dashbot-msg-time {
    text-align: right;
    color: rgba(255,255,255,0.5);
}

.dashbot-msg.bot .dashbot-msg-time {
    text-align: left;
}

.dashbot-bubble .db-context-tip {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: #fef3c7;
    color: #92400e;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.4;
    border-left: 3px solid #f59e0b;
}

.dashbot-bubble .db-context-tip::before {
    content: '\26C5';
    flex-shrink: 0;
}

.dashbot-bubble .db-section-header {
    font-weight: 600;
    color: var(--db-primary);
    margin: 10px 0 2px;
    padding: 0;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dashbot-bubble .db-section-header:first-child {
    margin-top: 0;
}

.dashbot-bubble .db-steps-container {
    margin: 6px 0 10px;
    padding: 10px 12px;
    background: #f7f8fa;
    border-radius: 10px;
    border: 1px solid #eef0f4;
}

.dashbot-bubble .db-intro {
    font-size: 13px;
    color: #374151;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef0f4;
    line-height: 1.45;
}

.dashbot-bubble .db-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f3;
}

.dashbot-bubble .db-step:last-of-type {
    border-bottom: none;
}

.dashbot-bubble .db-alt {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eef0f4;
}

.dashbot-bubble .db-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--db-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.dashbot-bubble .db-step-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.45;
    color: #374151;
}

.dashbot-bubble .db-time {
    display: inline-block;
    background: #ede9fe;
    color: #5b21b6;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.dashbot-bubble .db-distance {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.dashbot-bubble .db-parking-highlight {
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.dashbot-bubble .db-bullet {
    position: relative;
    padding: 6px 0 6px 16px;
    border-bottom: 1px solid #f0f0f3;
    line-height: 1.5;
    font-size: 13px;
    color: #374151;
}

.dashbot-bubble .db-bullet:last-child {
    border-bottom: none;
}

.dashbot-bubble .db-bullet::before {
    content: '';
    position: absolute;
    left: 0;
    top: 13px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--db-primary);
}

.dashbot-bubble .db-bullet strong {
    color: #1a1d27;
}

.dashbot-bubble .db-alt-label {
    display: inline-block;
    font-weight: 700;
    color: var(--db-accent);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 2px;
}

.dashbot-bubble .db-total-label {
    font-weight: 700;
    color: var(--db-primary);
}

.dashbot-bubble .db-air {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.dashbot-bubble .db-temp {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.dashbot-bubble .db-count {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.dashbot-bubble .db-para {
    margin: 0 0 6px;
    line-height: 1.55;
    padding: 4px 0;
}
.dashbot-bubble .db-para:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

.dashbot-bubble .db-follow-up {
    margin-top: 10px;
    font-style: italic;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
    font-size: 13px;
}

.dashbot-bubble .db-info-card {
    margin: 6px 0;
    padding: 8px 10px;
    background: #f7f8fa;
    border-radius: 8px;
    border-left: 3px solid var(--db-primary);
}
.dashbot-bubble .parking-spot { font-weight: 600; color: #374151; margin-bottom: 3px; font-size: 13px; }
.dashbot-bubble .free-spaces  { color: #16a34a; font-weight: 600; font-size: 13px; }

.dashbot-bubble .map-link {
    display: inline-block;
    margin: 3px 0;
    padding: 4px 10px;
    background: var(--db-primary);
    color: #fff !important;
    border-radius: 14px;
    text-decoration: none;
    font-size: 11px;
    transition: background 0.2s;
}
.dashbot-bubble .map-link:hover { background: var(--db-primary-light); }

.dashbot-typing {
    display: none;
    padding: 10px 18px;
    align-items: center;
    gap: 10px;
    background: #f7f8fa;
    flex-shrink: 0;
}

.dashbot-typing.show {
    display: flex;
}

.dashbot-typing-dots {
    display: flex;
    gap: 4px;
}

.dashbot-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--db-primary);
    opacity: 0.4;
    animation: dashbot-bounce 1.4s infinite;
}
.dashbot-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.dashbot-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dashbot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.dashbot-typing-text {
    font-size: 12px;
    color: #6b7280;
    transition: opacity 0.2s ease;
    min-width: 180px;
}

/* ---- Input Area ---- */

.dashbot-input-area {
    padding: 14px 18px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.dashbot-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7f8fa;
    border: 1px solid #e5e7eb;
    border-radius: var(--db-radius);
    padding: 4px 4px 4px 14px;
    transition: border-color 0.2s;
}

.dashbot-input-wrap:focus-within {
    border-color: var(--db-primary);
}

.dashbot-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #1a1d27;
    font-size: 14px;
    font-family: inherit;
    padding: 8px 0;
}

.dashbot-input::placeholder {
    color: #9ca3af;
}

/* ---- Location Button ---- */

.dashbot-location-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    color: #6b7280;
    background: #e5e7eb;
}

.dashbot-location-btn:hover {
    transform: scale(1.06);
}

.dashbot-location-btn.location-off {
    background: #e5e7eb;
    color: #6b7280;
}

.dashbot-location-btn.location-loading {
    background: #fbbf24;
    color: #fff;
    animation: dashbot-pulse 1.2s ease-in-out infinite;
}

@keyframes dashbot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
}

.dashbot-location-btn.location-on {
    background: linear-gradient(135deg, var(--db-primary), var(--db-accent));
    color: #fff;
    box-shadow: 0 2px 8px rgba(122, 0, 63, 0.3);
}

.dashbot-location-btn.location-error {
    background: #ef4444;
    color: #fff;
}

/* ---- Location Toast ---- */

.dashbot-location-toast {
    text-align: center;
    padding: 6px 14px;
    margin: 6px auto;
    background: rgba(26, 29, 39, 0.85);
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    width: fit-content;
    animation: dashbot-toast-in 0.25s ease;
    transition: opacity 0.3s;
}

@keyframes dashbot-toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dashbot-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--db-primary), var(--db-accent));
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dashbot-send-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 3px 12px rgba(122,0,63,0.35);
}

.dashbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.dashbot-send-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dashbot-spin-fast 0.7s linear infinite;
}

@keyframes dashbot-spin-fast {
    to { transform: rotate(360deg); }
}

/* ---- Microphone Button ---- */

.dashbot-mic-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dashbot-mic-btn:hover {
    transform: scale(1.06);
}

.dashbot-mic-btn.mic-off {
    background: #e5e7eb;
    color: #6b7280;
}

.dashbot-mic-btn.mic-on {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    animation: dashbot-mic-pulse 1.2s ease-in-out infinite;
}

@keyframes dashbot-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.dashbot-mic-btn.mic-error {
    background: #ef4444;
    color: #fff;
}

/* ---- TTS Toggle Button (header) ---- */

.dashbot-tts-btn {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.dashbot-tts-btn:hover {
    background: rgba(255,255,255,0.25);
}

.dashbot-tts-btn.tts-off {
    opacity: 0.5;
}

.dashbot-tts-btn.tts-on {
    opacity: 1;
    background: rgba(255,255,255,0.25);
    box-shadow: 0 0 6px rgba(255,255,255,0.2);
}

/* ---- Per-message Speaker Button ---- */

.dashbot-msg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.dashbot-speak-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.dashbot-speak-btn:hover {
    color: var(--db-primary);
    background: rgba(122, 0, 63, 0.06);
}

.dashbot-speak-btn.playing {
    color: var(--db-primary);
    animation: dashbot-speak-pulse 1s ease-in-out infinite;
}

@keyframes dashbot-speak-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .dashbot-panel {
        width: 100vw;
        min-width: unset;
        max-width: unset;
    }
}

