/* ============================================
   CHAT WIDGET - Glassmorphism flotante
   ============================================ */

.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    font-family: var(--font-body, 'DM Sans', sans-serif);
}

/* Toggle button */
.chat-widget__toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-gold, #C9A55A) 0%, #B8933F 100%);
    color: #0A0A0A;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(201, 165, 90, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-widget__toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(201, 165, 90, 0.6);
}

.chat-widget__toggle svg {
    width: 28px;
    height: 28px;
}

/* Panel */
.chat-widget__panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 500px;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(201, 165, 90, 0.2);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chat-widget--open .chat-widget__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-widget__panel--minimized {
    height: 50px !important;
    max-height: 50px !important;
}

.chat-widget__panel--minimized .chat-widget__body,
.chat-widget__panel--minimized .chat-widget__input-area {
    display: none;
}

.chat-widget__panel--minimized .chat-widget__header {
    border-bottom: none;
    padding: 0.75rem 1rem;
}

/* Header */
.chat-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(201, 165, 90, 0.2);
    background: rgba(201, 165, 90, 0.1);
}

.chat-widget__header-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-widget__title {
    font-weight: 600;
    color: var(--color-gold, #C9A55A);
    font-size: 1rem;
}

.chat-widget__subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.chat-widget__header-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-widget__minimize,
.chat-widget__close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-widget__minimize:hover,
.chat-widget__close:hover {
    background: rgba(201, 165, 90, 0.2);
    border-color: var(--color-gold, #C9A55A);
    color: var(--color-gold, #C9A55A);
}

/* Body */
.chat-widget__body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 280px;
    min-height: 150px;
}

.chat-widget__message {
    display: flex;
    gap: 0.75rem;
    max-width: 100%;
}

.chat-widget__message--user {
    flex-direction: row-reverse;
}

.chat-widget__avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(201, 165, 90, 0.2);
    border: 1px solid rgba(201, 165, 90, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-gold, #C9A55A);
}

.chat-widget__message--user .chat-widget__avatar {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.chat-widget__bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    max-width: 260px;
}

.chat-widget__message--user .chat-widget__bubble {
    background: rgba(201, 165, 90, 0.15);
    border-color: rgba(201, 165, 90, 0.3);
    color: white;
    border-top-right-radius: 4px;
}

.chat-widget__message--bot .chat-widget__bubble {
    border-top-left-radius: 4px;
}

/* Input Area */
.chat-widget__input-area {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.chat-widget__form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-widget__form-row {
    display: flex;
    gap: 0.5rem;
}

.chat-widget__input,
.chat-widget__textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.chat-widget__input:focus,
.chat-widget__textarea:focus {
    outline: none;
    border-color: var(--color-gold, #C9A55A);
    background: rgba(255, 255, 255, 0.08);
}

.chat-widget__input::placeholder,
.chat-widget__textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-widget__textarea {
    resize: vertical;
    min-height: 60px;
}

.chat-widget__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--color-gold, #C9A55A) 0%, #B8933F 100%);
    color: #0A0A0A;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-widget__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(201, 165, 90, 0.4);
}

.chat-widget__submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.chat-widget__submit svg {
    width: 16px;
    height: 16px;
}

/* Spin animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.chat-widget__submit .spin {
    animation: spin 1s linear infinite;
}

/* Error message */
.chat-widget__error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    display: none;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 1rem;
        right: 1rem;
    }

    .chat-widget__panel {
        width: calc(100vw - 2rem);
        max-width: 350px;
    }

    .chat-widget__toggle {
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 360px) {
    .chat-widget__panel {
        width: calc(100vw - 1rem);
        right: -0.5rem;
    }
}
