/* ==========================================================================
   MyTRA Floating Chatbot Widget Styles
   Brand Theme: Deep Navy (#01517A), Crimson Accent (#D81F26), Emerald (#10B981)
   ========================================================================== */

:root {
    --mytra-chat-primary: #01517A;
    --mytra-chat-primary-dark: #003a57;
    --mytra-chat-primary-light: #02669a;
    --mytra-chat-accent: #D81F26;
    --mytra-chat-bg: #FFFFFF;
    --mytra-chat-surface: #FBFCFE;
    --mytra-chat-bubble-bot: #F1F5F9;
    --mytra-chat-text: #0F172A;
    --mytra-chat-text-muted: #64748B;
    --mytra-chat-border: #E2E8F0;
    --mytra-chat-online: #10B981;
    --mytra-chat-shadow: 0 16px 40px -8px rgba(1, 81, 122, 0.28), 0 6px 18px -4px rgba(0, 0, 0, 0.08);
}

/* Floating Trigger Button */
.mytra-chatbot-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mytra-chat-primary) 0%, var(--mytra-chat-primary-light) 100%);
    color: #FFFFFF;
    border: none;
    box-shadow: var(--mytra-chat-shadow);
    cursor: pointer;
    z-index: 1045;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    outline: none;
    padding: 0;
}

.mytra-chatbot-trigger:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 20px 48px -6px rgba(1, 81, 122, 0.38);
    color: #FFFFFF;
}

.mytra-chatbot-trigger:active {
    transform: scale(0.96);
}

.mytra-chatbot-trigger-icon,
.mytra-chatbot-close-icon {
    transition: transform 0.25s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mytra-chatbot-trigger-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mytra-chatbot-trigger:hover .mytra-chatbot-trigger-icon svg {
    transform: scale(1.1);
}

.mytra-chatbot-close-icon {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.mytra-chatbot-close-icon svg {
    width: 22px;
    height: 22px;
}

.mytra-chatbot-trigger.is-open .mytra-chatbot-trigger-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.mytra-chatbot-trigger.is-open .mytra-chatbot-close-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Notification Badge on Trigger (Hidden as requested) */
.mytra-chatbot-badge {
    display: none !important;
}

/* Chatbot Main Window Container */
.mytra-chatbot-window {
    position: fixed;
    bottom: 86px;
    right: 24px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--mytra-chat-bg);
    border-radius: 20px;
    box-shadow: var(--mytra-chat-shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1045;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.25s;
}

.mytra-chatbot-window.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Window Header */
.mytra-chatbot-header {
    background: #FFFFFF;
    color: var(--mytra-chat-text);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--mytra-chat-border);
    position: relative;
    user-select: none;
}

.mytra-chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mytra-chatbot-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    background: #FFFFFF;
    border-radius: 50%;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mytra-chat-border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.mytra-chatbot-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mytra-chatbot-online-dot {
    display: none !important;
}

.mytra-chatbot-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--mytra-chat-text);
    line-height: 1.2;
}

.mytra-chatbot-header-info p {
    margin: 2px 0 0 0;
    font-size: 11.5px;
    color: var(--mytra-chat-text-muted);
}

.mytra-chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mytra-chatbot-hdr-btn {
    background: #F1F5F9;
    border: none;
    color: #64748B;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mytra-chatbot-hdr-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
    transform: scale(1.05);
}

/* Chat Messages Area */
.mytra-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: var(--mytra-chat-surface);
    scroll-behavior: smooth;
}

.mytra-chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.mytra-chatbot-messages::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

/* Message Bubble Rows */
.mytra-chat-row {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    animation: mytraFadeInUp 0.25s ease-out forwards;
}

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

.mytra-chat-row--bot {
    align-self: flex-start;
}

.mytra-chat-row--user {
    align-self: flex-end;
}

.mytra-chat-bubble {
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
}

.mytra-chat-row--bot .mytra-chat-bubble {
    background-color: var(--mytra-chat-bg);
    color: var(--mytra-chat-text);
    border: none;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
}

.mytra-chat-row--user .mytra-chat-bubble {
    background: linear-gradient(135deg, var(--mytra-chat-primary) 0%, var(--mytra-chat-primary-light) 100%);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(1, 81, 122, 0.25);
}

