/* ============================================================
   Temer Premium Property Chatbot — Professional CSS v3.0
   ============================================================ */

/* ── Global Reset (scoped to chatbot) ──────────────────────── */
.temer-property-chatbot-container,
.temer-property-chatbot-container * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Chat Launch Button ──────────────────────────────────────── */

.temer-chat-button {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, #84A441 0%, #6b8a33 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(132, 164, 65, 0.5);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    z-index: 999999;
    pointer-events: all;
    border: none;
    outline: none;
}

.temer-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(132, 164, 65, 0.6);
}

.temer-chat-button .chat-icon {
    font-size: 26px;
    color: white;
    line-height: 1;
    display: block;
}

/* ── Chatbot CTA Bubble ──────────────────────────────────────── */
.temer-chat-cta {
    position: fixed;
    bottom: 105px;
    right: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 999998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 310px;
    max-width: calc(100vw - 30px);
    animation: bounceCta 2.5s infinite ease-in-out;
}

@keyframes bounceCta {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.temer-chat-cta::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 42px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

.cta-message {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    color: #1e293b;
    text-align: center;
}

.cta-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.cta-actions button {
    background: #84A441;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.cta-actions button:hover {
    background: #6b8a33;
    transform: scale(1.05);
}

/* ── Chat Window Container ───────────────────────────────────── */
.chat-container {
    position: fixed;
    bottom: 106px;
    right: 28px;
    width: 370px;
    max-width: calc(100vw - 20px);
    max-height: 540px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    display: none;
    flex-direction: column;
    z-index: 999998;
    overflow: hidden; /* clips children, prevents scroll bleed */
}

/* When JS sets display:flex, enforce column */
.chat-container[style*="flex"] {
    flex-direction: column !important;
}

/* ── Chat Header ─────────────────────────────────────────────── */
.chat-header {
    background: linear-gradient(135deg, #84A441 0%, #6b8a33 100%);
    color: white;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}

.chat-header-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.chat-header-left > span {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header .status {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.92;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    animation: statusPulse 2s ease infinite;
    flex-shrink: 0;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 10px;
}

.chat-close-btn {
    background: rgba(255,255,255,0.18);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.chat-close-btn:hover {
    background: rgba(255,255,255,0.32);
}

/* End-support button inside header */
.end-support-header-btn {
    background: rgba(239, 68, 68, 0.22);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.end-support-header-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* ── Chat Messages Area ──────────────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* ← PREVENTS HORIZONTAL SCROLL */
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

/* ── Message Groups ──────────────────────────────────────────── */
.message-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

.message-group.bot-group   { align-items: flex-start; }
.message-group.user-group  { align-items: flex-end; }
.message-group.agent-group { align-items: flex-start; }

/* ── Bubbles ─────────────────────────────────────────────────── */
.message {
    max-width: 78%;
    min-width: 0;
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    animation: bubbleIn 0.25s ease;
}

.bot-message {
    background: #f1f5f9;
    color: #1e293b;
    border-top-left-radius: 4px;
}

.user-message {
    background: linear-gradient(135deg, #84A441 0%, #6b8a33 100%);
    color: white;
    border-top-right-radius: 4px;
}

.agent-message {
    max-width: 78%;
    min-width: 0;
    padding: 11px 15px;
    border-radius: 14px;
    border-top-left-radius: 4px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    color: #1e293b;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    animation: bubbleIn 0.25s ease;
}

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

/* ── Option Buttons ──────────────────────────────────────────── */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
    max-width: 100%;
    animation: bubbleIn 0.25s ease;
}

.option-button {
    background: #ffffff;
    border: 1.5px solid #84A441;
    color: #5a7528;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
    width: 100%;
}

.option-button:hover:not(:disabled) {
    background: #84A441;
    color: white;
    transform: translateX(2px);
}

.option-button:disabled {
    cursor: not-allowed;
}

/* ── Typing Indicator ────────────────────────────────────────── */
.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 11px 14px;
    background: #f1f5f9;
    border-radius: 14px;
    border-top-left-radius: 4px;
    width: fit-content;
    animation: bubbleIn 0.25s ease;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s ease infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-5px); }
}

/* ── Hidden Utility ──────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Chat Input Container ────────────────────────────────────── */
.chat-input-container {
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: #ffffff;
    position: relative;
}

.chat-input-field {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 22px;
    font-size: 0.9rem;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input-field:focus {
    border-color: #84A441;
    background: #ffffff;
}

.send-button {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #84A441 0%, #6b8a33 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: white;
}

.send-button:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(132,164,65,0.4);
}

.send-button svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* ── Live Support Footer ─────────────────────────────────────── */
.chat-support-footer {
    text-align: center;
    padding: 9px 12px;
    background: #fff5f5;
    border-top: 1px solid #fee2e2;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-support-footer:hover {
    background: #fee2e2;
}

.end-support-link {
    color: #dc2626;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────
   📱 PHONE WIDGET — Professional Redesign
   ───────────────────────────────────────────────────────────── */
.phone-widget {
    width: 100%;
    max-width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Row: flag picker + number input + confirm btn */
.phone-row-container,
.phone-widget-row {
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden; /* clips children cleanly */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 100%;
}

.phone-row-container:focus-within,
.phone-widget-row:focus-within,
.phone-row-container.active,
.phone-widget-row.active {
    border-color: #84A441;
    box-shadow: 0 0 0 3px rgba(132, 164, 65, 0.15);
}

/* Country picker button */
.country-picker-btn {
    background: #f8fafc;
    border: none;
    border-right: 1.5px solid #e2e8f0;
    padding: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    transition: background 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
    height: 44px;
}

.country-picker-btn:hover {
    background: #f1f5f9;
}

.country-picker-btn .picker-code {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

.arrow-indicator {
    font-size: 0.55rem;
    color: #94a3b8;
    flex-shrink: 0;
}

/* Phone number input */
.phone-number-box {
    flex: 1;
    min-width: 0;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 10px !important;
    font-size: 0.92rem !important;
    color: #1e293b !important;
    box-shadow: none !important;
    height: 44px;
}

.phone-number-box::placeholder {
    color: #94a3b8;
}

/* Confirm checkmark button */
.phone-confirm-btn {
    background: #84A441;
    border: none;
    border-left: none;
    width: 44px;
    height: 44px;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
    padding: 0;
}

.phone-confirm-btn:hover {
    background: #6b8a33;
}

.phone-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Country Dropdown Panel ──────────────────────────────── */
.country-dropdown-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #84A441;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    z-index: 99999;
    max-height: 200px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.country-search-box {
    padding: 9px 12px;
    border: none;
    border-bottom: 1.5px solid #e2e8f0;
    font-size: 0.87rem;
    outline: none;
    color: #1e293b;
    background: #f8fafc;
    flex-shrink: 0;
    width: 100%;
}

.country-search-box::placeholder {
    color: #94a3b8;
}

.country-list {
    overflow-y: auto;
    flex: 1;
}

.country-list::-webkit-scrollbar {
    width: 4px;
}
.country-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.country-item {
    padding: 9px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.87rem;
    color: #334155;
    transition: background 0.12s ease;
    white-space: nowrap;
    overflow: hidden;
}

.country-item:hover {
    background: #f0f7e6;
    color: #5a7528;
}

.country-name-txt {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.country-code-txt {
    font-weight: 600;
    color: #84A441;
    font-size: 0.82rem;
    flex-shrink: 0;
}

/* Flag images */
.btn-flag-img,
img[alt] {
    border-radius: 2px;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
    object-fit: cover;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .chat-container {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 96px;
        max-height: 500px;
    }

    .temer-chat-button {
        bottom: 18px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 12px);
        right: 6px;
        bottom: 86px;
        border-radius: 16px;
        max-height: 90vh;
    }

    .chat-header {
        padding: 13px 14px;
        border-radius: 16px 16px 0 0;
    }

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

    .message, .agent-message {
        font-size: 0.87rem;
        padding: 9px 13px;
    }

    .option-button {
        font-size: 0.84rem;
        padding: 9px 12px;
    }

    .temer-chat-button {
        width: 52px;
        height: 52px;
        bottom: 14px;
        right: 12px;
    }

    .country-picker-btn {
        min-width: 72px;
        padding: 0 8px;
    }
}

@media (max-width: 360px) {
    .chat-container {
        width: 100vw;
        right: 0;
        border-radius: 12px 12px 0 0;
        bottom: 70px;
    }
}