﻿/* ========== Chat Panel Layout ========== */

#chat-panel {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 325px;
    height: 475px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: white;
    z-index: 9998;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#chat-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

#chat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    height: 325px;
    overflow-y: auto;
}

#chatMessages {
    display: flex;
    flex-direction: column;
    padding: 10px;
    height: 275px;
    overflow-y: auto;
    background: #f8f9fa;
}

#chat-error {
    min-height: 18px;
    visibility: hidden;
    font-size: 0.85em;
    color: #dc3545; /* Bootstrap danger red */
    margin-top: 4px;
}

/* ========== Chat Header ========== */

.chat-header {
    background: #007bff;
    color: white;
    padding: 10px;
    text-align: center;
}

    .chat-header span {
        float: right;
        cursor: pointer;
    }

/* ========== Chat Input ========== */

.chat-input-container {
    border-top: 1px solid #eee;
    background: #f8f9fa;
    padding: 10px;
}

    .chat-input-container input[type="text"] {
        width: 70%;
    }

    .chat-input-container button {
        width: 25%;
    }

#message {
    flex-grow: 1;
    min-width: 0;
}

#send-button {
    white-space: nowrap;
}

/* ========== Chat Icon Button ========== */

.chat-icon-button {
    background: #0066cc;
    border: none;
    border-radius: 50%;
    padding: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .chat-icon-button:hover {
        background: #004a99;
    }

    .chat-icon-button i {
        font-size: 28px;
    }

/* ========== Typing Indicator ========== */

.typing-indicator {
    display: flex;
    align-items: center;
    margin-left: 10px;
    font-style: italic;
    font-size: 0.9em;
    color: #666;
    gap: 4px;
}

    .typing-indicator .dot {
        width: 5px;
        height: 5px;
        background-color: #888;
        border-radius: 50%;
        animation: blink 1.4s infinite;
    }

        .typing-indicator .dot:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator .dot:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0;
    }

    40% {
        opacity: 1;
    }
}

/* ========== Messages ========== */

.message-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    width: 100%;
}

    .message-wrapper.local {
        align-items: flex-end;
    }

    .message-wrapper.remote {
        align-items: flex-start;
    }

    .message-wrapper.local .message-bubble {
        background-color: #007aff; /* iMessage blue */
        color: white;
    }

    .message-wrapper.remote .message-bubble {
        background-color: #e5e5ea; /* iMessage gray */
        color: black;
    }

    .message-wrapper .timestamp {
        font-size: 0.75rem;
        color: #888;
        margin-bottom: 4px;
        text-align: center;
        width: 100%;
    }

    .message-wrapper .message-bubble {
        padding: 10px 14px;
        font-size: 1rem;
        line-height: 1.25em;
        border-radius: 20px;
        max-width: 90%;
        word-wrap: break-word;
/*        white-space: pre-wrap;
*/        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
        font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    }

/* Bubble text defaults */
.message-bubble {
    line-height: 1.3;
    font-size: 0.95rem;
}

    .message-bubble a {
        color: #007bff;
        text-decoration: underline;
    }

    /* Tighten lists in chat bubbles */
    .message-bubble ol,
    .message-bubble ul {
        margin: 1.25rem 0;
/*        margin: -1.75rem 0;
*/ padding-left: 1.25rem;
    }

    .message-bubble li {
        margin: 0.125rem 0;
    }

        .message-bubble li p {
            margin: 0;
        }

    .message-bubble > p {
        margin: 0.2rem 0;
    }

        .message-bubble > p:first-child {
            margin-top: 0;
        }

        .message-bubble > p:last-child {
            margin-bottom: 0;
        }

/* ========== Utility ========== */

.ds-booking-json {
    display: none !important;
}