.mytra-chat-time {
    font-size: 10px;
    color: var(--mytra-chat-text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.mytra-chat-row--user .mytra-chat-time {
    text-align: right;
}

/* Bot Text & Markdown Formatting */
.mytra-chat-text-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mytra-chat-line {
    line-height: 1.55;
}

.mytra-chat-heading {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--mytra-chat-primary-dark);
    margin-top: 6px;
    margin-bottom: 2px;
    line-height: 1.4;
}

.mytra-chat-bullet-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-left: 2px;
    margin-top: 2px;
    margin-bottom: 2px;
}

.mytra-chat-bullet-sub {
    margin-left: 18px;
}

.mytra-chat-bullet-dot {
    color: var(--mytra-chat-primary);
    font-size: 16px;
    line-height: 1.25;
    user-select: none;
    flex-shrink: 0;
}

.mytra-chat-numbered-dot {
    color: var(--mytra-chat-primary);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.45;
    user-select: none;
    flex-shrink: 0;
    min-width: 18px;
}

.mytra-chat-bullet-text {
    flex: 1;
    line-height: 1.55;
}

.mytra-chat-text-content a {
    color: var(--mytra-chat-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
    word-break: break-all;
    transition: color 0.15s ease;
}

.mytra-chat-text-content a:hover {
    color: var(--mytra-chat-accent);
}

.mytra-chat-inline-btn {
    display: inline-flex;
    align-items: center;
    background-color: #F0F9FF;
    color: #0369A1 !important;
    border: 1px solid #BAE6FD;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    margin: 2px 0;
    line-height: 1.3;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08);
    width: fit-content;
    vertical-align: middle;
}

.mytra-chat-inline-btn:hover {
    background-color: #E0F2FE;
    border-color: #0284C7;
    color: #075985 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(2, 132, 199, 0.15);
}

.mytra-chat-text-content strong {
    font-weight: 700;
    color: #0F172A;
}

.mytra-chat-inline-code {
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: #0369A1;
}

.mytra-chat-hr {
    border: 0;
    border-top: 1px solid var(--mytra-chat-border);
    margin: 6px 0;
}

/* Quick Questions Chips / Pills */
.mytra-chatbot-quick-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.mytra-chatbot-quick-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--mytra-chat-text-muted);
    margin-bottom: 2px;
}

.mytra-chatbot-quick-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mytra-chat-pill {
    background-color: #FFFFFF;
    color: var(--mytra-chat-primary);
    border: 1px solid #CBD5E1;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    text-align: left;
    user-select: none;
}

