/* ==============================================
   RINGFLUENT WIDGETS & INTERACTIVE ELEMENTS
   ============================================== */

/* Demo Form Error Messages */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.error-message.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.form-control.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Floating Contact Widget */
.floating-contact-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    font-family: 'Inter', sans-serif;
}

.widget-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: pulse-widget 2s infinite;
}

.widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.6);
}

.widget-toggle i {
    color: white;
    font-size: 1.5rem;
}

.widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: bounce-badge 1s infinite;
}

.widget-content {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 280px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.widget-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.widget-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-header h6 {
    margin: 0;
    color: #374151;
    font-weight: 600;
}

.widget-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.widget-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.widget-body {
    padding: 1rem;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    text-decoration: none;
    color: #6b7280;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.quick-action:hover {
    color: #6366f1;
    border-color: #6366f1;
    background: #f8fafc;
    transform: translateY(-2px);
}

.quick-action i {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.widget-info {
    text-align: center;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1040;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.scroll-to-top i {
    color: white;
    font-size: 1.2rem;
}

/* Live Chat Notification */
.live-chat-notification {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: all 0.5s ease;
    z-index: 1045;
    border: 1px solid #e5e7eb;
}

.live-chat-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.live-chat-notification::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
}

.chat-avatar {
    position: absolute;
    top: -15px;
    left: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-online 2s infinite;
}

.chat-content {
    padding: 1.5rem 1rem 1rem 1rem;
    margin-left: 40px;
}

.chat-message strong {
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
}

.chat-message p {
    margin: 0.25rem 0 0.75rem 0;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.4;
}

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

.chat-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.chat-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Exit Intent Modal Enhancements */
.modal-header.bg-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
}

/* Animations */
@keyframes pulse-widget {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.6), 0 0 0 10px rgba(99, 102, 241, 0.1);
    }
}

@keyframes bounce-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

@keyframes pulse-online {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .floating-contact-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .widget-content {
        width: 260px;
        right: -20px;
    }
    
    .live-chat-notification {
        width: 280px;
        right: 15px;
        bottom: 90px;
    }
    
    .chat-content {
        margin-left: 30px;
    }
    
    .scroll-to-top {
        bottom: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .widget-content {
        width: calc(100vw - 40px);
        right: -10px;
    }
    
    .live-chat-notification {
        width: calc(100vw - 40px);
        right: 10px;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .quick-action {
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.75rem;
    }
    
    .quick-action i {
        margin-bottom: 0;
        margin-right: 0.75rem;
        font-size: 1.1rem;
    }
}

/* Loading States */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Notification Improvements */
.toast-container .toast {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.toast-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Progress Bar for Forms */
.form-progress {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.form-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Interactive Elements Enhancements */
.interactive-highlight {
    position: relative;
    overflow: hidden;
}

.interactive-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.interactive-highlight:hover::before {
    left: 100%;
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus States */
.widget-toggle:focus,
.scroll-to-top:focus,
.quick-action:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .floating-contact-widget,
    .live-chat-notification,
    .scroll-to-top {
        border: 2px solid #000;
    }
}