/* Templivo Chatbot Styles */

/* Reset and Base */
.templivo-chatbot-widget * {
    box-sizing: border-box;
}

/* Launcher Button */
.templivo-chatbot-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    transition: all 0.3s ease;
    font-family: Cairo, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.templivo-chatbot-badge{
    position:absolute;
    top:-6px;
    right:-6px;
    background:#ef4444;
    color:#fff;
    font-size:12px;
    line-height:18px;
    min-width:18px;
    height:18px;
    border-radius:9999px;
    text-align:center;
    padding:0 4px;
    display:none;
}

.templivo-chatbot-launcher:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.templivo-chatbot-launcher:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

/* Modal */
.templivo-chatbot-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    font-family: Cairo, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.templivo-chatbot-modal[aria-hidden="false"] {
    display: flex;
}

.templivo-chatbot-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.templivo-chatbot-modal__panel {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 100%;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    margin: auto;
    overflow: hidden;
}

/* Header */
.templivo-chatbot-modal__header {
    background: #0f172a;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.templivo-chatbot-modal__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.templivo-chatbot-modal__logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px;
    /* تحسين تحميل الشعار */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.templivo-chatbot-modal__title {
    font-size: 18px;
    font-weight: 600;
}

.templivo-chatbot-modal__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.templivo-chatbot-modal__new-btn,
.templivo-chatbot-modal__close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.templivo-chatbot-modal__new-btn:hover,
.templivo-chatbot-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.templivo-chatbot-modal__new-btn {
    background: #f59e0b;
    color: #0f172a;
}

.templivo-chatbot-modal__new-btn:hover {
    background: #d97706;
}

/* Body */
.templivo-chatbot-modal__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat List */
.templivo-chatbot-chat-list {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.templivo-chatbot-chat-list__header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.templivo-chatbot-chat-list__header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.templivo-chatbot-chat-list__items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.templivo-chatbot-chat-item {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid transparent;
}

.templivo-chatbot-chat-item:hover {
    background: #f9fafb;
}

.templivo-chatbot-chat-item--active {
    background: #eff6ff;
    border-color: #3b82f6;
}

.templivo-chatbot-chat-item__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.templivo-chatbot-chat-item__id {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.templivo-chatbot-chat-item__status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.templivo-chatbot-chat-item__status--open {
    background: #fef3c7;
    color: #92400e;
}

.templivo-chatbot-chat-item__status--pending {
    background: #fef3c7;
    color: #92400e;
}

.templivo-chatbot-chat-item__status--closed {
    background: #f3f4f6;
    color: #6b7280;
}

.templivo-chatbot-chat-item__preview {
    font-size: 14px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.templivo-chatbot-chat-item__time {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Chat View */
.templivo-chatbot-chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Messages */
.templivo-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* حاويات الرسائل الجديدة */
.templivo-chatbot-message-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
    position: relative;
    overflow: visible;
    margin-bottom: 16px;
}

/* تحسينات لرفع الملفات */
.templivo-chatbot-upload {
    position: relative;
    display: flex;
    align-items: center;
}

.templivo-chatbot-upload__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
}

.templivo-chatbot-upload__btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.templivo-chatbot-upload__btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

.templivo-chatbot-upload__btn:active {
    transform: scale(0.95);
}

/* تحسينات لعرض الملفات المرفوعة */
.templivo-chatbot-message__attachment {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.templivo-chatbot-message__attachment-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.templivo-chatbot-message__attachment-info {
    flex: 1;
    min-width: 0;
}

.templivo-chatbot-message__attachment-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.templivo-chatbot-message__attachment-size {
    font-size: 10px;
    opacity: 0.7;
}

.templivo-chatbot-message__attachment-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.templivo-chatbot-message__attachment-link:hover {
    text-decoration: underline;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* تحسينات لزر التحميل */
.templivo-chatbot-message__attachment-link[download] {
    cursor: pointer;
    position: relative;
}

.templivo-chatbot-message__attachment-link[download]:after {
    content: "⬇️";
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.7;
}

.templivo-chatbot-message__attachment-link[download]:hover:after {
    opacity: 1;
}

/* تحسينات لعرض الصور المرفوعة */
.templivo-chatbot-message__attachment-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.templivo-chatbot-message__attachment-image:hover {
    transform: scale(1.02);
}

/* زر تحميل الصور */
.templivo-chatbot-message__attachment-download {
    margin-top: 8px;
    text-align: center;
}

.templivo-chatbot-message__attachment-download-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    font-size: 12px;
    transition: all 0.2s ease;
}

.templivo-chatbot-message__attachment-download-link:hover {
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

/* Placeholder للمرفقات القديمة */
.templivo-chatbot-message__attachment-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.3);
}

.templivo-chatbot-message__attachment-note {
    margin-top: 4px;
    text-align: center;
    opacity: 0.7;
}

.templivo-chatbot-message__attachment-note small {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
}

/* تحسينات لعرض PDF */
.templivo-chatbot-message__attachment-pdf {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 8px;
    text-decoration: none;
    color: inherit;
}

.templivo-chatbot-message__attachment-pdf:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* تحسينات للروابط في الرسائل */
.templivo-chatbot-message__text a {
    color: inherit;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.templivo-chatbot-message__text a:hover {
    opacity: 0.8;
}

/* تحسينات للصور في الرسائل */
.templivo-chatbot-message__text img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
}

.templivo-chatbot-message__text img:hover {
    transform: scale(1.02);
}

/* نافذة منبثقة للصور */
.templivo-chatbot-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.templivo-chatbot-image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.templivo-chatbot-image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.templivo-chatbot-message-container--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.templivo-chatbot-message-container--admin,
.templivo-chatbot-message-container--bot {
    align-self: flex-start;
    flex-direction: row;
}

/* حاوية الأفاتار */
.templivo-chatbot-message-avatar-container {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* حاوية المحتوى */
.templivo-chatbot-message-content-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
}

.templivo-chatbot-message {
    display: block;
    position: relative;
    overflow: visible;
}

/* تم نقل هذه القواعد إلى الحاويات الجديدة */

.templivo-chatbot-message__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    background: #f3f4f6;
    /* تحسين تحميل الصور */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Special styling for admin avatar (templivo_man.png) */
.templivo-chatbot-message--admin .templivo-chatbot-message__avatar {
    border: 2px solid #f59e0b;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
    /* تحسين خاص لصورة templivo_man */
    object-fit: cover;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    /* تحسين تحميل الصور الكبيرة */
    transition: opacity 0.3s ease;
}

/* Special styling for user avatar */
.templivo-chatbot-message--user .templivo-chatbot-message__avatar {
    border: 2px solid #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* Loading state for avatars */
.templivo-chatbot-message__avatar[src=""] {
    background: #e5e7eb;
    position: relative;
}

.templivo-chatbot-message__avatar[src=""]::after {
    content: "👤";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #9ca3af;
}

.templivo-chatbot-message__content {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    min-height: 40px;
    padding-bottom: 20px;
    display: block;
    width: 100%;
}

.templivo-chatbot-message--user .templivo-chatbot-message__content {
    background: #3b82f6;
    color: white;
}

/* Override user message background based on status */
.templivo-chatbot-message--user.bubble--outgoing--sent .templivo-chatbot-message__content {
    background: #E5E7EB !important;
    color: #000 !important;
    padding-bottom: 20px !important;
}

.templivo-chatbot-message--user.bubble--outgoing--read .templivo-chatbot-message__content {
    background: #2563EB !important;
    color: #fff !important;
    padding-bottom: 20px !important;
}

/* Force status indicators to show */
.templivo-chatbot-message--user .templivo-chatbot-status {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    bottom: 2px !important;
    right: 6px !important;
    z-index: 10 !important;
}

/* Ensure status indicators are always visible */
.templivo-chatbot-status {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    bottom: 2px !important;
    right: 6px !important;
    z-index: 10 !important;
}

/* Force all status indicators to show */
.templivo-chatbot-message .templivo-chatbot-status {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    bottom: 2px !important;
    right: 6px !important;
    z-index: 10 !important;
}

.templivo-chatbot-message--bot .templivo-chatbot-message__content {
    background: #fef3c7;
    color: #92400e;
}

.templivo-chatbot-message--admin .templivo-chatbot-message__content {
    background: #fef3c7;
    color: #92400e;
}

.templivo-chatbot-message__text {
    margin: 0;
    line-height: 1.4;
}

.templivo-chatbot-message__time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.templivo-chatbot-message__meta {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Message status ticks */
.templivo-chatbot-status {
    display: inline-flex !important;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    font-size: 10px;
    position: absolute !important;
    bottom: 2px !important;
    right: 6px !important;
    z-index: 10 !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.templivo-chatbot-status__tick {
    opacity: 1 !important;
    font-size: 10px !important;
    line-height: 1 !important;
    display: inline-block !important;
    visibility: visible !important;
}

/* Status-specific styles */
.templivo-chatbot-status--sending .templivo-chatbot-status__spinner {
    width: 10px;
    height: 10px;
    border: 1px solid #9ca3af;
    border-top: 1px solid #3b82f6;
    border-radius: 50%;
    animation: templivo-spin 1s linear infinite;
    display: inline-block !important;
}

@keyframes templivo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.templivo-chatbot-status--sent .templivo-chatbot-status__tick { 
    color: #9ca3af !important; /* gray single tick */
    font-size: 10px !important;
    line-height: 1 !important;
}

.templivo-chatbot-status--delivered .templivo-chatbot-status__tick { 
    color: #9ca3af !important; /* gray double tick */
    font-size: 10px !important;
    line-height: 1 !important;
}

.templivo-chatbot-status--read .templivo-chatbot-status__tick { 
    color: #3b82f6 !important; /* blue double tick */
    font-size: 10px !important;
    line-height: 1 !important;
}

.templivo-chatbot-status--failed { 
    color: #ef4444; 
}

.templivo-chatbot-status__retry {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ef4444;
    background: #fef2f2;
    color: #ef4444;
    transition: all 0.2s ease;
    font-size: 10px;
    line-height: 1;
    display: inline-block !important;
}

.templivo-chatbot-status__retry:hover {
    background: #ef4444;
    color: white;
}

/* Message bubble status styles */
.bubble--outgoing {
    background: #E5E7EB !important; /* رمادي */
}

.bubble--outgoing.read {
    background: #2563EB !important; /* أزرق */
    color: #fff !important;
}

.bubble--outgoing--sending {
    background: #F3F4F6 !important;
    opacity: 0.8;
}

.bubble--outgoing--sent {
    background: #E5E7EB !important;
}

.bubble--outgoing--delivered {
    background: #E5E7EB !important;
}

.bubble--outgoing--read {
    background: #2563EB !important;
    color: #fff !important;
}

.bubble--outgoing--failed {
    background: #FEF2F2 !important;
    border: 1px solid #FECACA !important;
    color: #DC2626 !important;
}

.templivo-chatbot-message--user.bubble--outgoing--failed .templivo-chatbot-message__content {
    background: #FEF2F2 !important;
    border: 1px solid #FECACA !important;
    color: #DC2626 !important;
}


/* Typing Indicator */
.templivo-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px 16px;
}

.templivo-chatbot-typing__dots {
    display: flex;
    gap: 4px;
}

.templivo-chatbot-typing__dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: templivo-typing 1.4s infinite ease-in-out;
}

.templivo-chatbot-typing__dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.templivo-chatbot-typing__dots span:nth-child(3) {
    animation-delay: 0.4s;
}

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

.templivo-chatbot-typing__text {
    font-size: 14px;
    color: #6b7280;
}

/* Suggestions */
.templivo-chatbot-suggestions {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.templivo-chatbot-suggestion {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.templivo-chatbot-suggestion:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Footer */
.templivo-chatbot-modal__footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* Upload */
.templivo-chatbot-upload {
    position: relative;
}

.templivo-chatbot-upload__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.templivo-chatbot-upload__btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.templivo-chatbot-upload__btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Input */
.templivo-chatbot-input {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    padding: 8px 16px;
    transition: border-color 0.2s ease;
}

.templivo-chatbot-input:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.templivo-chatbot-input__field {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    min-height: 20px;
}

.templivo-chatbot-input__field::placeholder {
    color: #9ca3af;
}

.templivo-chatbot-input__send {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.templivo-chatbot-input__send:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.templivo-chatbot-input__send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Buttons */
.templivo-chatbot-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.templivo-chatbot-btn:hover {
    background: #2563eb;
}

.templivo-chatbot-btn--primary {
    background: #f59e0b;
    color: #0f172a;
}

.templivo-chatbot-btn--primary:hover {
    background: #d97706;
}

.templivo-chatbot-btn--secondary {
    background: #6b7280;
}

.templivo-chatbot-btn--secondary:hover {
    background: #4b5563;
}

/* Responsive */
/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .templivo-chatbot-modal__panel {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }
    
    .templivo-chatbot-launcher {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .templivo-chatbot-modal__header {
        padding: 12px 16px;
    }
    
    .templivo-chatbot-modal__brand {
        gap: 8px;
    }
    
    .templivo-chatbot-modal__brand-logo {
        width: 24px;
        height: 24px;
    }
    
    .templivo-chatbot-modal__brand-text {
        font-size: 16px;
    }
    
    .templivo-chatbot-modal__close {
        width: 32px;
        height: 32px;
    }
    
    .templivo-chatbot-modal__content {
        padding: 0;
    }
    
    .templivo-chatbot-messages {
        padding: 12px 16px;
    }
    
    .templivo-chatbot-message {
        margin-bottom: 12px;
    }
    
    .templivo-chatbot-message__content {
        padding: 10px 14px;
        max-width: 85%;
    }
    
    .templivo-chatbot-message__text {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .templivo-chatbot-message__time {
        font-size: 11px;
    }
    
    .templivo-chatbot-modal__footer {
        padding: 12px 16px;
    }
    
    .templivo-chatbot-input {
        gap: 8px;
    }
    
    .templivo-chatbot-input__field {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
    }
    
    .templivo-chatbot-input__send {
        width: 48px;
        height: 48px;
    }
    
    .templivo-chatbot-upload__btn {
        width: 40px;
        height: 40px;
    }
    
    /* Attachment styles for mobile */
    .templivo-chatbot-message__attachment-image {
        max-width: 200px;
        max-height: 200px;
    }
    
    .templivo-chatbot-message__attachment-link {
        padding: 8px 12px;
    }
    
    .templivo-chatbot-message__attachment-name {
        font-size: 13px;
    }
    
    .templivo-chatbot-message__attachment-size {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .templivo-chatbot-launcher {
        bottom: 12px;
        right: 12px;
        width: 52px;
        height: 52px;
    }
    
    .templivo-chatbot-modal__header {
        padding: 10px 12px;
    }
    
    .templivo-chatbot-modal__brand-text {
        font-size: 14px;
    }
    
    .templivo-chatbot-messages {
        padding: 8px 12px;
    }
    
    .templivo-chatbot-message__content {
        padding: 8px 12px;
        max-width: 90%;
    }
    
    .templivo-chatbot-message__text {
        font-size: 13px;
    }
    
    .templivo-chatbot-modal__footer {
        padding: 8px 12px;
    }
    
    .templivo-chatbot-input__field {
        padding: 10px 12px;
        font-size: 16px;
    }
    
    .templivo-chatbot-input__send {
        width: 44px;
        height: 44px;
    }
    
    .templivo-chatbot-upload__btn {
        width: 36px;
        height: 36px;
    }
    
    /* Smaller attachments on very small screens */
    .templivo-chatbot-message__attachment-image {
        max-width: 150px;
        max-height: 150px;
    }
}

/* RTL Support */
[dir="rtl"] .templivo-chatbot-launcher {
    right: auto;
    left: 20px;
}

[dir="rtl"] .templivo-chatbot-message--user {
    align-self: flex-start;
    flex-direction: row;
}

[dir="rtl"] .templivo-chatbot-message--bot,
[dir="rtl"] .templivo-chatbot-message--admin {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Loading States */
.templivo-chatbot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.templivo-chatbot-loading__spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: templivo-spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes templivo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.templivo-chatbot-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 20px;
    font-size: 14px;
    border: 1px solid #fecaca;
}

/* Empty States */
.templivo-chatbot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.templivo-chatbot-empty__icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.templivo-chatbot-empty__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.templivo-chatbot-empty__description {
    font-size: 14px;
    line-height: 1.4;
}

/* Welcome screen styles */
.templivo-chatbot-welcome {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.templivo-chatbot-welcome__header {
    text-align: center;
    margin-bottom: 20px;
}

.templivo-chatbot-welcome__title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.templivo-chatbot-welcome__chats {
    flex: 1;
    margin-bottom: 20px;
}

.templivo-chatbot-welcome__chats-title {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 12px 0;
}

.templivo-chatbot-welcome__chats-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.templivo-chatbot-welcome__chat-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.templivo-chatbot-welcome__chat-card:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.templivo-chatbot-welcome__chat-card.pending {
    border-left: 4px solid #f59e0b;
}

.templivo-chatbot-welcome__chat-card.open {
    border-left: 4px solid #f59e0b;
}

.templivo-chatbot-welcome__chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.templivo-chatbot-welcome__chat-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.templivo-chatbot-welcome__chat-status {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e5e7eb;
    color: #6b7280;
}

.templivo-chatbot-welcome__chat-card.pending .templivo-chatbot-welcome__chat-status {
    background: #fef3c7;
    color: #92400e;
}

.templivo-chatbot-welcome__chat-card.open .templivo-chatbot-welcome__chat-status {
    background: #fef3c7;
    color: #92400e;
}

.templivo-chatbot-welcome__chat-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.templivo-chatbot-welcome__chat-message {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.templivo-chatbot-welcome__chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.templivo-chatbot-welcome__chat-time {
    font-size: 11px;
    color: #9ca3af;
}

.templivo-chatbot-welcome__chat-unread {
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.templivo-chatbot-welcome__actions {
    margin-top: auto;
}

.templivo-chatbot-welcome__new-chat-btn {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.templivo-chatbot-welcome__new-chat-btn:hover {
    background: #2563eb;
}

.templivo-chatbot-welcome__new-chat-btn:active {
    background: #1d4ed8;
}

.templivo-chatbot-welcome__loading {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-size: 14px;
}

.templivo-chatbot-welcome__no-chats {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
    font-size: 14px;
    font-style: italic;
}

/* Admin Visual Notifications */
.templivo-chatbot-admin-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 300px;
    max-width: 400px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.templivo-chatbot-admin-notification:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.templivo-chatbot-admin-notification__content {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 12px;
}

.templivo-chatbot-admin-notification__icon {
    font-size: 24px;
    flex-shrink: 0;
}

.templivo-chatbot-admin-notification__text {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.templivo-chatbot-admin-notification__text strong {
    color: #1f2937;
    display: block;
    margin-bottom: 4px;
}

.templivo-chatbot-admin-notification__text small {
    color: #6b7280;
}

.templivo-chatbot-admin-notification__close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #9ca3af;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.templivo-chatbot-admin-notification__close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Chat item pulsing effect for new messages */
.templivo-chatbot-admin__chat-item--new-message {
    animation: pulse-new-message 1s ease-in-out 3;
    border-left: 4px solid #3b82f6 !important;
}

@keyframes pulse-new-message {
    0% { background-color: #dbeafe; }
    50% { background-color: #bfdbfe; }
    100% { background-color: #dbeafe; }
}

/* Enhanced unread badge */
.templivo-chatbot-admin__chat-item-unread {
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    animation: pulse-badge 1s ease-in-out infinite;
}

@keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}