/* Updated Close (X) Button Style */
#chat-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #555;
    cursor: pointer; /* Changes cursor to a hand when hovering */
    transition: color 0.3s ease;
}

#chat-close-btn:hover {
    color: #000; /* Makes the button more visible on hover */
}

/* Font and base setup */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    font-family: "Segoe UI", Roboto, sans-serif;
    z-index: 9999;
}

/* Elegant Font */
.chat-open-text {
    font-family: "Poppins", "Cairo", "Segoe UI", sans-serif;
    font-weight: 600;
    flex: 1;
    margin: 0 10px;
    font-size: 18px;
    color: #333;
    text-align: center;
}

/* Main Open Bar */
#chat-open-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 290px;
    background-color: #ffffff;
    color: #e3342f;
    padding: 10px 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Logo */
#chat-open-bar img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

/* Icon Wrapper */
.chat-icon-wrapper {
    background-color: #e3342f;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

/* Icon Itself */
.chat-open-icon {
    transition: transform 0.3s ease;
}

/* Hover Animation */
#chat-open-bar:hover .chat-icon-wrapper {
    background-color: #e3342f;
    transform: scale(1.1);
}

#chat-open-bar:hover .chat-open-icon {
    transform: rotate(20deg) scale(1.1);
}

.chat-open-btn {
    background-color: #e3342f;
    color: white;
    font-size: 18px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-open-btn:hover {
    background-color: #e3342f;
}

#chat-container {
    font-family: "Poppins", "Cairo", "Segoe UI", sans-serif;
    font-weight: 400;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 630px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10000;
    overflow: visible;
}

#chat-container.open {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    visibility: visible; /* ✅ Make visible during open */
}

/* Header */
#chat-header {
    background-color: #f3f3f3;
    color: #111;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 15px;
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid #ddd;
    gap: 10px; /* Adds space between items */
}

#chat-header span {
    font-size: 18px;
    font-weight: 600;
    color: #000000;
    font-family: "Poppins", sans-serif;
    letter-spacing: 0.5px;
    text-align: center; /* Centers the text */
}

#chat-logo {
    height: 28px;
    width: 28px;
    object-fit: contain; /* Ensures the logo fits within the dimensions */
    margin-right: 8px; /* Adds space between the logo and the text */
}

/* Body */
#chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 300px;
}

/* Messages */
.user-message,
.bot-message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    animation: fadeIn 0.4s ease-in;
    font-family: "Poppins", "Cairo", "Segoe UI", sans-serif;
    font-weight: 400;
    position: relative;
}

/* User messages (aligned right) */
.user-message {
    align-self: flex-end;
    background-color: #e7f3ff;
    color: #0a0a0a;
    border-bottom-right-radius: 0;
    text-align: right;
}

/* Bot messages (aligned left) */
.bot-message {
    align-self: flex-start;
    background-color: #f2f2f2;
    color: #333;
    border-bottom-left-radius: 0;
    text-align: left;
}

.bot-message strong {
    color: #e3342f; /* Blue color for important information */
}

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

#chat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-family: "Cairo", "Poppins", "Segoe UI", sans-serif;
    font-weight: 600;
    border: 1px solid #ccc;
    border-radius: 999px; /* Makes it look like an input */
    outline: none;
    resize: none; /* Prevents manual resize */
    line-height: 1.5;
    background-color: #fff;
    color: #333;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow-y: auto;
    max-height: 120px; /* Optional: cap growth */
    min-height: 40px; /* Matches input height */
}

#user-input:focus {
    border-color: #e3342f;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15); /* Blue glow effect */
}

#user-input::placeholder {
    color: #aaa;
    opacity: 1;
    transition: opacity 0.2s ease;
}

#user-input:focus::placeholder {
    opacity: 0.4;
}

#user-input::-webkit-scrollbar {
    width: 6px;
}
#user-input::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

#send-btn {
    background-color: #e3342f;
    color: white;
    border: none;
    border-radius: 12px; /* Slightly rounded rectangle for better layout */
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    margin-left: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#send-btn:hover {
    background-color: #c62828;
}

#whatsapp-btn img {
    height: 18px;
    width: 18px;
    object-fit: contain;
}

/* Typing animation */
.typing {
    display: flex;
    gap: 4px;
    padding: 10px;
    background-color: #e6e6e6;
    border-radius: 10px;
    max-width: 80%;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #888;
    border-radius: 50%;
    animation: typingAnim 1s infinite;
}

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

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

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

/* Branding */
#chat-branding {
    text-align: center;
    font-size: 11px;
    color: #888;
    padding: 6px;
    border-top: 1px solid #eee;
    background-color: #fafafa;
    border-radius: 0 0 16px 16px;
}

/* Contact info styling */
.contact-info {
    background-color: #f1f1f1;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
}

.contact-info strong {
    color: #e3342f; /* Blue color for key contact details */
}

.contact-info p {
    margin-bottom: 5px;
    color: #333;
}

.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 10px; /* Space between buttons */
    margin-top: 12px;
    padding-right: 5px;
    max-width: 100%; /* Prevent overflowing the chat container */
    box-sizing: border-box; /* Ensure padding is included in the width */
}

.suggestion-btn {
    background-color: #eee;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 14px;
    font-family: "Cairo", "Poppins", "Segoe UI", sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 90%; /* Prevent the button from overflowing its container */
}

