/* Chatbot Widget Styles */
.chatbot-container {
    position: fixed;
    bottom: 60px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.chatbot-toggle-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1913d 0%, #e67e22 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    overflow: hidden;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 570px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    transition: width 0.4s ease, height 0.4s ease;
}

.chatbot-window.expanded {
    width: 90vw !important;
    height: 85vh !important;
    max-width: 1400px;
    max-height: none;
    position: fixed !important;
    bottom: 50% !important;
    right: 50% !important;
    transform: translate(50%, 50%) !important;
    transition: all 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #f1913d 0%, #e67e22 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    gap: 10px;
}

.chatbot-header-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.chatbot-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-disclaimer-sticky {
    background: #6c757d;
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    color: #ffffff;
    line-height: 1.3;
    flex-shrink: 0;
}

.chatbot-disclaimer-sticky i {
    color: #ffffff;
    font-size: 14px;
    flex-shrink: 0;
}

.chatbot-disclaimer-sticky span {
    flex: 1;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message-user {
    flex-direction: row-reverse;
}

.chatbot-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1913d 0%, #e67e22 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-size: 18px;
    overflow: hidden;
    padding: 1px;
}

.chatbot-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chatbot-message-user .chatbot-message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.chatbot-message-content {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatbot-message-wrapper {
    padding: 12px 16px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message-user .chatbot-message-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chatbot-message-wrapper p {
    margin: 0 0 8px 0;
}

.chatbot-message-wrapper p:last-child {
    margin-bottom: 0;
}

.chatbot-message-wrapper table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 11px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.chatbot-message-wrapper table::after {
    content: '? Scroll';
    position: absolute;
    right: 10px;
    top: 10px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    pointer-events: none;
    opacity: 0.7;
}

.chatbot-message-wrapper table thead,
.chatbot-message-wrapper table tbody {
    display: table;
    width: 100%;
    min-width: 600px;
}

.chatbot-message-wrapper table th,
.chatbot-message-wrapper table td {
    padding: 6px 8px;
    text-align: left;
    border: 1px solid #dee2e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.chatbot-message-wrapper table th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.chatbot-message-wrapper table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.chatbot-message-wrapper table td:first-child,
.chatbot-message-wrapper table th:first-child {
    max-width: 200px;
    white-space: normal;
}

.chatbot-message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
}

/* Quick Action Buttons */
.chatbot-quick-actions-container {
    padding: 0 10px;
    margin-bottom: 16px;
}

.chatbot-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    color: #495057;
    min-height: 70px;
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.quick-action-btn i {
    font-size: 20px;
}

.quick-action-btn span {
    text-align: center;
    line-height: 1.2;
}

/* Mortgage Calculator Styles */
.mortgage-calculator {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin: 8px 0;
}

.mortgage-calculator .calc-input-group {
    margin-bottom: 12px;
}

.mortgage-calculator label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #495057;
}

.mortgage-calculator input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.mortgage-calculator .calc-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: transform 0.2s;
}

.mortgage-calculator .calc-btn:hover {
    transform: scale(1.02);
}

.mortgage-calculator .calc-result {
    margin-top: 16px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.mortgage-calculator .calc-result h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #495057;
}

.mortgage-calculator .calc-result .amount {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 8px;
}

.mortgage-calculator .calc-result .breakdown {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.6;
}

/* Suggested Questions Styling */
.suggested-questions {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.suggested-questions p {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.suggested-question-btn {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #495057;
    position: relative;
    padding-left: 40px;
}

.suggested-question-btn:last-child {
    margin-bottom: 0;
}

.suggested-question-btn:before {
    content: '??';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.suggested-question-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.suggested-question-btn:hover:before {
    content: '?';
}

.suggested-question-btn:active {
    transform: translateX(2px);
}

/* Input Container */
.chatbot-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

.chatbot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chatbot-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #667eea;
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        right: 30px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }

    .chatbot-toggle-btn {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }

    .chatbot-window.expanded {
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 100px) !important;
        max-width: none !important;
        bottom: 50% !important;
        right: 50% !important;
        transform: translate(50%, 50%) !important;
    }

    .chatbot-message-wrapper table {
        font-size: 10px;
    }

    .chatbot-message-wrapper table th,
    .chatbot-message-wrapper table td {
        padding: 4px 6px;
        max-width: 100px;
    }

    .chatbot-message-wrapper table td:first-child,
    .chatbot-message-wrapper table th:first-child {
        max-width: 120px;
    }

    .chatbot-quick-actions {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .quick-action-btn {
        min-height: 60px;
        font-size: 11px;
    }

    .quick-action-btn i {
        font-size: 18px;
    }

    .mortgage-calculator {
        padding: 12px;
    }

    .mortgage-calculator .calc-result .amount {
        font-size: 20px;
    }

    .suggested-questions {
        padding: 12px;
        margin-top: 16px;
    }

    .suggested-question-btn {
        padding: 10px 14px;
        padding-left: 36px;
        font-size: 12px;
    }

    .suggested-question-btn:before {
        font-size: 14px;
        left: 10px;
    }
}