.mytra-chat-pill:hover {
    background-color: var(--mytra-chat-primary);
    color: #FFFFFF;
    border-color: var(--mytra-chat-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(1, 81, 122, 0.2);
}

/* Event Recommendation Cards */
.mytra-chat-events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.mytra-chat-event-card {
    background: #FFFFFF;
    border: 1px solid var(--mytra-chat-border);
    border-left: 3px solid var(--mytra-chat-accent);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mytra-chat-event-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.mytra-chat-event-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--mytra-chat-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.mytra-chat-event-meta {
    font-size: 11.5px;
    color: var(--mytra-chat-text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.mytra-chat-event-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mytra-chat-event-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.mytra-chat-event-btn {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s ease;
}

.mytra-chat-event-btn--primary {
    background-color: var(--mytra-chat-accent);
    color: #FFFFFF;
}

.mytra-chat-event-btn--primary:hover {
    background-color: #b5151b;
    color: #FFFFFF;
}

.mytra-chat-event-btn--outline {
    background-color: transparent;
    color: var(--mytra-chat-primary);
    border: 1px solid #CBD5E1;
}

.mytra-chat-event-btn--outline:hover {
    background-color: #F1F5F9;
    color: var(--mytra-chat-primary-dark);
}

/* Contact Official Box */
.mytra-chat-contact-box {
    margin-top: 10px;
    background: #F8FAFC;
    border: 1px solid var(--mytra-chat-border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
}

.mytra-chat-contact-box strong {
    color: var(--mytra-chat-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    font-size: 12.5px;
}

.mytra-chat-contact-desc {
    font-size: 11.5px;
    color: var(--mytra-chat-text-muted);
    margin-bottom: 8px;
}

.mytra-chat-wa-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.mytra-chat-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    max-width: 100%;
    background-color: #FFFFFF;
    color: #1E293B;
    border: 1px solid #CBD5E1;
    font-weight: 600;
    font-size: 12px;
    padding: 5px 11px;
    border-radius: 4px;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}

.mytra-chat-wa-btn .mytra-chat-wa-icon {
    flex-shrink: 0;
}

.mytra-chat-wa-btn:hover {
    background-color: #F8FAFC;
    border-color: #10B981;
    color: #0F172A;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.mytra-chat-location-wrap {
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px dashed #CBD5E1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mytra-chat-location-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--mytra-chat-primary);
    display: flex;
    align-items: center;
}

.mytra-chat-location-address {
    font-size: 11px;
    color: #475569;
    line-height: 1.45;
}

.mytra-chat-maps-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    margin-top: 4px;
    background-color: #FFFFFF;
    color: #0284C7;
    border: 1px solid #BAE6FD;
    font-weight: 600;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.mytra-chat-maps-btn:hover {
    background-color: #F0F9FF;
    border-color: #0284C7;
    color: #0369A1;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(2, 132, 199, 0.15);
}

/* Typing Indicator */
.mytra-chat-typing {
    display: none;
    align-items: center;
    padding: 8px 14px;
    background-color: #FFFFFF;
    border: none;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
    box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
}

.mytra-chat-typing.is-typing {
    display: inline-flex;
}

.mytra-chat-typing-text {
    font-size: 13px;
    font-weight: 500;
    color: #64748B;
    user-select: none;
    letter-spacing: 0.3px;
}

.mytra-typing-dot {
    display: inline-block;
    animation: mytraDotBlink 1.4s infinite;
    opacity: 0;
    font-weight: 600;
}

.mytra-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.mytra-typing-dot:nth-child(2) {
    animation-delay: 0.25s;
}

.mytra-typing-dot:nth-child(3) {
    animation-delay: 0.5s;
}

@keyframes mytraDotBlink {
    0%, 20% { opacity: 0; }
    40%, 80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Chat Input Footer */
.mytra-chatbot-footer {
    padding: 10px 14px 12px;
    background-color: #FFFFFF;
    border-top: 1px solid var(--mytra-chat-border);
}

/* Quick Chat Bar (ShopeeFood / GoFood style) */
.mytra-chatbot-quick-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.mytra-chatbot-quick-bar::-webkit-scrollbar {
    display: none;
}

.mytra-chat-quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--mytra-chat-primary);
    background-color: var(--mytra-chat-surface);
    border: 1px solid #CBD5E1;
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.18s ease;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.mytra-chat-quick-chip:hover {
    background-color: var(--mytra-chat-primary);
    color: #FFFFFF;
    border-color: var(--mytra-chat-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(1, 81, 122, 0.2);
}

.mytra-chat-quick-chip:active {
    transform: scale(0.96);
}

.mytra-chat-quick-chip:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.mytra-chatbot-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--mytra-chat-surface);
    border: 1px solid var(--mytra-chat-border);
    border-radius: 999px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mytra-chatbot-input-form:focus-within {
    border-color: var(--mytra-chat-primary);
    box-shadow: 0 0 0 3px rgba(1, 81, 122, 0.12);
    background-color: #FFFFFF;
}

.mytra-chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13.5px;
    color: var(--mytra-chat-text);
    padding: 6px 0;
}

.mytra-chatbot-input::placeholder {
    color: #94A3B8;
}

.mytra-chatbot-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--mytra-chat-primary);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.18s ease, transform 0.18s ease;
    outline: none;
    flex-shrink: 0;
}

.mytra-chatbot-send-btn:hover:not(:disabled) {
    background-color: var(--mytra-chat-primary-dark);
    transform: scale(1.05);
}

.mytra-chatbot-send-btn:disabled {
    background-color: #CBD5E1;
    cursor: not-allowed;
    transform: none;
}

.mytra-chatbot-notice {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
    .mytra-chatbot-trigger {
        bottom: 16px;
        right: 16px;
        width: 46px;
        height: 46px;
    }

    .mytra-chatbot-trigger-icon svg {
        width: 22px;
        height: 22px;
    }

    .mytra-chatbot-window {
        bottom: 70px;
        right: 16px;
        left: 16px;
        width: auto;
        height: calc(100vh - 100px);
        max-height: 540px;
        border-radius: 16px;
    }

    .mytra-chatbot-header {
        padding: 12px 14px;
    }

    .mytra-chatbot-messages {
        padding: 12px;
        gap: 10px;
    }

    .mytra-chat-row {
        max-width: 92%;
    }
}
