/**
 * Frontend CSS for Chat Portal
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --chat-primary: #3b82f6;
    --chat-bg: #ffffff;
    --chat-text-primary: #ffffff;
    --chat-text-secondary: #1f2937;
    --chat-border: rgba(0, 0, 0, 0.05);
    --chat-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --chat-icon-size: 60px;
}

.chat-portal-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Inter', sans-serif;
}

.chat-button {
    width: var(--chat-icon-size);
    height: var(--chat-icon-size);
    border-radius: 50%;
    background: var(--chat-primary);
    color: var(--chat-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-button:hover {
    transform: scale(1.1);
}

.chat-icon-svg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-text-primary);
}

.chat-icon-svg svg {
    width: calc(var(--chat-icon-size) * 0.5);
    height: calc(var(--chat-icon-size) * 0.5);
}

.chat-button i {
    font-size: calc(var(--chat-icon-size) * 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.unread-counter {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.chat-window {
    position: absolute;
    bottom: calc(var(--chat-icon-size) + 20px);
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--chat-bg);
    border-radius: 20px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--chat-border);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-window-header {
    background: var(--chat-primary);
    color: var(--chat-text-primary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-window-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--chat-text-primary);
}

.close-chat {
    background: none;
    border: none;
    color: var(--chat-text-primary);
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
}

.close-chat:hover {
    opacity: 1;
}

.chat-init-form {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    color: var(--chat-text-secondary);
}

.chat-init-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
}

.chat-btn {
    background: var(--chat-primary);
    color: var(--chat-text-primary);
    border: none;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.chat-messages-container {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9fafb;
}

.msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.msg.received {
    align-self: flex-start;
    background: white;
    color: #374151;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.msg.sent {
    align-self: flex-end;
    background: var(--chat-primary);
    color: var(--chat-text-primary);
    border-bottom-right-radius: 4px;
}

.chat-input-container {
    padding: 15px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: white;
    border-top: 1px solid var(--chat-border);
}

.chat-input-container textarea {
    flex-grow: 1;
    border: none;
    resize: none;
    height: 40px;
    padding: 10px 0;
    font-family: inherit;
    outline: none;
}

.file-label {
    cursor: pointer;
    color: #6b7280;
    padding-bottom: 5px;
}

.file-label:hover {
    color: var(--chat-primary);
}

.send-btn {
    background: var(--chat-primary);
    color: var(--chat-text-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

/* Dark Mode Support (Optional, can be overridden by settings) */
@media (prefers-color-scheme: dark) {
    /* If user has default settings, follow dark mode. If custom colors, settings win. */
}

/* FAQ Buttons */
.faq-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    margin-bottom: 10px;
}

.faq-intro {
    width: 100%;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 5px;
    font-weight: 500;
}

.faq-btn {
    background: white;
    border: 1px solid var(--chat-primary);
    color: var(--chat-primary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: left;
    line-height: 1.3;
}

.faq-btn:hover {
    background: var(--chat-primary);
    color: var(--chat-text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.faq-btn:active {
    transform: translateY(0);
}

.faq-buttons-container.hidden {
    display: none;
}

.messages-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}