/* Live Chat Widget Styles */
.live-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* Contain scroll events within the widget */
    overscroll-behavior: contain;
}
.rg-recaptcha {
    overflow: hidden;
    width: 298px;
    height: 74px;
}

iframe {
    margin: -1px 0px 0px -2px;
}

.recaptcha-req {
    border: solid 1px #d54545 !important;
}

/* Chat Toggle Button */
.live-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7F4DF6 0%, #5a32b3 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(127, 77, 246, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.live-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 77, 246, 0.4);
}

.live-chat-toggle.active {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* Notification Badge */
.live-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chat Widget */
.live-chat-widget {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.live-chat-widget.show {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark Theme */
[data-bs-theme="dark"] .live-chat-widget {
    background: #2d3338;
    border-color: #495057;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .live-chat-widget {
        background: #2d3338;
        border-color: #495057;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
}

/* Chat Header */
.live-chat-header {
    background: linear-gradient(135deg, #7F4DF6 0%, #5a32b3 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.live-chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.live-chat-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.live-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

.live-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.live-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages */
.live-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    scroll-behavior: smooth;
    /* Ensure scrolling works even when form inputs are focused */
    overscroll-behavior: contain;
}

[data-bs-theme="dark"] .live-chat-messages {
    background: #1a1d20;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .live-chat-messages {
        background: #1a1d20;
    }
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7F4DF6 0%, #5a32b3 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    margin-right: 10px;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    margin-right: 0;
    margin-left: 10px;
    order: 2;
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    background: white;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    word-wrap: break-word;
}

[data-bs-theme="dark"] .chat-bubble {
    background: #495057;
    color: #f8f9fa;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .chat-bubble {
        background: #495057;
        color: #f8f9fa;
    }
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #7F4DF6 0%, #5a32b3 100%);
    color: white;
}

.chat-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: center;
}

[data-bs-theme="dark"] .chat-time {
    color: #adb5bd;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .chat-time {
        color: #adb5bd;
    }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .typing-indicator {
    background: #495057;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .typing-indicator {
        background: #495057;
    }
}

.typing-dots {
    display: flex;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.live-chat-input {
    padding: 16px 20px;
    border-top: 1px solid #e1e5e9;
    background: white;
}

[data-bs-theme="dark"] .live-chat-input {
    background: #2d3338;
    border-color: #495057;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .live-chat-input {
        background: #2d3338;
        border-color: #495057;
    }
}

.chat-input-group {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    border: 1px solid #e1e5e9;
}

[data-bs-theme="dark"] .chat-input-group {
    background: #495057;
    border-color: #6c757d;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .chat-input-group {
        background: #495057;
        border-color: #6c757d;
    }
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    outline: none;
    color: #333;
}

[data-bs-theme="dark"] .chat-input {
    color: #f8f9fa;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .chat-input {
        color: #f8f9fa;
    }
}

.chat-input::placeholder {
    color: #999;
}

[data-bs-theme="dark"] .chat-input::placeholder {
    color: #adb5bd;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .chat-input::placeholder {
        color: #adb5bd;
    }
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7F4DF6 0%, #5a32b3 100%);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 480px) {
    .live-chat-widget {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 80px;
    }
    
    .live-chat-container {
        bottom: 10px;
        right: 10px;    }
}

/* Contact Form Styles */
.contact-form-container {
    margin: 16px 0;
}

