/* Agentia Chat Widget */

#agentia-chat-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: fixed;
    z-index: 999999;
}

#agentia-chat-widget[data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
}

#agentia-chat-widget[data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
}

/* Burbuja */
#agentia-chat-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--agentia-color, #4F46E5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

#agentia-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Chat box */
#agentia-chat-box {
    display: none;
    width: 360px;
    height: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 70px;
}

#agentia-chat-widget[data-position="bottom-right"] #agentia-chat-box {
    right: 0;
}

#agentia-chat-widget[data-position="bottom-left"] #agentia-chat-box {
    left: 0;
}

#agentia-chat-box.open {
    display: flex;
}

/* Header */
#agentia-chat-header {
    background: var(--agentia-color, #4F46E5);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#agentia-chat-title {
    font-size: 15px;
    font-weight: 600;
}

#agentia-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

#agentia-chat-close:hover {
    opacity: 1;
}

/* Messages */
#agentia-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agentia-msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.agentia-msg-visitor {
    align-self: flex-end;
    background: var(--agentia-color, #4F46E5);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.agentia-msg-bot {
    align-self: flex-start;
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.agentia-msg-typing {
    align-self: flex-start;
    background: #f1f5f9;
    color: #94a3b8;
    border-bottom-left-radius: 4px;
    font-style: italic;
}

/* Input */
#agentia-chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
    flex-shrink: 0;
}

#agentia-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#agentia-chat-input:focus {
    border-color: var(--agentia-color, #4F46E5);
}

#agentia-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--agentia-color, #4F46E5);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

#agentia-chat-send:hover {
    opacity: 0.9;
}

/* Pre-chat form */
#agentia-chat-prechat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.agentia-prechat-inner {
    width: 100%;
}

.agentia-prechat-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px 0;
    text-align: center;
}

.agentia-prechat-field {
    margin-bottom: 14px;
}

.agentia-prechat-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.agentia-prechat-field input:focus {
    border-color: var(--agentia-color, #4F46E5);
}

.agentia-prechat-field input.agentia-input-error {
    border-color: #ef4444;
}

.agentia-prechat-error {
    display: none;
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    padding-left: 4px;
}

#agentia-prechat-start {
    width: 100%;
    padding: 12px;
    background: var(--agentia-color, #4F46E5);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 6px;
}

#agentia-prechat-start:hover {
    opacity: 0.9;
}

/* Chat body */
#agentia-chat-body {
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

/* Scrollbar */
#agentia-chat-messages::-webkit-scrollbar {
    width: 4px;
}

#agentia-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#agentia-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 480px) {
    #agentia-chat-box {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 70px;
    }
}
