/* ===== Real-time Chat Widget ===== */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-toggle:hover {
    transform: translateY(-5px) scale(1.05);
    background: var(--primary-dark);
}

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

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-text h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.chat-header-text p {
    font-size: 0.75rem;
    color: #10B981;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-header-text p::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: 50%;
}

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

/* Custom Scrollbar for Chat */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    position: relative;
    line-height: 1.4;
}

.message-received {
    align-self: flex-start;
    background: white;
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.message-sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.message-info {
    font-size: 0.7rem;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.message-received .message-info {
    color: var(--text-muted);
}

.message-sent .message-info {
    color: rgba(255, 255, 255, 0.8);
}

.chat-input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-input-form {
    display: flex;
    gap: 10px;
    background: white;
    padding: 6px 6px 6px 16px;
    border-radius: 100px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.chat-input-form:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.05);
}

.chat-input-form input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    background: transparent;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.chat-auth-prompt {
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chat-auth-prompt button {
    background: var(--primary-bg);
    color: var(--primary);
    border: none;
    padding: 4px 12px;
    border-radius: 100px;
    font-weight: 600;
    margin-left: 5px;
}

.chat-error {
    padding: 20px;
    text-align: center;
    color: #EF4444;
    font-size: 0.8rem;
    font-weight: 500;
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 70px;
        right: -10px;
    }
}
