/**
 * Chat Widget Styles
 * Floating popup chat widget for Sattaz.com
 * Requirements: 1.2, 1.5
 */

/* Widget Container */
.chat-widget-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.chat-widget-container.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Widget Popup */
.chat-widget-popup {
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 160px);
    background: var(--divback, #fff);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.chat-widget-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.chat-widget-status-dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}


.chat-widget-title {
    display: flex;
    flex-direction: column;
}

.chat-widget-title b {
    font-size: 16px;
    font-weight: 700;
}

.chat-widget-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.chat-widget-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    color: white;
}

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

/* Messages Container */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--main, #f5f5f5);
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    align-items: stretch;
}

/* Message Styles */
.chat-widget-message {
    display: flex;
    margin-bottom: 12px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
}

.chat-widget-message.animate {
    animation: slideIn 0.3s ease;
}

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

.chat-widget-message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.chat-widget-message.bot,
.chat-widget-message.admin {
    flex-direction: row;
    justify-content: flex-start;
}

.chat-widget-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-widget-message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    flex-shrink: 1;
    min-width: 0;
}

.chat-widget-message.user .chat-widget-message-content {
    align-items: flex-end;
}

.chat-widget-message.bot .chat-widget-message-content,
.chat-widget-message.admin .chat-widget-message-content {
    align-items: flex-start;
}

.chat-widget-label {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 4px;
    display: inline-block;
    width: fit-content;
}

.chat-widget-label.admin {
    background: #ef4444;
    color: white;
}

.chat-widget-label.bot {
    background: #667eea;
    color: white;
}

