

/* Floating Chat Button */
#chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1000;
}

#chat-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Chat Window */
#chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    min-width: 300px;
    min-height: 400px;
    max-width: 90vw;
    max-height: 85vh;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    display: none; /* Hidden by default */
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#chat-window.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Custom Resizer */
#resizer {
    height: 8px;
    background-color: transparent;
    cursor: ns-resize;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
}

/* Chat Header */
#chat-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#close-btn {
    cursor: pointer;
    font-size: 22px;
    transition: color 0.2s;
}

#close-btn:hover {
    color: #ffcccc;
}

/* Chat Messages */
#chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f9f9f9;
}

/* Message Bubbles */
.message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 15px;
    animation: fadeIn 0.3s ease-in-out;
}

.user-message {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,123,255,0.2);
}

.bot-message {
    background-color: #e9ecef;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Suggestions */
.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    animation: fadeIn 0.5s ease-in-out;
    padding: 0 5px;
}

.suggestion-btn {
    background-color: white;
    color: #007bff;
    border: 1px solid #007bff;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-btn:hover {
    background-color: #007bff;
    color: white;
}

/* Chat Input Area */
#chat-input-container {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eaeaea;
    background: white;
    align-items: center;
}

#chat-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 15px;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: #007bff;
}

#send-btn {
    background-color: #007bff;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, transform 0.2s;
}

#send-btn:hover:not(:disabled) {
    background-color: #0056b3;
    transform: scale(1.05);
}

#send-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#send-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
    margin-left: 2px; /* Center the icon slightly */
}

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

/* Loading Dots */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #666;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Markdown Typography Styles */
.message p {
    margin: 8px 0;
}

.message p:first-child {
    margin-top: 0;
}

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

.message ul, .message ol {
    margin: 10px 0 10px 20px;
    padding: 0;
}

.message li {
    margin-bottom: 6px;
    line-height: 1.5;
}

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

.message strong {
    font-weight: 600;
}

/* Code Blocks and Inline Code */
.message pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    margin: 10px 0;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

.message code {
    background-color: rgba(0,0,0,0.06);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    color: #d63384;
}

.message pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* Tables */
.message table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    display: block;
    overflow-x: auto;
}

.message th, .message td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.message th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Images inside chat messages */
.message img {
    max-width: 100%;
    max-height: 260px;
    width: auto;
    height: auto;
    display: block;
    border-radius: 10px;
    margin: 8px 0;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Custom Modals */
.custom-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal.show {
    display: flex;
    opacity: 1;
}

.custom-modal .modal-content {
    background: white;
    width: 320px;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    font-family: inherit;
}

.custom-modal.show .modal-content {
    transform: translateY(0);
}

.custom-modal h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 18px;
}

.custom-modal p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.custom-modal textarea {
    width: 100%;
    box-sizing: border-box;
    height: 80px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 15px;
    outline: none;
}

.custom-modal textarea:focus {
    border-color: #007bff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-cancel {
    background: #f1f3f5;
    color: #495057;
}

.btn-cancel:hover {
    background: #e9ecef;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
    background: #fa5252;
    color: white;
}

.btn-danger:hover {
    background: #e03131;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Better Action Buttons in Chat */
.action-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.action-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
}

.action-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