.contact-form {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.contact-form h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #7F4DF6;
    box-shadow: 0 0 0 2px rgba(127, 77, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Form Input Scroll Handling */
.contact-form input,
.contact-form textarea {
    /* Prevent scroll events from bubbling to body when not needed */
    overscroll-behavior: contain;
}

.contact-form textarea {
    /* Allow internal scrolling for textareas */
    overflow-y: auto;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.submit-btn {
    background: #7F4DF6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    flex: 1;
}

.submit-btn:hover {
    background: #6c42c7;
}

.cancel-btn {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {    background: #f8f9fa;
    border-color: #999;
}

/* Dark Theme Support */
[data-bs-theme="dark"] .contact-form {
    background: #2d3748;
    border-color: #4a5568;
}

[data-bs-theme="dark"] .contact-form h4 {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-group label {
    color: #cbd5e0;
}

[data-bs-theme="dark"] .form-group input,
[data-bs-theme="dark"] .form-group textarea {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-group input:focus,
[data-bs-theme="dark"] .form-group textarea:focus {
    border-color: #9d7df8;
}

[data-bs-theme="dark"] .cancel-btn {
    color: #cbd5e0;
    border-color: #4a5568;
}

[data-bs-theme="dark"] .cancel-btn:hover {
    background: #2d3748;
    border-color: #718096;
}

[data-bs-theme="dark"] .conversation-history {
    background: #1a202c;
}

[data-bs-theme="dark"] .history-header {
    border-color: #4a5568;
}

[data-bs-theme="dark"] .history-header h3 {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .close-history-btn {
    color: #cbd5e0;
}

[data-bs-theme="dark"] .close-history-btn:hover {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .conversation-item {
    border-color: #4a5568;
}

[data-bs-theme="dark"] .conversation-item:hover {
    background: #2d3748;
    border-color: #9d7df8;
}

[data-bs-theme="dark"] .conversation-item.active {
    background: #2a4365;
    border-color: #9d7df8;
}

[data-bs-theme="dark"] .conversation-date {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .conversation-summary {
    color: #cbd5e0;
}

[data-bs-theme="dark"] .no-conversations {
    color: #cbd5e0;
}

@media (prefers-color-scheme: dark) {
    [data-bs-theme="auto"] .contact-form {
        background: #2d3748;
        border-color: #4a5568;
    }

    [data-bs-theme="auto"] .contact-form h4 {
        color: #e2e8f0;
    }

    [data-bs-theme="auto"] .form-group label {
        color: #cbd5e0;
    }

    [data-bs-theme="auto"] .form-group input,
    [data-bs-theme="auto"] .form-group textarea {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    [data-bs-theme="auto"] .form-group input:focus,
    [data-bs-theme="auto"] .form-group textarea:focus {
        border-color: #9d7df8;
    }

    [data-bs-theme="auto"] .cancel-btn {
        color: #cbd5e0;
        border-color: #4a5568;
    }

    [data-bs-theme="auto"] .cancel-btn:hover {
        background: #2d3748;
        border-color: #718096;
    }

    [data-bs-theme="auto"] .conversation-history {
        background: #1a202c;
    }

    [data-bs-theme="auto"] .history-header {
        border-color: #4a5568;
    }

    [data-bs-theme="auto"] .history-header h3 {
        color: #e2e8f0;
    }

    [data-bs-theme="auto"] .close-history-btn {
        color: #cbd5e0;
    }

    [data-bs-theme="auto"] .close-history-btn:hover {
        color: #e2e8f0;
    }

    [data-bs-theme="auto"] .conversation-item {
        border-color: #4a5568;
    }

    [data-bs-theme="auto"] .conversation-item:hover {
        background: #2d3748;
        border-color: #9d7df8;
    }

    [data-bs-theme="auto"] .conversation-item.active {
        background: #2a4365;
        border-color: #9d7df8;
    }

    [data-bs-theme="auto"] .conversation-date {
        color: #e2e8f0;
    }

    [data-bs-theme="auto"] .conversation-summary {
        color: #cbd5e0;
    }

    [data-bs-theme="auto"] .no-conversations {
        color: #cbd5e0;
    }
}

/* Utility Classes */
.hide {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .conversation-history-overlay {
        padding: 10px;
    }
    
    .conversation-history {
        max-width: none;
        width: 100%;
        max-height: 90vh;
    }
    
    .history-header,
    .history-content {
        padding: 16px;
    }
    
    .conversation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .conversation-actions {
        align-self: stretch;
        justify-content: flex-end;
    }
}

/* Custom Validation Error Styles */
.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 8px;
    display: block;
    line-height: 1.3;
}

.field-error-input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1) !important;
}

.form-error {
    background: #f8d7da;
    color: #721c24;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 8px;
    border: 1px solid #f5c6cb;
}

/* Dark Theme - Custom Validation Errors */
[data-bs-theme="dark"] .field-error {
    color: #f1959b;
}

[data-bs-theme="dark"] .field-error-input {
    border-color: #b02a37 !important;
    box-shadow: 0 0 0 2px rgba(176, 42, 55, 0.2) !important;
}

[data-bs-theme="dark"] .form-error {
    background: #2c0b0e;
    color: #f1959b;
    border-color: #491217;
}

/* Auto Theme - Custom Validation Errors */
    [data-bs-theme="auto"] .field-error {
        color: #f1959b;
    }

    [data-bs-theme="auto"] .field-error-input {
        border-color: #b02a37 !important;
        box-shadow: 0 0 0 2px rgba(176, 42, 55, 0.2) !important;
    }

    [data-bs-theme="auto"] .form-error {
        background: #2c0b0e;
        color: #f1959b;
        border-color: #491217;
    }