.suggestion-btn:hover {
    background-color: #ddd;
}

.message-timestamp {
    font-size: 0.75em;
    color: #888;
    margin-top: 4px;
}

/* Timestamp styling */
.timestamp {
    display: block;
    font-size: 0.75em;
    color: #888;
    margin-top: 6px;
}

.user-message .timestamp {
    text-align: right;
}

.bot-message .timestamp {
    text-align: left;
}

#chat-popup-message {
    position: fixed;
    bottom: 100px;
    right: 40px;
    background-color: #e3342f;
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-family: "Cairo", "Poppins", sans-serif;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    animation: fadeSlideIn 0.5s ease forwards;
    z-index: 10001;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.3s ease;
}

#chat-popup-message:hover {
    background-color: #c62828;
}

#chat-popup-message #dismiss-popup {
    font-size: 20px;
    cursor: pointer;
    padding: 0 8px;
    font-weight: bold;
    transition: color 0.3s ease;
}

#chat-popup-message #dismiss-popup:hover {
    color: #ffd6d6;
}

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

/* 🎙️ Mic Button Styling */
#mic-btn {
    background-color: #e3342f;
    border: none;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    cursor: pointer;
}

#mic-btn img {
    width: 20px;
    height: 20px;
}

#mic-btn:hover {
    background-color: #c62828;
}

/* 🎛 Voice Recording Widget */
#voice-recording-widget {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 16px;
    margin: 10px;
    background-color: #fff4f4;
    border: 1px solid #e3342f;
    border-radius: 12px;
    font-family: "Cairo", "Poppins", sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #e3342f;
}

/* 🔴 Recording Indicator */
#recording-indicator {
    font-weight: bold;
    color: #e3342f;
}

/* ⏱ Timer */
#recording-timer {
    font-family: monospace;
    font-size: 14px;
    color: #333;
}

/* ⏹ Stop Button */
#stop-recording-btn {
    background-color: #e3342f;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#stop-recording-btn:hover {
    background-color: #c62828;
}

/* Voice‑message bubble */
.voice-message {
    max-width: 80%;
    padding: 6px 8px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.user-message.voice-message {
    align-self: flex-end;
    background: #dcf8c6;
}
.bot-message.voice-message {
    align-self: flex-start;
    background: #f1f0f0;
}
.voice-message audio {
    width: 100%;
    outline: none;
}

/* Duration text shown under the player */
.voice-message .duration {
    font-size: 12px;
    color: #555;
}

/* Universal timestamp (text + voice) */
.timestamp {
    font-size: 12px;
    color: #666;
}

/* Ensure Chromium gets the full-width audio bar */
.voice-message audio {
    /* any value ≥ 260 px keeps the full controller visible */
    min-width: 260px;
    width: 100%;
    height: 40px; /* optional: guarantees tall enough bar */
}

@media (min-width: 350px) {
    .voice-message audio {
        min-width: 260px;
        height: 40px;
    }
}

/* 🏠 Property Carousel (Improved) */
.property-carousel {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 16px 0 8px;
    margin-top: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.property-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.property-card {
    flex-shrink: 0;
    width: 220px;
    background: white;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.property-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.property-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.property-info {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.property-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.property-price {
    font-size: 14px;
    font-weight: 500;
    color: #e3342f;
}

/* Responsive tweak */
@media (max-width: 480px) {
    .property-card {
        width: 180px;
    }

    .property-title {
        font-size: 14px;
    }

    .property-price {
        font-size: 13px;
    }
}

/* 🧩 Wider layout for carousel-style bot messages */
.bot-message.carousel-message {
    max-width: 95%;
    background-color: #f2f2f2;
    border-radius: 16px;
    border-bottom-left-radius: 0;
    padding: 10px;
}

.bot-message.carousel-message .property-carousel {
    padding: 8px 4px 4px;
}

/* Mandatory Fullscreen Form Styles */
#chat-info-form {
    font-weight: 400;
    position: fixed;
    bottom: 20px;
    right: 0px;
    width: 450px;
    height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-family: "Poppins", "Cairo", sans-serif;
}

#chat-info-form:not([hidden]) {
    display: flex; /* flexbox layout only when visible */
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Header text */
#chat-info-form .form-header {
    font-weight: bold;
    font-size: 22px;
    margin-bottom: 15px;
    text-align: center;
}

/* Description text */
#chat-info-form p {
    margin-bottom: 25px;
    text-align: center;
    font-size: 15px;
}

/* Form itself */
#chat-info-form form {
    width: 90%;
    max-width: 350px; /* keeps it neat */
    display: flex;
    flex-direction: column;
}

/* Input fields */
#chat-info-form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0 6px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

#chat-info-form input:focus {
    border-color: #d32f2f;
    box-shadow: 0 0 3px rgba(211, 47, 47, 0.4);
}

/* Error messages */
.error-message {
    color: #d32f2f;
    font-size: 12px;
    margin-bottom: 10px;
    display: none;
}

/* Submit button */
#chat-info-form button[type="submit"] {
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 14px;
    width: 100%;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 12px;
}

#chat-info-form button[type="submit"]:hover {
    background-color: #b71c1c;
}

/* Ensure close button never shows */
#close-info-form {
    display: none !important;
}
