/* Styles for contact-us.html */
.contact-chat-page-container {
    margin-top: 72px;
    /* Adjust for fixed header */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 72px);
    /* Full height minus header */
    padding: 40px 20px;
    box-sizing: border-box;
    background: transparent;
    /* Let the page background image show through */
}

.contact-chat-box {
    background-color: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
    width: 100%;
    max-width: 800px;
    height: calc(100vh - 160px);
    /* Adjust based on header and padding */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Pushes messages to the bottom when there are few of them.
   Collapses automatically once content overflows, allowing normal upward scroll. */
.chat-messages::before {
    content: '';
    flex: 1;
}

.chat-messages.flex-display {
    display: flex;
}

.message {
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
}

.bot-message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    align-self: flex-start;
    max-width: 88%;
}

.bot-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.bot-message {
    background-color: rgba(241, 243, 245, 0.5);
    color: #1a202c;
    border-bottom-left-radius: 4px;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

.user-message {
    background-color: #FF007A;
    color: #ffffff;
    align-self: flex-end;
    max-width: 75%;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    border-top: 1px solid rgba(224, 224, 224, 0.4);
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.25);
}

#contact-chat-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#contact-user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

#contact-user-input:focus {
    border-color: #FF007A;
}

#contact-user-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

#contact-chat-form button {
    padding: 12px 24px;
    background-color: #FF007A;
    color: #ffffff;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s;
}

#contact-chat-form button:hover:not(:disabled) {
    background-color: #e6006e;
}

#contact-chat-form button:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

.hidden {
    display: none;
}

.flex-display {
    display: flex;
}

/* ============================================
   RESPONSIVE BREAKPOINTS:
   - Laptop: 1441px and above (MacBook Air 13-inch and larger)
   - Tablet: 441px - 1440px
   - Mobile: 440px and below (Pixel 10 Pro XL and smaller)
   ============================================ */

/* Tablet styles (441px - 1440px) */
@media (max-width: 1440px) and (min-width: 511px) {
    .contact-chat-page-container {
        padding: 35px 20px;
    }

    .contact-chat-box {
        height: calc(100vh - 150px);
    }

    .chat-messages {
        padding: 18px;
    }

    .user-message {
        max-width: 80%;
    }

    .bot-message-wrapper {
        max-width: 82%;
    }
}

/* Mobile styles (440px and below (Pixel 10 Pro XL and smaller)) */
@media (max-width: 510px) {

    /* Use dvh (dynamic viewport height) so the layout shrinks when the
       virtual keyboard opens, keeping the input bar always visible */
    .contact-chat-page-container {
        margin-top: 0;
        padding: 0;
        min-height: 100dvh;
        height: 100dvh;
        align-items: stretch;
    }

    .contact-chat-box {
        /* Fill the full dynamic viewport — shrinks automatically when keyboard appears */
        height: 100dvh;
        max-width: 100%;
        border-radius: 0;
        /* Extra padding at the top for the fixed header (60px) */
        padding-top: 60px;
    }

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

    .user-message {
        max-width: 80%;
    }

    .bot-message-wrapper {
        max-width: 97%;
    }

    .bot-avatar {
        width: 39px;
        height: 39px;
    }

    .message {
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    .chat-input-area {
        padding: 12px 15px;
        /* Stick to the bottom and respect iOS home indicator */
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    #contact-user-input {
        padding: 10px 14px;
        font-size: 1rem;
        /* 1rem prevents iOS auto-zoom on focus */
    }

    #contact-chat-form button {
        padding: 10px 18px;
        font-size: 0.95rem;
    }
}

/* Fade-in animation for messages */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: messageAppear 0.2s ease-out;
}

/* Markdown rendering inside bot messages */
.bot-message p {
    margin: 0 0 12px 0;
}

.bot-message p:last-child {
    margin-bottom: 0;
}

.bot-message ul {
    margin: 8px 0 14px 0;
    padding-left: 20px;
    line-height: 1.6;
}

.bot-message li {
    margin-bottom: 8px;
}

.bot-message strong {
    font-weight: 600;
    color: #111827;
}

.bot-message a {
    color: #FF007A;
    text-decoration: underline;
    word-break: break-all;
}

/* Section header — property / category name (single bold line) */
.bot-message .section-header {
    font-size: 1.08rem;
    font-weight: 700;
    color: #111827;
    margin: 14px 0 6px;
    padding-bottom: 5px;
    border-bottom: 2px solid #FF007A;
    display: flex;
    align-items: center;
    gap: 7px;
}

.bot-message .section-header:first-child {
    margin-top: 2px;
}

.section-icon {
    font-size: 1.15em;
    line-height: 1;
    flex-shrink: 0;
}

/* Icon inside entity card description */
.entity-icon {
    font-size: 1.05em;
    margin-right: 5px;
    vertical-align: -0.05em;
}

/* Entity card — room / item block with description + images */
.entity-card {
    background: rgba(255, 255, 255, 0.75);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    margin: 6px 0;
}

.entity-card>p {
    margin: 0;
    padding: 11px 14px 9px;
    line-height: 1.55;
}

.entity-card>.chat-image-grid {
    margin-top: 0;
    padding: 0 8px 10px;
    gap: 5px;
}

/* Images inside cards fill available width and are taller */
.entity-card>.chat-image-grid .chat-image {
    flex: 1;
    min-width: 100px;
    width: auto;
    height: 165px;
    border-radius: 8px;
}

/* Images inside bot messages (standalone grids outside cards) */
.chat-image-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 8px;
    overflow-x: auto;
}

.chat-image {
    width: 150px;
    height: 115px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-image:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}


/* Lightbox overlay for full-size image */
.chat-image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    animation: fadeInOverlay 0.2s ease;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.chat-image-lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* Typing indicator (three bouncing dots) */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #aaa;
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.2s infinite ease-in-out;
}

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

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

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}