/* Widget & UI Component Styles */

/* Floating Widgets Container */
.floating-widgets {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-end;
    pointer-events: none;
}
.floating-widgets > * {
    pointer-events: auto;
}

/* WhatsApp Button */
.whatsapp-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
}
.whatsapp-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.6);
}
.whatsapp-btn:focus-visible {
    outline: 3px solid #25D366;
    outline-offset: 3px;
}
.whatsapp-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, 0.3);
    animation: pulse-whatsapp-ring 2s infinite;
}
.whatsapp-btn svg {
    width: 30px;
    height: 30px;
    fill: white;
}
@keyframes pulse-whatsapp-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* Chat Widget */
.chat-widget-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
body.mobile-menu-open .floating-widgets {
    visibility: hidden;
    pointer-events: none;
}
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: none;
    padding: 0;
}
.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(249, 115, 22, 0.6);
}
.chat-toggle-btn:focus-visible {
    outline: 3px solid #f97316;
    outline-offset: 3px;
}
.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: all 0.3s ease;
}
.chat-toggle-btn.active svg.chat-icon { display: none; }
.chat-toggle-btn.active svg.close-icon { display: block; }
.chat-toggle-btn svg.close-icon { display: none; }

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    border: 2px solid white;
    animation: bounce-badge 1s infinite;
}
@keyframes bounce-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.chat-window {
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 14px;
    animation: slideUp 0.3s ease;
}
.chat-window.active { display: flex; }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.chat-title { font-weight: 600; font-size: 15px; }
.chat-status { font-size: 12px; opacity: 0.9; }
.chat-status::before { content: '\25CF'; color: #4ade80; margin-right: 4px; }

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
}
.chat-message { margin-bottom: 12px; display: flex; gap: 8px; }
.chat-message.user { flex-direction: row-reverse; }
.message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.chat-message.bot .message-bubble { background: white; color: #111827; border: 1px solid #e5e7eb; }
.chat-message.user .message-bubble { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); color: white; }
.message-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 12px;
    width: fit-content;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.user-details-form {
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 16px;
}
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: #374151; }
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}
.submit-details-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.submit-details-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3); }
.submit-details-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.submit-details-btn:focus-visible {
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

.chat-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input:focus { border-color: #f97316; box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1); }
.chat-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-send-btn:hover { transform: scale(1.08); box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.chat-send-btn:focus-visible {
    outline: 3px solid #f97316;
    outline-offset: 2px;
}
.chat-send-btn svg { width: 20px; height: 20px; fill: white; }

.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.quick-reply-btn {
    padding: 7px 14px;
    background: white;
    border: 1px solid #f97316;
    color: #f97316;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.quick-reply-btn:hover { background: #f97316; color: white; }
.quick-reply-btn:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

.link-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.link-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 16px;
    border: 1px solid #f97316;
    color: #f97316;
    background: #fff;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}
.link-chip:hover { background: #f97316; color: #fff; }

.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-track { background: #f1f5f9; }
.chat-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.chat-body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

@media (max-width: 640px) {
    .floating-widgets { bottom: 16px; right: 16px; gap: 12px; }
    .chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 110px);
        border-radius: 14px;
    }
    .whatsapp-btn, .chat-toggle-btn { width: 56px; height: 56px; }
    .whatsapp-btn svg { width: 28px; height: 28px; }
    .chat-toggle-btn svg { width: 26px; height: 26px; }
}
