/* Floating Widget Styles */
.hf-chatbot-widget {
    position: fixed;
    z-index: 2147483647 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Position Classes */
.hf-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.hf-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.hf-position-top-right {
    top: 20px;
    right: 20px;
}

.hf-position-top-left {
    top: 20px;
    left: 20px;
}

/* Hide on mobile if needed */
@media (max-width: 768px) {
    .hf-hide-mobile {
        display: none !important;
    }
}

/* Chat Bubble */
.hf-chatbot-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #023C65;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    color: white;
    position: relative;
    z-index: 10;
}

.hf-chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0,0,0,0.2);
}

.hf-chatbot-bubble.hf-active {
    background: #023C65;
}

.hf-chatbot-bubble.hf-has-notification {
    animation: hf-pulse 2s infinite;
}

@keyframes hf-pulse {
    0% { box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
    50% { box-shadow: 0 4px 20px rgba(2, 60, 101, 0.4); }
    100% { box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
}

/* Notification Badge */
.hf-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
}
/* Notification Badge (continued) */
.hf-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
}

/* Chat Window */
.hf-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e8ed;
    z-index: 20;
}

/* Position adjustments for different corners */
.hf-position-bottom-left .hf-chatbot-window {
    right: auto;
    left: 0;
}

.hf-position-top-right .hf-chatbot-window {
    bottom: auto;
    top: 80px;
}

.hf-position-top-left .hf-chatbot-window {
    bottom: auto;
    top: 80px;
    right: auto;
    left: 0;
}

/* Header */
.hf-chatbot-header {
    background: #023C65;
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hf-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hf-bot-avatar {
    font-size: 20px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
}

.hf-bot-details h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.hf-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.hf-status:before {
    content: '';
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.hf-header-actions {
    display: flex;
    gap: 5px;
}

.hf-header-btn {
    background: none;
    border: none;
    color: white;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.hf-header-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}

/* Messages Container */
.hf-chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Custom scrollbar */
.hf-chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.hf-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.hf-chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.hf-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Styles */
.hf-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}

.hf-message-user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.hf-message-bot {
    margin-right: auto;
}

.hf-message-error {
    margin-right: auto;
    max-width: 100%;
}

.hf-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    background: #e2e8f0;
}

.hf-message-user .hf-message-avatar {
    background: #023C65;
    color: white;
}

.hf-message-bot .hf-message-avatar {
    background: #023C65;
    color: white;
}

/* Hide user avatar icon */
.hf-message-user .hf-message-avatar {
    display: none;
}

.hf-message-content {
    position: relative;
}

.hf-message-text {
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 14px;
}

.hf-message-user .hf-message-text {
    background: #023C65;
    color: white;
    border-bottom-right-radius: 6px;
}

.hf-message-bot .hf-message-text {
    background: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px;
}

/* Link buttons inside bot messages */
.hf-message-bot .hf-message-text .hf-link-btn {
    display: inline-block;
    margin-top: 12px; /* more space from preceding content/title */
    padding: 6px 10px;
    background: #f0f2f5; /* slight grey */
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.hf-message-bot .hf-message-text .hf-link-btn:hover {
    background: #e7eaf0;
    border-color: #d5d9e0;
}

/* Real-estate listing card layout */
.hf-message-bot .hf-message-text .hf-listing-card {
    padding: 8px 10px;
    border: none; /* remove card border */
    border-radius: 8px;
    background: #ffffff;
}

.hf-message-bot .hf-message-text .hf-listing-card + .hf-listing-card {
    margin-top: 10px; /* space between multiple cards */
}

.hf-message-bot .hf-message-text .hf-listing-header {
    font-weight: 700; /* ensure bold title */
    margin-bottom: 8px; /* space under the title */
    color: #1a202c;
}

.hf-message-bot .hf-message-text .hf-listing-body > div {
    margin: 3px 0; /* even spacing between rows */
}

.hf-message-error .hf-message-text {
    background: #fed7d7;
    color: #c53030;
    border-bottom-left-radius: 6px;
}

.hf-message-time {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 4px;
    text-align: right;
}

.hf-message-bot .hf-message-time,
.hf-message-error .hf-message-time {
    text-align: left;
}

/* Typing Indicator */
.hf-typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.hf-typing-dots {
    display: flex;
    gap: 3px;
}

.hf-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #023C65;
    animation: hf-typing 1.4s infinite ease-in-out;
}

.hf-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.hf-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes hf-typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.hf-typing-text {
    display: none;
}

/* Input Area */
.hf-chatbot-input {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    gap: 10px;
    align-items: center;
}

.hf-chatbot-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background: #f7fafc;
    transition: all 0.2s ease;
}

.hf-chatbot-input input:focus {
    border-color: #023C65;
    background: white;
    box-shadow: 0 0 0 3px rgba(2, 60, 101, 0.1);
}

.hf-chatbot-input input::placeholder {
    color: #a0aec0;
}

.hf-chatbot-input button {
    width: 40px;
    height: 40px;
    border: none;
    background: #023C65;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.hf-chatbot-input button:hover {
    background: #035082;
    transform: scale(1.05);
}

.hf-chatbot-input button:active {
    transform: scale(0.95);
}

/* Footer */
.hf-chatbot-footer {
    padding: 8px 15px;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.hf-chatbot-footer span {
    font-size: 11px;
    color: #a0aec0;
}

/* Mobile Responsiveness */
/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Show widget on mobile unless explicitly hidden */
    .hf-chatbot-widget {
        display: block !important;
    }
    
    /* Only hide if specifically set to hide on mobile */
    .hf-chatbot-widget.hf-hide-mobile {
        display: none !important;
    }
    
    .hf-chatbot-window {
        width: calc(100vw - 40px) !important;
        /* Use dynamic viewport height to avoid mobile browser URL bar issues */
        height: min(calc(100dvh - 120px), 600px) !important;
        max-width: none !important;
        max-height: none !important;
        position: fixed !important;
        bottom: 80px !important;
        left: 20px !important;
        right: 20px !important;
        top: auto !important;
    }
    
    .hf-chatbot-bubble {
        width: 56px;
        height: 56px;
    }
    
    .hf-message {
        max-width: 90%;
    }
    
    .hf-chatbot-input input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .hf-chatbot-window {
        width: calc(100vw - 20px) !important;
        left: 10px !important;
        right: 10px !important;
        height: min(calc(100dvh - 120px), 600px) !important;
    }
    
    .hf-chatbot-bubble {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .hf-chatbot-window {
        height: calc(100vh - 120px);
    }
    
    .hf-chatbot-bubble {
        width: 50px;
        height: 50px;
    }
}

/* Shortcode Styles (for manual placement) */
.hf-chatbot-container {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.hf-chatbot-container .hf-chatbot-header {
    background: #023C65;
    color: white;
    padding: 15px;
}

.hf-chatbot-container .hf-chatbot-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.hf-chatbot-container .hf-chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
    min-height: 300px;
}

.hf-chatbot-container .hf-chatbot-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    background: white;
    gap: 10px;
}

.hf-chatbot-container .hf-chatbot-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.hf-chatbot-container .hf-chatbot-input button {
    padding: 10px 20px;
    background: #023C65;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.hf-chatbot-loading {
    padding: 10px 15px;
    background: #fff3cd;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-style: italic;
    color: #856404;
}

/* Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Print styles */
@media print {
    .hf-chatbot-widget {
        display: none !important;
    }
}