.chat-widget-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.chat-widget-message.user .chat-widget-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-widget-message.bot .chat-widget-bubble,
.chat-widget-message.admin .chat-widget-bubble {
    background: var(--divback, #fff);
    color: var(--text, #333);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-widget-message.admin .chat-widget-bubble {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.chat-widget-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

/* Typing Indicator */
.chat-widget-typing {
    display: none;
    padding: 12px 16px;
    background: var(--divback, #fff);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-widget-typing.show {
    display: flex;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text, #666);
    border-radius: 50%;
    animation: typing 1.4s infinite;
    opacity: 0.5;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}


/* Quick Actions */
.chat-widget-quick-actions {
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    background: var(--divback, #fff);
    border-top: 1px solid var(--border, #e5e5e5);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.chat-widget-quick-actions::-webkit-scrollbar {
    display: none;
}

.chat-widget-quick-btn {
    padding: 8px 14px;
    background: var(--bg, #f5f5f5);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 20px;
    color: var(--text, #333);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-widget-quick-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* Input Container */
.chat-widget-input-container {
    padding: 12px 16px;
    background: var(--divback, #fff);
    border-top: 1px solid var(--border, #e5e5e5);
    flex-shrink: 0;
}

.chat-widget-form {
    display: flex;
    gap: 10px;
}

.chat-widget-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border, #e5e5e5);
    border-radius: 25px;
    background: var(--bg, #f5f5f5);
    color: var(--text, #333);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.chat-widget-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.chat-widget-input::placeholder {
    color: var(--text, #999);
    opacity: 0.6;
}

.chat-widget-send-btn {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-widget-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-widget-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Notification Badge (Requirements 9.1) */
.chat-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
    animation: badge-pulse 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 2px 12px rgba(239, 68, 68, 0.7);
    }
}

.chat-notification-badge.hidden {
    display: none;
    animation: none;
}

/* Floating Chat Bubble Enhancement */
.floating-chat-bubble {
    position: fixed;
    bottom: 70px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.floating-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

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

/* Hide bubble when widget is open */
body.chat-widget-open .floating-chat-bubble {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}


/* Mobile Responsive - Full Screen Layout */
@media (max-width: 768px) {
    .chat-widget-container {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        transform: translateY(100%);
    }

    .chat-widget-container.open {
        transform: translateY(0);
    }

    .chat-widget-popup {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-widget-header {
        border-radius: 0;
        padding: 14px 16px;
    }

    .chat-widget-messages {
        padding: 12px;
    }

    .chat-widget-message-content {
        max-width: 85%;
    }

    .chat-widget-quick-actions {
        padding: 8px 12px;
    }

    .chat-widget-input-container {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .floating-chat-bubble {
        bottom: 75px;
        right: 15px;
        width: 52px;
        height: 52px;
    }
}

/* Dark Mode Support */
html[data-theme="dark"] .chat-widget-popup {
    background: var(--divback, #1a1a1a);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .chat-widget-messages {
    background: var(--main, #0d0d0d);
}

html[data-theme="dark"] .chat-widget-bubble {
    background: var(--divback, #2a2a2a);
    color: var(--text, #e5e5e5);
}

html[data-theme="dark"] .chat-widget-message.user .chat-widget-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

html[data-theme="dark"] .chat-widget-typing {
    background: var(--divback, #2a2a2a);
}

html[data-theme="dark"] .chat-widget-input {
    background: var(--main, #1a1a1a);
    border-color: var(--border, #333);
    color: var(--text, #e5e5e5);
}

html[data-theme="dark"] .chat-widget-input:focus {
    border-color: #667eea;
}

html[data-theme="dark"] .chat-widget-quick-btn {
    background: var(--main, #1a1a1a);
    border-color: var(--border, #333);
    color: var(--text, #e5e5e5);
}

html[data-theme="dark"] .chat-widget-quick-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

html[data-theme="dark"] .chat-widget-input-container,
html[data-theme="dark"] .chat-widget-quick-actions {
    background: var(--divback, #1a1a1a);
    border-color: var(--border, #333);
}

/* Light Mode Specific */
html[data-theme="light"] .chat-widget-input {
    background: #f9f9f9;
    color: #222;
    border-color: #ddd;
}

html[data-theme="light"] .chat-widget-quick-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
}

/* Scrollbar Styling */
.chat-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

html[data-theme="dark"] .chat-widget-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}


/* ============================================
   Image Upload Styles (Requirements 6.1, 6.5)
   ============================================ */

/* Hide the native file input completely */
.chat-widget-image-input,
input[type="file"].chat-widget-image-input,
#chatWidgetImageInput {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Image Upload Button */
.chat-widget-image-btn {
    width: 42px;
    height: 42px;
    background: var(--bg, #f5f5f5);
    border: 2px solid var(--border, #e5e5e5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    color: var(--text, #666);
}

.chat-widget-image-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
}

.chat-widget-image-btn:active {
    transform: scale(0.95);
}

/* Image Preview Container */
.chat-widget-image-preview {
    display: none;
    padding: 12px 16px;
    background: var(--divback, #fff);
    border-top: 1px solid var(--border, #e5e5e5);
    position: relative;
}

.chat-widget-image-preview.show {
    display: block;
}

.chat-widget-image-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    object-fit: contain;
}

.chat-widget-preview-remove {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}

.chat-widget-preview-remove:hover {
    background: rgba(239, 68, 68, 0.9);
}

/* Image Message Styles */
.chat-widget-message.image-message .chat-widget-bubble.image-bubble {
    padding: 6px;
    background: transparent;
    box-shadow: none;
}

.chat-widget-message.user.image-message .chat-widget-bubble.image-bubble {
    background: transparent;
}

.chat-widget-image-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
}

.chat-widget-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    display: block;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-widget-image:hover {
    transform: scale(1.02);
}

/* Fix broken image display */
.chat-widget-image[src=""],
.chat-widget-image:not([src]) {
    display: none;
}

.chat-widget-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 12px;
    color: white;
}

.chat-widget-image-container:hover .chat-widget-image-overlay {
    opacity: 1;
}

.chat-widget-caption {
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--divback, #fff);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-widget-message.user .chat-widget-caption {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Full Image Modal */
.chat-widget-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chat-widget-image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.chat-widget-image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    object-fit: contain;
}

.chat-widget-image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}

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

/* Dark Mode Image Styles */
html[data-theme="dark"] .chat-widget-image-btn {
    background: var(--main, #1a1a1a);
    border-color: var(--border, #333);
    color: var(--text, #e5e5e5);
}

html[data-theme="dark"] .chat-widget-image-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

html[data-theme="dark"] .chat-widget-image-preview {
    background: var(--divback, #1a1a1a);
    border-color: var(--border, #333);
}

html[data-theme="dark"] .chat-widget-caption {
    background: var(--divback, #2a2a2a);
    color: var(--text, #e5e5e5);
}

html[data-theme="dark"] .chat-widget-message.user .chat-widget-caption {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Mobile Responsive Image Styles */
@media (max-width: 768px) {
    .chat-widget-image {
        max-width: 180px;
        max-height: 180px;
    }
    
    .chat-widget-image-btn {
        width: 38px;
        height: 38px;
    }
    
    .chat-widget-image-preview img {
        max-height: 120px;
    }
}


/* ============================================
   Admin Joined Indicator (Requirements 5.4)
   ============================================ */

/* Admin Joined Indicator */
.chat-widget-admin-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 13px;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

.chat-widget-admin-indicator.show {
    display: flex;
}

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

.chat-widget-admin-indicator svg {
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

.chat-widget-admin-indicator span {
    white-space: nowrap;
}

/* Dark Mode Admin Indicator */
html[data-theme="dark"] .chat-widget-admin-indicator {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Mobile Responsive Admin Indicator */
@media (max-width: 768px) {
    .chat-widget-admin-indicator {
        padding: 8px 12px;
        font-size: 12px;
    }
}


/* ============================================
   WebRTC Screen Sharing Styles (Requirements 8.1-8.4)
   ============================================ */

/* Incoming Call Banner */
.chat-widget-incoming-call {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    animation: slideDown 0.3s ease;
}

.chat-widget-incoming-call.show {
    display: flex;
}

.chat-widget-incoming-call .call-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-widget-incoming-call .call-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ring 1s infinite;
}

@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-15deg); }
}

.chat-widget-incoming-call .call-text {
    font-size: 14px;
    font-weight: 600;
}

.chat-widget-incoming-call .call-type {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 400;
}

.chat-widget-incoming-call .call-actions {
    display: flex;
    gap: 8px;
}

.chat-widget-call-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-widget-call-btn.accept {
    background: white;
    color: #10b981;
}

.chat-widget-call-btn.accept:hover {
    background: #f0fdf4;
    transform: scale(1.05);
}

.chat-widget-call-btn.reject {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-widget-call-btn.reject:hover {
    background: #ef4444;
}

/* WebRTC Video Panel */
.chat-widget-video-panel {
    display: none;
    background: #000;
    position: relative;
}

.chat-widget-video-panel.show {
    display: block;
}

.chat-widget-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 200px;
    background: #1a1a1a;
}

.chat-widget-remote-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.chat-widget-local-video {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 80px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #333;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Video Panel Controls */
.chat-widget-video-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
}

.chat-widget-video-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
}

.chat-widget-video-btn.mute {
    background: rgba(255, 255, 255, 0.2);
}

.chat-widget-video-btn.mute:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-widget-video-btn.mute.active {
    background: #ef4444;
}

.chat-widget-video-btn.end-call {
    background: #ef4444;
    width: 50px;
    height: 50px;
}

.chat-widget-video-btn.end-call:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Connection Status */
.chat-widget-connection-status {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    font-size: 11px;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-widget-connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
}

.chat-widget-connection-status.connected .status-dot {
    background: #4ade80;
}

.chat-widget-connection-status.failed .status-dot {
    background: #ef4444;
}

/* Mobile Responsive WebRTC Styles */
@media (max-width: 768px) {
    .chat-widget-incoming-call {
        flex-direction: column;
        gap: 10px;
        padding: 14px 16px;
    }
    
    .chat-widget-incoming-call .call-info {
        width: 100%;
        justify-content: center;
    }
    
    .chat-widget-incoming-call .call-actions {
        width: 100%;
        justify-content: center;
    }
    
    .chat-widget-video-container {
        max-height: 180px;
    }
    
    .chat-widget-local-video {
        width: 60px;
        height: 45px;
        bottom: 8px;
        right: 8px;
    }
    
    .chat-widget-video-controls {
        gap: 10px;
        padding: 8px;
    }
    
    .chat-widget-video-btn {
        width: 36px;
        height: 36px;
    }
    
    .chat-widget-video-btn.end-call {
        width: 44px;
        height: 44px;
    }
}

/* Dark Mode WebRTC Styles */
html[data-theme="dark"] .chat-widget-video-panel {
    background: #0d0d0d;
}

html[data-theme="dark"] .chat-widget-video-container {
    background: #1a1a1a;
}

html[data-theme="dark"] .chat-widget-video-controls {
    background: rgba(0, 0, 0, 0.9);
}

/* ============================================
   Rich HTML Content Styles (Links, Lists, etc.)
   ============================================ */

/* Links inside chat bubbles */
.chat-widget-bubble a {
    color: #007bff;
    text-decoration: underline;
    word-break: break-word;
}

.chat-widget-bubble a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* User message links - lighter color for contrast */
.chat-widget-message.user .chat-widget-bubble a {
    color: #b3d4ff;
}

.chat-widget-message.user .chat-widget-bubble a:hover {
    color: #fff;
}

/* Admin message links */
.chat-widget-message.admin .chat-widget-bubble a {
    color: #ffd6e0;
}

.chat-widget-message.admin .chat-widget-bubble a:hover {
    color: #fff;
}

/* Lists inside chat bubbles */
.chat-widget-bubble ul,
.chat-widget-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-widget-bubble ul {
    list-style-type: disc;
}

.chat-widget-bubble ol {
    list-style-type: decimal;
}

.chat-widget-bubble li {
    margin: 4px 0;
    line-height: 1.5;
}

.chat-widget-bubble li a {
    display: inline;
}

/* Bold and strong text */
.chat-widget-bubble b,
.chat-widget-bubble strong {
    font-weight: 700;
}

/* Italic text */
.chat-widget-bubble i,
.chat-widget-bubble em {
    font-style: italic;
}

/* Paragraphs */
.chat-widget-bubble p {
    margin: 0 0 8px 0;
}

.chat-widget-bubble p:last-child {
    margin-bottom: 0;
}

/* Inline images from URLs */
.chat-widget-bubble .chat-inline-image {
    margin: 8px 0;
}

.chat-widget-bubble .chat-inline-image img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: block;
}

/* Buttons in chat */
.chat-widget-bubble .btn {
    display: inline-block;
    padding: 8px 16px;
    margin: 4px 2px;
    border-radius: 20px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.chat-widget-bubble .btn-primary,
.chat-widget-bubble .btn-sm.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border: none;
}

.chat-widget-bubble .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Bot/Admin bubble button adjustments */
.chat-widget-message.bot .chat-widget-bubble .btn-primary,
.chat-widget-message.admin .chat-widget-bubble .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* User bubble button - inverted */
.chat-widget-message.user .chat-widget-bubble .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Horizontal rules */
.chat-widget-bubble hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 12px 0;
}

html[data-theme="dark"] .chat-widget-bubble hr {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Code blocks */
.chat-widget-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

html[data-theme="dark"] .chat-widget-bubble code {
    background: rgba(255, 255, 255, 0.1);
}

.chat-widget-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

html[data-theme="dark"] .chat-widget-bubble pre {
    background: rgba(255, 255, 255, 0.05);
}

/* Dark mode link adjustments */
html[data-theme="dark"] .chat-widget-message.bot .chat-widget-bubble a,
html[data-theme="dark"] .chat-widget-bubble a {
    color: #6ea8fe;
}

html[data-theme="dark"] .chat-widget-message.bot .chat-widget-bubble a:hover,
html[data-theme="dark"] .chat-widget-bubble a:hover {
    color: #9ec5fe;
}
