/* Chat Modal Styles */
.chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    pointer-events: none;
}

.chat-modal.active {
    display: block;
    pointer-events: auto;
}

.chat-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.chat-modal-container {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 650px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background: var(--surface-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpIn 0.3s ease-out;
    border: none;
}

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

.chat-modal-header {
    background: linear-gradient(135deg, var(--accent) 0%, #0d3d35 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.chat-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.chat-modal-header h3 i {
    color: #fff;
}

.chat-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-modal-actions .btn {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-modal-actions .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.chat-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.chat-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-modal-body {
    display: flex;
    flex-direction: column;
    height: 600px;
    max-height: calc(100vh - 200px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.chat-message--user {
    align-self: flex-end;
}

.chat-message--ai,
.chat-message--manager,
.chat-message--system {
    align-self: flex-start;
}

.chat-message__content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.chat-message--user .chat-message__content {
    background: linear-gradient(135deg, var(--accent) 0%, #0d3d35 100%);
    color: #fff;
    border-radius: 12px 12px 0 12px;
}

.chat-message--ai .chat-message__content {
    background: #f0f0f0;
    color: var(--text);
    border-radius: 12px 12px 12px 0;
}

.chat-message--manager .chat-message__content {
    background: linear-gradient(135deg, var(--accent-2) 0%, #a65a32 100%);
    color: #fff;
    border-radius: 12px 12px 12px 0;
}

.chat-message--system .chat-message__content {
    background: #fff3cd;
    color: #856404;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-input-area textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    resize: none;
    font-size: 0.95rem;
    min-height: 80px;
    max-height: 80px;
    transition: border-color var(--transition);
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-input-actions {
    display: flex;
    justify-content: flex-end;
}

.chat-input-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-typing-dots::after {
    content: '...';
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.chat-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: chatSpinner 0.75s linear infinite;
}

@keyframes chatSpinner {
    to { transform: rotate(360deg); }
}

/* Floating Action Buttons Container */
.floating-actions {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

/* Floating Chat Button */
.chat-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--accent);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all var(--transition);
}

.chat-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(17, 72, 63, 0.2);
    background: rgba(255, 255, 255, 0.25);
}

.chat-toggle-btn:active {
    transform: translateY(0);
}

.chat-toggle-btn.in-hero {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-toggle-btn.in-hero:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(255, 255, 255, 0.2);
}

/* Floating Callback Button */
.callback-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--accent-2);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all var(--transition);
}

.callback-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(197, 122, 73, 0.2);
    background: rgba(255, 255, 255, 0.25);
}

.callback-toggle-btn:active {
    transform: translateY(0);
}

.callback-toggle-btn.in-hero {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.callback-toggle-btn.in-hero:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-modal-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }

    .chat-modal-body {
        height: calc(100vh - 60px);
        display: flex;
        flex-direction: column;
        padding-bottom: 60px;
    }

    .chat-input-area {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        margin-top: auto;
        z-index: 10;
    }

    .floating-actions {
        bottom: 16px;
        right: 16px;
        gap: 10px;
        display: flex !important;
        flex-direction: row !important;
    }

    .chat-toggle-btn,
    .callback-toggle-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .chat-modal-header h3 {
        font-size: 1rem;
    }
}
