/**
 * ImmigraSuite Admin - WhatsApp
 * WhatsApp Chat UI, Messages, Contacts
 */

/* ==========================================================================
   WhatsApp Chat UI
   ========================================================================== */

/* Main Chat Container */
.is-whatsapp-container {
    display: grid;
    grid-template-columns: 300px 1fr 280px;
    height: calc(100vh - 14rem);
    max-height: 700px;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgb(229 231 235);
    background: rgb(255 255 255);
    transition: grid-template-columns 0.2s ease-out;
}

.dark .is-whatsapp-container {
    border-color: rgb(55 65 81);
    background: rgb(31 41 55);
}

/* When contact panel is hidden */
.is-whatsapp-container.is-contact-hidden {
    grid-template-columns: 300px 1fr;
}

/* ==========================================================================
   Embedded Chat Container (used in Lead Quick-View WhatsApp tab)
   Self-contained, single-column chat pane with its own bounded height so
   the input area stays pinned to the bottom and messages scroll within.
   ========================================================================== */
.is-wa-container-embedded {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 20rem);
    min-height: 500px;
    max-height: 700px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgb(229 231 235);
    background: rgb(255 255 255);
}

.dark .is-wa-container-embedded {
    border-color: rgb(55 65 81);
    background: rgb(31 41 55);
}

.is-wa-container-embedded .is-wa-chat {
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* Conversations Panel */
.is-wa-conversations {
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgb(229 231 235);
    background: rgb(249 250 251);
    overflow: hidden;
}

.dark .is-wa-conversations {
    border-right-color: rgb(55 65 81);
    background: rgb(17 24 39);
}

.is-wa-conversations-header {
    padding: 16px;
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .is-wa-conversations-header {
    border-bottom-color: rgb(55 65 81);
}

.is-wa-conversations-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.is-wa-new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: rgb(34 197 94);
    background: rgb(240 253 244);
    border: 1px solid rgb(187 247 208);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.dark .is-wa-new-chat-btn {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: rgb(74 222 128);
}

.is-wa-new-chat-btn:hover {
    background: rgb(34 197 94);
    border-color: rgb(34 197 94);
    color: rgb(255 255 255);
    transform: scale(1.05);
}

.dark .is-wa-new-chat-btn:hover {
    background: rgb(34 197 94);
    border-color: rgb(34 197 94);
    color: rgb(255 255 255);
}

.is-wa-new-chat-icon {
    width: 20px;
    height: 20px;
}

/* Header Actions Container */
.is-wa-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Archive Toggle Button */
.is-wa-archive-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: rgb(107 114 128);
    background: rgb(243 244 246);
    border: 1px solid rgb(229 231 235);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.dark .is-wa-archive-toggle-btn {
    background: rgb(55 65 81);
    border-color: rgb(75 85 99);
    color: rgb(156 163 175);
}

.is-wa-archive-toggle-btn:hover {
    background: rgb(229 231 235);
    color: rgb(55 65 81);
}

.dark .is-wa-archive-toggle-btn:hover {
    background: rgb(75 85 99);
    color: rgb(209 213 219);
}

.is-wa-archive-toggle-btn.is-active {
    background: rgb(254 243 199);
    border-color: rgb(252 211 77);
    color: rgb(180 83 9);
}

.dark .is-wa-archive-toggle-btn.is-active {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.4);
    color: rgb(251 191 36);
}

.is-wa-archive-toggle-icon {
    width: 18px;
    height: 18px;
}

/* Unarchive Button Styling */
.is-wa-unarchive-btn {
    color: rgb(34 197 94) !important;
}

.is-wa-unarchive-btn:hover {
    background: rgb(240 253 244) !important;
    color: rgb(22 163 74) !important;
}

.dark .is-wa-unarchive-btn {
    color: rgb(74 222 128) !important;
}

.dark .is-wa-unarchive-btn:hover {
    background: rgba(34, 197, 94, 0.15) !important;
    color: rgb(134 239 172) !important;
}

.is-wa-conversations-title {
    font-size: 18px;
    font-weight: 700;
    color: rgb(17 24 39);
    margin-bottom: 4px;
}

.dark .is-wa-conversations-title {
    color: rgb(243 244 246);
}

.is-wa-conversations-subtitle {
    font-size: 13px;
    color: rgb(107 114 128);
}

.dark .is-wa-conversations-subtitle {
    color: rgb(156 163 175);
}

.is-wa-conversations-search {
    padding: 12px 16px;
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .is-wa-conversations-search {
    border-bottom-color: rgb(55 65 81);
}

.is-wa-search-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid rgb(209 213 219);
    border-radius: 8px;
    background: rgb(255 255 255);
    color: rgb(17 24 39);
}

.dark .is-wa-search-input {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
    color: rgb(243 244 246);
}

.is-wa-search-input:focus {
    outline: none;
    border-color: rgb(34 197 94);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.is-wa-conversations-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Conversation Item */
.is-wa-conversation {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgb(243 244 246);
    cursor: pointer;
    transition: background-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.dark .is-wa-conversation {
    border-bottom-color: rgb(55 65 81);
}

.is-wa-conversation:hover {
    background: rgb(243 244 246);
}

.dark .is-wa-conversation:hover {
    background: rgb(55 65 81);
}

.is-wa-conversation.is-active {
    background: rgb(255 255 255);
    border-left: 3px solid rgb(34 197 94);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .is-wa-conversation.is-active {
    background: rgb(55 65 81);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.is-wa-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(34 197 94), rgb(21 128 61));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.is-wa-avatar-icon {
    width: 20px;
    height: 20px;
    color: rgb(255 255 255);
}

.is-wa-avatar-text {
    font-size: 14px;
    font-weight: 600;
    color: rgb(255 255 255);
}

.is-wa-conversation-content {
    flex: 1;
    min-width: 0;
}

.is-wa-conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.is-wa-conversation-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.is-wa-conversation-name {
    font-size: 14px;
    font-weight: 600;
    color: rgb(17 24 39);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .is-wa-conversation-name {
    color: rgb(243 244 246);
}

.is-wa-conversation-time {
    font-size: 11px;
    color: rgb(156 163 175);
    flex-shrink: 0;
    white-space: nowrap;
}

.is-wa-conversation-preview {
    font-size: 13px;
    color: rgb(107 114 128);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .is-wa-conversation-preview {
    color: rgb(156 163 175);
}

.is-wa-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    color: rgb(255 255 255);
    background: rgb(34 197 94);
    border-radius: 10px;
}

/* Chat Panel */
.is-wa-chat {
    display: flex;
    flex-direction: column;
    background: rgb(255 255 255);
    overflow: hidden;
    min-height: 0;
}

.dark .is-wa-chat {
    background: rgb(31 41 55);
}

/* Chat Header */
.is-wa-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgb(229 231 235);
    background: rgb(249 250 251);
    flex-shrink: 0;
    min-height: 65px;
    box-sizing: border-box;
}

.dark .is-wa-chat-header {
    border-bottom-color: rgb(55 65 81);
    background: rgb(17 24 39);
}

.is-wa-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.is-wa-chat-header-details {
    display: flex;
    flex-direction: column;
}

.is-wa-chat-header-name {
    font-size: 15px;
    font-weight: 600;
    color: rgb(17 24 39);
}

.dark .is-wa-chat-header-name {
    color: rgb(243 244 246);
}

.is-wa-chat-header-phone {
    font-size: 12px;
    color: rgb(107 114 128);
}

.dark .is-wa-chat-header-phone {
    color: rgb(156 163 175);
}

/* Window Status Badge */
.is-wa-window-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 16px;
}

.is-wa-window-status.is-open {
    background: rgb(220 252 231);
    color: rgb(21 128 61);
}

.dark .is-wa-window-status.is-open {
    background: rgba(34, 197, 94, 0.2);
    color: rgb(134 239 172);
}

.is-wa-window-status.is-closed {
    background: rgb(254 243 199);
    color: rgb(161 98 7);
}

.dark .is-wa-window-status.is-closed {
    background: rgba(234, 179, 8, 0.2);
    color: rgb(253 224 71);
}

/* Session Expired - Purple */
.is-wa-window-status.is-expired {
    background: rgb(243 232 255);
    color: rgb(126 34 206);
}

.dark .is-wa-window-status.is-expired {
    background: rgba(168, 85, 247, 0.2);
    color: rgb(216 180 254);
}

/* New User - Orange */
.is-wa-window-status.is-new {
    background: rgb(255 237 213);
    color: rgb(194 65 12);
}

.dark .is-wa-window-status.is-new {
    background: rgba(249, 115, 22, 0.2);
    color: rgb(253 186 116);
}

.is-wa-window-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.is-wa-window-status.is-open .is-wa-window-dot {
    background: rgb(34 197 94);
    animation: is-wa-pulse 2s infinite;
}

.is-wa-window-status.is-closed .is-wa-window-dot {
    background: rgb(234 179 8);
}

.is-wa-window-status.is-expired .is-wa-window-dot {
    background: rgb(168 85 247);
}

.is-wa-window-status.is-new .is-wa-window-dot {
    background: rgb(249 115 22);
    animation: is-wa-pulse 2s infinite;
}

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

/* Messages Area */
.is-wa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e5e7eb' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-color: rgb(249 250 251);
}

.dark .is-wa-messages {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234b5563' fill-opacity='0.2'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-color: rgb(17 24 39);
}

/* Message Bubbles */
.is-wa-message {
    display: flex;
    margin-bottom: 8px;
}

.is-wa-message.is-outbound {
    justify-content: flex-end;
}

.is-wa-message.is-inbound {
    justify-content: flex-start;
}

.is-wa-bubble {
    max-width: 65%;
    padding: 6px 8px 6px 10px;
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.is-wa-message.is-outbound .is-wa-bubble {
    background: rgb(217 253 211);
    color: rgb(17 24 39);
    border-bottom-right-radius: 2px;
}

.dark .is-wa-message.is-outbound .is-wa-bubble {
    background: rgb(0 92 75);
    color: rgb(243 244 246);
}

.is-wa-message.is-inbound .is-wa-bubble {
    background: rgb(255 255 255);
    color: rgb(17 24 39);
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.dark .is-wa-message.is-inbound .is-wa-bubble {
    background: rgb(55 65 81);
    color: rgb(243 244 246);
}

.is-wa-bubble-text {
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.is-wa-bubble-footer {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
}

.is-wa-bubble-time {
    font-size: 10px;
    opacity: 0.55;
    white-space: nowrap;
}

.is-wa-bubble-status {
    width: 12px;
    height: 12px;
    opacity: 0.55;
}

/* Media Styles */
.is-wa-media-container {
    margin-bottom: 4px;
}

.is-wa-media-link {
    display: block;
}

img.is-wa-media-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
}

img.is-wa-media-image:hover {
    opacity: 0.9;
}

video.is-wa-media-video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    background: #000;
}

.is-wa-media-audio {
    width: 100%;
    min-width: 200px;
    border-radius: 20px;
}

.is-wa-document-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.dark .is-wa-document-link {
    background: rgba(255, 255, 255, 0.1);
}

.is-wa-document-link:hover {
    background: rgba(0, 0, 0, 0.1);
}

.dark .is-wa-document-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.is-wa-document-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.is-wa-media-caption {
    margin-top: 8px;
}

.is-wa-media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    color: rgb(107 114 128);
}

.dark .is-wa-media-placeholder {
    background: rgba(255, 255, 255, 0.1);
    color: rgb(156 163 175);
}

.is-wa-media-placeholder-icon {
    width: 40px;
    height: 40px;
    opacity: 0.5;
}

.is-wa-media-placeholder-text {
    font-size: 12px;
    opacity: 0.8;
}

/* Cloud Placeholder - for media synced to OneDrive after local cleanup */
.is-wa-cloud-placeholder {
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
    border: 1px dashed rgba(59, 130, 246, 0.3);
}

.dark .is-wa-cloud-placeholder {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.15));
    border-color: rgba(59, 130, 246, 0.4);
}

.is-wa-cloud-load-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 30px;
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgb(59 130 246);
}

.is-wa-cloud-load-btn:hover {
    background: rgba(59, 130, 246, 0.05);
}

.dark .is-wa-cloud-load-btn {
    color: rgb(96 165 250);
}

.dark .is-wa-cloud-load-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

.is-wa-cloud-load-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.is-wa-cloud-load-btn .is-wa-media-placeholder-icon {
    color: rgb(59 130 246);
    opacity: 0.8;
}

.dark .is-wa-cloud-load-btn .is-wa-media-placeholder-icon {
    color: rgb(96 165 250);
}

.is-wa-cloud-load-btn .is-wa-media-placeholder-text {
    color: rgb(59 130 246);
    font-weight: 500;
}

.dark .is-wa-cloud-load-btn .is-wa-media-placeholder-text {
    color: rgb(96 165 250);
}

.is-wa-cloud-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
}

.is-wa-cloud-icon {
    width: 16px;
    height: 16px;
    color: rgb(59 130 246);
    opacity: 0.6;
}

.dark .is-wa-cloud-icon {
    color: rgb(96 165 250);
}

/* Spinning animation for loading */
.is-wa-media-placeholder-icon.is-spinning {
    animation: spin 1s linear infinite;
}

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

/* Unsupported Message Type */
.is-wa-unsupported-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(156, 163, 175, 0.1);
    border-radius: 8px;
    border: 1px dashed rgb(209 213 219);
}

.dark .is-wa-unsupported-message {
    background: rgba(107, 114, 128, 0.15);
    border-color: rgb(75 85 99);
}

.is-wa-unsupported-icon {
    width: 20px;
    height: 20px;
    color: rgb(156 163 175);
    flex-shrink: 0;
}

.dark .is-wa-unsupported-icon {
    color: rgb(107 114 128);
}

.is-wa-unsupported-text {
    font-size: 13px;
    color: rgb(107 114 128);
    font-style: italic;
}

.dark .is-wa-unsupported-text {
    color: rgb(156 163 175);
}

/* Input Area */
.is-wa-input-area {
    padding: 16px;
    border-top: 1px solid rgb(229 231 235);
    background: rgb(249 250 251);
    flex-shrink: 0;
}

.dark .is-wa-input-area {
    border-top-color: rgb(55 65 81);
    background: rgb(17 24 39);
}

/* Window Warning */
.is-wa-window-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: rgb(254 243 199);
    border-radius: 8px;
    font-size: 13px;
    color: rgb(161 98 7);
}

.dark .is-wa-window-warning {
    background: rgba(234, 179, 8, 0.15);
    color: rgb(253 224 71);
}

.is-wa-window-warning-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.is-wa-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Attachment Button (+ icon) */
.is-wa-attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: rgb(107 114 128);
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.dark .is-wa-attach-btn {
    color: rgb(156 163 175);
}

.is-wa-attach-btn:hover {
    background: rgb(243 244 246);
    color: rgb(59 130 246);
}

.dark .is-wa-attach-btn:hover {
    background: rgb(55 65 81);
    color: rgb(96 165 250);
}

.is-wa-attach-icon {
    width: 24px;
    height: 24px;
}

.is-wa-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.is-wa-input {
    width: 100%;
    padding: 10px 48px 10px 14px;
    font-size: 14px;
    border: 1px solid rgb(209 213 219);
    border-radius: 20px;
    background: rgb(255 255 255);
    color: rgb(17 24 39);
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

.dark .is-wa-input {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
    color: rgb(243 244 246);
}

.is-wa-input:focus {
    outline: none;
    border-color: rgb(34 197 94);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.is-wa-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgb(34 197 94);
    color: rgb(255 255 255);
    border: none;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
}

.is-wa-send-btn:hover {
    background: rgb(21 128 61);
}

.is-wa-send-btn:active {
    transform: scale(0.95);
}

.is-wa-send-btn:disabled {
    background: rgb(209 213 219);
    cursor: not-allowed;
}

.dark .is-wa-send-btn:disabled {
    background: rgb(75 85 99);
}

.is-wa-send-icon {
    width: 20px;
    height: 20px;
}

/* Smart Send Button (when window is closed) */
.is-wa-send-btn.is-smart-send {
    background: linear-gradient(135deg, rgb(139 92 246), rgb(168 85 247));
}

.is-wa-send-btn.is-smart-send:hover {
    background: linear-gradient(135deg, rgb(124 58 237), rgb(147 51 234));
}

/* New User Button (orange) */
.is-wa-send-btn.is-new-user {
    background: linear-gradient(135deg, rgb(249 115 22), rgb(234 88 12));
}

.is-wa-send-btn.is-new-user:hover {
    background: linear-gradient(135deg, rgb(234 88 12), rgb(194 65 12));
}

/* Window Closed Notice */
.is-wa-window-closed-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    font-size: 13px;
    color: rgb(109 40 217);
}

.dark .is-wa-window-closed-notice {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(168, 85, 247, 0.15));
    border-color: rgba(139, 92, 246, 0.4);
    color: rgb(196 181 253);
}

.is-wa-window-closed-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: rgb(139 92 246);
}

.dark .is-wa-window-closed-icon {
    color: rgb(167 139 250);
}

.is-wa-template-choose-btn {
    margin-left: auto;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: rgb(109 40 217);
    background: rgb(255 255 255);
    border: 1px solid rgb(139 92 246);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.dark .is-wa-template-choose-btn {
    color: rgb(196 181 253);
    background: rgb(31 41 55);
    border-color: rgb(139 92 246);
}

.is-wa-template-choose-btn:hover {
    background: rgb(139 92 246);
    color: rgb(255 255 255);
}

.dark .is-wa-template-choose-btn:hover {
    background: rgb(139 92 246);
    color: rgb(255 255 255);
}

/* Input readonly state for smart send */
.is-wa-input[readonly] {
    background: rgb(243 244 246);
    cursor: default;
}

.dark .is-wa-input[readonly] {
    background: rgb(17 24 39);
}

/* Template Button */
.is-wa-template-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: rgb(107 114 128);
    background: rgb(255 255 255);
    border: 1px solid rgb(209 213 219);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.dark .is-wa-template-btn {
    background: rgb(31 41 55);
    border-color: rgb(75 85 99);
    color: rgb(156 163 175);
}

.is-wa-template-btn:hover {
    background: rgb(243 244 246);
    border-color: rgb(34 197 94);
    color: rgb(34 197 94);
}

/* Media Upload Button */
.is-wa-media-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: rgb(107 114 128);
    background: rgb(255 255 255);
    border: 1px solid rgb(209 213 219);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.dark .is-wa-media-btn {
    background: rgb(31 41 55);
    border-color: rgb(75 85 99);
    color: rgb(156 163 175);
}

.is-wa-media-btn:hover {
    background: rgb(243 244 246);
    border-color: rgb(59 130 246);
    color: rgb(59 130 246);
}

.dark .is-wa-media-btn:hover {
    background: rgb(55 65 81);
    border-color: rgb(96 165 250);
    color: rgb(96 165 250);
}

.is-wa-media-btn-icon {
    width: 20px;
    height: 20px;
}

/* Emoji Picker Styles */
.is-wa-emoji-picker-container {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.is-wa-emoji-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: rgb(156 163 175);
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.dark .is-wa-emoji-btn {
    color: rgb(107 114 128);
}

.is-wa-emoji-btn:hover {
    color: rgb(107 114 128);
}

.dark .is-wa-emoji-btn:hover {
    color: rgb(156 163 175);
}

.is-wa-emoji-btn-icon {
    width: 22px;
    height: 22px;
}

.is-wa-emoji-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: -8px;
    width: 320px;
    background: rgb(255 255 255);
    border: 1px solid rgb(209 213 219);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 50;
    overflow: hidden;
}

.dark .is-wa-emoji-dropdown {
    background: rgb(31 41 55);
    border-color: rgb(75 85 99);
}

.is-wa-emoji-tabs {
    display: flex;
    flex-direction: column;
}

.is-wa-emoji-tab-buttons {
    display: flex;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid rgb(229 231 235);
    background: rgb(249 250 251);
}

.dark .is-wa-emoji-tab-buttons {
    background: rgb(17 24 39);
    border-color: rgb(55 65 81);
}

.is-wa-emoji-tab {
    padding: 6px 10px;
    font-size: 18px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.is-wa-emoji-tab:hover {
    background: rgb(229 231 235);
}

.dark .is-wa-emoji-tab:hover {
    background: rgb(55 65 81);
}

.is-wa-emoji-tab.active {
    background: rgb(59 130 246);
}

.dark .is-wa-emoji-tab.active {
    background: rgb(37 99 235);
}

.is-wa-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.is-wa-emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    font-size: 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
}

.is-wa-emoji-item:hover {
    background: rgb(243 244 246);
    transform: scale(1.2);
}

.dark .is-wa-emoji-item:hover {
    background: rgb(55 65 81);
}

/* Media Upload Modal Styles */
.is-wa-media-upload-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.is-wa-upload-area {
    border: 2px dashed rgb(209 213 219);
    border-radius: 12px;
    transition: all 0.2s;
    background: rgb(249 250 251);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .is-wa-upload-area {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
}

.is-wa-upload-area.is-dragging {
    border-color: rgb(34 197 94);
    background: rgba(34, 197, 94, 0.05);
}

.is-wa-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.is-wa-upload-icon {
    width: 48px;
    height: 48px;
    color: rgb(156 163 175);
    margin-bottom: 12px;
}

.is-wa-upload-text {
    font-size: 14px;
    font-weight: 500;
    color: rgb(55 65 81);
    margin-bottom: 4px;
}

.dark .is-wa-upload-text {
    color: rgb(229 231 235);
}

.is-wa-upload-hint {
    font-size: 12px;
    color: rgb(107 114 128);
}

.dark .is-wa-upload-hint {
    color: rgb(156 163 175);
}

.is-wa-upload-input {
    display: none;
}

/* Upload Preview */
.is-wa-upload-preview {
    position: relative;
    padding: 16px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.is-wa-upload-preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
}

.is-wa-upload-preview-video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

.is-wa-upload-preview-document {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.dark .is-wa-upload-preview-document {
    background: rgba(255, 255, 255, 0.1);
}

.is-wa-upload-preview-icon {
    width: 48px;
    height: 48px;
    color: rgb(107 114 128);
}

.is-wa-upload-preview-filename {
    font-size: 14px;
    color: rgb(55 65 81);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dark .is-wa-upload-preview-filename {
    color: rgb(229 231 235);
}

.is-wa-upload-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px;
    background: rgb(239 68 68);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
}

.is-wa-upload-remove:hover {
    background: rgb(220 38 38);
}

/* Caption Input */
.is-wa-caption-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.is-wa-caption-label {
    font-size: 13px;
    font-weight: 500;
    color: rgb(55 65 81);
}

.dark .is-wa-caption-label {
    color: rgb(229 231 235);
}

.is-wa-caption-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid rgb(209 213 219);
    border-radius: 8px;
    background: rgb(255 255 255);
    color: rgb(17 24 39);
    resize: none;
}

.dark .is-wa-caption-textarea {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
    color: rgb(243 244 246);
}

.is-wa-caption-textarea:focus {
    outline: none;
    border-color: rgb(34 197 94);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

/* Upload Loading State */
.is-wa-upload-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: rgb(107 114 128);
    font-size: 14px;
}

.is-wa-upload-spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.dark .is-wa-template-btn:hover {
    background: rgb(55 65 81);
    border-color: rgb(34 197 94);
    color: rgb(34 197 94);
}

.is-wa-template-icon {
    width: 20px;
    height: 20px;
}

/* Window Closed - Send Template Button */
.is-wa-window-closed-row {
    justify-content: center;
}

.is-wa-send-template-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: rgb(255 255 255);
    background: rgb(34 197 94);
    border: none;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.15s;
}

.is-wa-send-template-btn:hover {
    background: rgb(22 163 74);
    transform: scale(1.02);
}

.dark .is-wa-send-template-btn {
    background: rgb(34 197 94);
}

.dark .is-wa-send-template-btn:hover {
    background: rgb(22 163 74);
}

.is-wa-send-template-icon {
    width: 20px;
    height: 20px;
}

/* New Conversation Form */
.is-wa-new-conversation-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.is-wa-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.is-wa-form-label {
    font-size: 14px;
    font-weight: 500;
    color: rgb(55 65 81);
}

.dark .is-wa-form-label {
    color: rgb(209 213 219);
}

.is-wa-required {
    color: rgb(239 68 68);
}

.is-wa-phone-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid rgb(209 213 219);
    border-radius: 8px;
    background: rgb(255 255 255);
    overflow: hidden;
}

.dark .is-wa-phone-input-wrapper {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
}

.is-wa-phone-input-wrapper:focus-within {
    border-color: rgb(34 197 94);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.is-wa-phone-prefix {
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: rgb(107 114 128);
    background: rgb(249 250 251);
    border-right: 1px solid rgb(209 213 219);
}

.dark .is-wa-phone-prefix {
    color: rgb(156 163 175);
    background: rgb(55 65 81);
    border-color: rgb(75 85 99);
}

.is-wa-phone-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    border: none;
    background: transparent;
    color: rgb(17 24 39);
    outline: none;
}

.dark .is-wa-phone-input {
    color: rgb(243 244 246);
}

.is-wa-form-input,
.is-wa-form-select {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid rgb(209 213 219);
    border-radius: 8px;
    background: rgb(255 255 255);
    color: rgb(17 24 39);
}

.dark .is-wa-form-input,
.dark .is-wa-form-select {
    border-color: rgb(75 85 99);
    background: rgb(31 41 55);
    color: rgb(243 244 246);
}

.is-wa-form-input:focus,
.is-wa-form-select:focus {
    outline: none;
    border-color: rgb(34 197 94);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.is-wa-form-hint {
    font-size: 12px;
    color: rgb(107 114 128);
}

.dark .is-wa-form-hint {
    color: rgb(156 163 175);
}

/* Contact Panel */
.is-wa-contact-panel {
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgb(229 231 235);
    background: rgb(249 250 251);
}

.dark .is-wa-contact-panel {
    border-left-color: rgb(55 65 81);
    background: rgb(17 24 39);
}

.is-wa-contact-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgb(229 231 235);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 65px;
    box-sizing: border-box;
}

.dark .is-wa-contact-header {
    border-bottom-color: rgb(55 65 81);
}

.is-wa-contact-title {
    font-size: 14px;
    font-weight: 600;
    color: rgb(17 24 39);
}

.dark .is-wa-contact-title {
    color: rgb(243 244 246);
}

.is-wa-contact-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: rgb(107 114 128);
    cursor: pointer;
    transition: all 0.15s;
}

.is-wa-contact-close:hover {
    background: rgb(229 231 235);
    color: rgb(55 65 81);
}

.dark .is-wa-contact-close:hover {
    background: rgb(55 65 81);
    color: rgb(156 163 175);
}

.is-wa-contact-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Contact Profile */
.is-wa-contact-profile {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid rgb(229 231 235);
    margin-bottom: 16px;
}

.dark .is-wa-contact-profile {
    border-bottom-color: rgb(55 65 81);
}

.is-wa-contact-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(34 197 94), rgb(21 128 61));
    display: flex;
    align-items: center;
    justify-content: center;
}

.is-wa-contact-avatar-icon {
    width: 40px;
    height: 40px;
    color: rgb(255 255 255);
}

.is-wa-contact-name {
    font-size: 16px;
    font-weight: 600;
    color: rgb(17 24 39);
    margin-bottom: 4px;
}

.dark .is-wa-contact-name {
    color: rgb(243 244 246);
}

.is-wa-contact-phone {
    font-size: 14px;
    color: rgb(107 114 128);
}

.dark .is-wa-contact-phone {
    color: rgb(156 163 175);
}

.is-wa-contact-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.is-wa-contact-type-badge.is-lead {
    background: rgb(254 243 199);
    color: rgb(161 98 7);
}

.dark .is-wa-contact-type-badge.is-lead {
    background: rgba(234, 179, 8, 0.2);
    color: rgb(253 224 71);
}

.is-wa-contact-type-badge.is-client {
    background: rgb(220 252 231);
    color: rgb(21 128 61);
}

.dark .is-wa-contact-type-badge.is-client {
    background: rgba(34, 197, 94, 0.2);
    color: rgb(134 239 172);
}

/* Contact Info Section */
.is-wa-contact-section {
    margin-bottom: 16px;
}

.is-wa-contact-section-title {
    font-size: 11px;
    font-weight: 600;
    color: rgb(107 114 128);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.dark .is-wa-contact-section-title {
    color: rgb(156 163 175);
}

.is-wa-contact-info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
}

.is-wa-contact-info-icon {
    width: 16px;
    height: 16px;
    color: rgb(156 163 175);
    flex-shrink: 0;
    margin-top: 2px;
}

.is-wa-contact-info-content {
    flex: 1;
}

.is-wa-contact-info-label {
    font-size: 11px;
    color: rgb(156 163 175);
    margin-bottom: 2px;
}

.is-wa-contact-info-value {
    font-size: 13px;
    color: rgb(17 24 39);
    word-break: break-word;
}

.dark .is-wa-contact-info-value {
    color: rgb(243 244 246);
}

.is-wa-contact-info-value a {
    color: rgb(37 99 235);
}

.dark .is-wa-contact-info-value a {
    color: rgb(96 165 250);
}

/* Quick Actions */
.is-wa-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgb(229 231 235);
}

.dark .is-wa-quick-actions {
    border-top-color: rgb(55 65 81);
}

.is-wa-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    font-size: 12px;
    color: rgb(107 114 128);
    background: rgb(255 255 255);
    border: 1px solid rgb(229 231 235);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.dark .is-wa-quick-action {
    background: rgb(31 41 55);
    border-color: rgb(55 65 81);
    color: rgb(156 163 175);
}

.is-wa-quick-action:hover {
    background: rgb(243 244 246);
    border-color: rgb(156 163 175);
    color: rgb(55 65 81);
}

.dark .is-wa-quick-action:hover {
    background: rgb(55 65 81);
    color: rgb(243 244 246);
}

.is-wa-quick-action-icon {
    width: 20px;
    height: 20px;
}

/* Compact Contact Panel */
.is-wa-contact-body.is-compact {
    padding: 12px;
}

.is-wa-contact-profile-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgb(229 231 235);
    margin-bottom: 10px;
}

.dark .is-wa-contact-profile-compact {
    border-bottom-color: rgb(55 65 81);
}

.is-wa-contact-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(34 197 94), rgb(21 128 61));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.is-wa-contact-avatar-sm .is-wa-avatar-text {
    font-size: 14px;
    color: rgb(255 255 255);
}

.is-wa-contact-avatar-sm .is-wa-contact-avatar-icon {
    width: 18px;
    height: 18px;
    color: rgb(255 255 255);
}

.is-wa-contact-profile-info {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.is-wa-contact-name-sm {
    font-size: 13px;
    font-weight: 600;
    color: rgb(17 24 39);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
}

.dark .is-wa-contact-name-sm {
    color: rgb(243 244 246);
}

.is-wa-contact-phone-sm {
    font-size: 11px;
    color: rgb(107 114 128);
}

.dark .is-wa-contact-phone-sm {
    color: rgb(156 163 175);
}

.is-wa-contact-type-badge-sm {
    font-size: 9px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.is-wa-contact-type-badge-sm.is-lead {
    background: rgb(254 243 199);
    color: rgb(161 98 7);
}

.dark .is-wa-contact-type-badge-sm.is-lead {
    background: rgba(234, 179, 8, 0.2);
    color: rgb(253 224 71);
}

.is-wa-contact-type-badge-sm.is-client {
    background: rgb(220 252 231);
    color: rgb(21 128 61);
}

.dark .is-wa-contact-type-badge-sm.is-client {
    background: rgba(34, 197, 94, 0.2);
    color: rgb(134 239 172);
}

/* Compact Contact Rows */
.is-wa-contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
}

.is-wa-contact-row-icon {
    width: 14px;
    height: 14px;
    color: rgb(156 163 175);
    flex-shrink: 0;
}

.is-wa-contact-row-label {
    color: rgb(107 114 128);
    flex-shrink: 0;
}

.dark .is-wa-contact-row-label {
    color: rgb(156 163 175);
}

.is-wa-contact-row-value {
    color: rgb(17 24 39);
}

.dark .is-wa-contact-row-value {
    color: rgb(243 244 246);
}

.is-wa-contact-row-value.is-open {
    color: rgb(34 197 94);
    font-weight: 500;
}

.is-wa-contact-row-value.is-closed {
    color: rgb(234 179 8);
    font-weight: 500;
}

.is-wa-contact-row-link {
    color: rgb(37 99 235);
    text-decoration: none;
}

.is-wa-contact-row-link:hover {
    text-decoration: underline;
}

.dark .is-wa-contact-row-link {
    color: rgb(96 165 250);
}

/* Compact Actions */
.is-wa-contact-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgb(229 231 235);
}

.dark .is-wa-contact-actions {
    border-top-color: rgb(55 65 81);
}

.is-wa-contact-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: rgb(55 65 81);
    background: rgb(243 244 246);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.is-wa-contact-action-btn:hover {
    background: rgb(229 231 235);
    color: rgb(17 24 39);
}

.dark .is-wa-contact-action-btn {
    background: rgb(55 65 81);
    color: rgb(156 163 175);
}

.dark .is-wa-contact-action-btn:hover {
    background: rgb(75 85 99);
    color: rgb(243 244 246);
}

/* Empty State */
.is-wa-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 32px;
    text-align: center;
}

.is-wa-empty-icon {
    width: 64px;
    height: 64px;
    color: rgb(209 213 219);
    margin-bottom: 16px;
}

.dark .is-wa-empty-icon {
    color: rgb(75 85 99);
}

.is-wa-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: rgb(17 24 39);
    margin-bottom: 8px;
}

.dark .is-wa-empty-title {
    color: rgb(243 244 246);
}

.is-wa-empty-text {
    font-size: 14px;
    color: rgb(107 114 128);
    max-width: 280px;
}

.dark .is-wa-empty-text {
    color: rgb(156 163 175);
}

/* Date Divider */
.is-wa-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
}

.is-wa-date-divider-text {
    padding: 4px 12px;
    font-size: 12px;
    color: rgb(107 114 128);
    background: rgb(229 231 235);
    border-radius: 12px;
}

.dark .is-wa-date-divider-text {
    background: rgb(55 65 81);
    color: rgb(156 163 175);
}

/* Template Selector Modal */
.is-wa-template-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.is-wa-template-item {
    padding: 12px;
    border: 1px solid rgb(229 231 235);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.dark .is-wa-template-item {
    border-color: rgb(55 65 81);
}

.is-wa-template-item:hover {
    border-color: rgb(34 197 94);
    background: rgb(240 253 244);
}

.dark .is-wa-template-item:hover {
    background: rgba(34, 197, 94, 0.1);
}

.is-wa-template-item.is-selected {
    border-color: rgb(34 197 94);
    background: rgb(220 252 231);
}

.dark .is-wa-template-item.is-selected {
    background: rgba(34, 197, 94, 0.2);
}

.is-wa-template-name {
    font-size: 14px;
    font-weight: 600;
    color: rgb(17 24 39);
    margin-bottom: 4px;
}

.dark .is-wa-template-name {
    color: rgb(243 244 246);
}

.is-wa-template-preview {
    font-size: 13px;
    color: rgb(107 114 128);
    line-height: 1.4;
}

.dark .is-wa-template-preview {
    color: rgb(156 163 175);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .is-whatsapp-container {
        grid-template-columns: 280px 1fr 260px;
    }
    
    .is-whatsapp-container.is-contact-hidden {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 1024px) {
    .is-whatsapp-container {
        grid-template-columns: 260px 1fr;
    }
    
    .is-wa-contact-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .is-whatsapp-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 8rem);
    }
    
    .is-wa-conversations {
        display: none;
    }
    
    .is-whatsapp-container.is-show-conversations .is-wa-conversations {
        display: flex;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        z-index: 10;
    }
}

/* ==========================================================================
   WhatsApp Template Preview
   ========================================================================== */

/* WhatsApp Template Form - Preview Section (sticky sidebar) */
.is-wa-preview-section {
    position: sticky;
    top: 1rem;
    align-self: start;
}

/* Simple Template Preview (no phone frame) */
.is-wa-template-preview-simple {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.is-wa-template-preview-simple .is-wa-category-badge {
    align-self: flex-start;
    margin: 0;
}

.is-wa-template-preview-simple .is-wa-message-bubble {
    background: rgb(217 253 211) !important;
    border-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    margin: 0 !important;
    max-width: 100% !important;
}

.dark .is-wa-template-preview-simple .is-wa-message-bubble {
    background: rgb(0 92 75) !important;
}

.is-wa-template-preview-simple .is-wa-msg-header {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 8px !important;
}

.is-wa-template-preview-simple .is-wa-msg-footer {
    border-top: none !important;
    padding-top: 8px !important;
    margin-top: 8px !important;
}

.is-wa-template-preview-simple .is-wa-msg-body {
    font-size: 14px;
    line-height: 1.5;
    color: rgb(17 24 39);
}

.dark .is-wa-template-preview-simple .is-wa-msg-body {
    color: rgb(243 244 246);
}

.is-wa-template-preview-simple .is-wa-msg-time {
    text-align: right;
    font-size: 11px;
    color: rgb(107 114 128);
    margin-top: 4px;
}

.is-wa-template-preview-simple .is-wa-buttons {
    margin: 0;
}

.is-wa-template-preview-simple .is-wa-variables-legend {
    margin: 0;
    padding: 8px;
    background: rgb(249 250 251);
    border-radius: 6px;
}

.dark .is-wa-template-preview-simple .is-wa-variables-legend {
    background: rgb(31 41 55);
}

/* Template Preview Container (phone frame version - legacy) */
.is-wa-template-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 8px;
}

/* Phone Frame */
.is-wa-phone-frame {
    width: 100%;
    max-width: 280px;
    background: rgb(17 24 39);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.dark .is-wa-phone-frame {
    background: rgb(31 41 55);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Phone Header (notch area) */
.is-wa-phone-header {
    background: rgb(17 24 39);
    padding: 8px 0;
    display: flex;
    justify-content: center;
}

.dark .is-wa-phone-header {
    background: rgb(31 41 55);
}

.is-wa-phone-notch {
    width: 80px;
    height: 20px;
    background: rgb(0 0 0);
    border-radius: 10px;
}

/* Preview Chat Header */
.is-wa-template-preview .is-wa-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgb(0 92 75);
    border: none;
}

.is-wa-template-preview .is-wa-chat-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.is-wa-template-preview .is-wa-chat-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.is-wa-template-preview .is-wa-chat-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.is-wa-template-preview .is-wa-chat-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

/* Preview Chat Area */
.is-wa-chat-area {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e5e7eb' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-color: rgb(236 229 221);
    padding: 12px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dark .is-wa-chat-area {
    background-color: rgb(11 20 26);
}

/* Category Badge */
.is-wa-category-badge {
    align-self: center;
    padding: 4px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
    margin-bottom: 4px;
}

.is-wa-category-badge.is-category-utility {
    background: rgb(220 252 231);
    color: rgb(21 128 61);
}

.dark .is-wa-category-badge.is-category-utility {
    background: rgba(34, 197, 94, 0.2);
    color: rgb(134 239 172);
}

.is-wa-category-badge.is-category-marketing {
    background: rgb(254 226 226);
    color: rgb(185 28 28);
}

.dark .is-wa-category-badge.is-category-marketing {
    background: rgba(239, 68, 68, 0.2);
    color: rgb(252 165 165);
}

.is-wa-category-badge.is-category-auth {
    background: rgb(224 231 255);
    color: rgb(67 56 202);
}

.dark .is-wa-category-badge.is-category-auth {
    background: rgba(99, 102, 241, 0.2);
    color: rgb(165 180 252);
}

/* Preview Message Bubble */
.is-wa-message-bubble {
    background: white;
    border-radius: 8px;
    border-bottom-left-radius: 0;
    padding: 8px 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 95%;
    position: relative;
}

.dark .is-wa-message-bubble {
    background: rgb(32 44 51);
}

.is-wa-msg-header {
    font-weight: 700;
    font-size: 13px;
    color: rgb(17 24 39);
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .is-wa-msg-header {
    color: rgb(243 244 246);
    border-bottom-color: rgb(55 65 81);
}

.is-wa-msg-body {
    font-size: 13px;
    color: rgb(17 24 39);
    line-height: 1.4;
    white-space: pre-line;
    word-break: break-word;
}

.dark .is-wa-msg-body {
    color: rgb(243 244 246);
}

.is-wa-msg-footer {
    font-size: 11px;
    color: rgb(107 114 128);
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid rgb(229 231 235);
    font-style: italic;
}

.dark .is-wa-msg-footer {
    color: rgb(156 163 175);
    border-top-color: rgb(55 65 81);
}

.is-wa-msg-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    font-size: 10px;
    color: rgb(156 163 175);
}

.is-wa-msg-time svg {
    color: rgb(52 211 153);
}

/* Variable Highlight */
.is-wa-variable {
    background: rgb(254 249 195);
    color: rgb(161 98 7);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 12px;
}

.dark .is-wa-variable {
    background: rgba(234, 179, 8, 0.2);
    color: rgb(253 224 71);
}

/* Preview Buttons */
.is-wa-buttons {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 4px;
}

.is-wa-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    background: white;
    border: 1px solid rgb(229 231 235);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: rgb(37 99 235);
    cursor: default;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .is-wa-button {
    background: rgb(32 44 51);
    border-color: rgb(55 65 81);
    color: rgb(96 165 250);
}

.is-wa-button svg {
    width: 14px;
    height: 14px;
}

/* Preview Input Area */
.is-wa-template-preview .is-wa-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgb(240 242 245);
    border: none;
}

.dark .is-wa-template-preview .is-wa-input-area {
    background: rgb(32 44 51);
}

.is-wa-template-preview .is-wa-input-box {
    flex: 1;
    padding: 8px 12px;
    background: white;
    border-radius: 20px;
    font-size: 12px;
    color: rgb(156 163 175);
}

.dark .is-wa-template-preview .is-wa-input-box {
    background: rgb(43 57 66);
    color: rgb(107 114 128);
}

.is-wa-template-preview .is-wa-send-btn {
    width: 36px;
    height: 36px;
    background: rgb(0 168 132);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
}

.is-wa-template-preview .is-wa-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Variables Legend */
.is-wa-variables-legend {
    width: 100%;
    max-width: 280px;
    background: rgb(249 250 251);
    border: 1px solid rgb(229 231 235);
    border-radius: 8px;
    padding: 10px 12px;
}

.dark .is-wa-variables-legend {
    background: rgb(31 41 55);
    border-color: rgb(55 65 81);
}

.is-wa-legend-title {
    font-size: 11px;
    font-weight: 600;
    color: rgb(107 114 128);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.dark .is-wa-legend-title {
    color: rgb(156 163 175);
}

.is-wa-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
}

.is-wa-legend-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 4px;
    background: rgb(254 249 195);
    color: rgb(161 98 7);
    border-radius: 3px;
    font-weight: 600;
    font-size: 10px;
}

.dark .is-wa-legend-placeholder {
    background: rgba(234, 179, 8, 0.2);
    color: rgb(253 224 71);
}

.is-wa-legend-name {
    color: rgb(55 65 81);
}

.dark .is-wa-legend-name {
    color: rgb(209 213 219);
}

/* ==========================================================================
   Template Preview - Media Headers
   ========================================================================== */

/* Media Header Container */
.is-wa-media-header {
    margin: -12px -12px 12px -12px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.is-wa-template-preview-simple .is-wa-message-bubble {
    overflow: visible !important;
}

.is-wa-template-preview-simple .is-wa-media-header {
    position: relative;
    left: -12px;
    width: calc(100% + 24px);
    margin: -12px 0 12px 0;
    display: block;
}

/* Media Preview Image */
.is-wa-media-preview {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

/* Media Placeholder (when no URL or for video/document) */
.is-wa-media-header .is-wa-media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    background: linear-gradient(135deg, rgb(229 231 235), rgb(209 213 219));
    color: rgb(107 114 128);
    text-align: center;
    min-height: 80px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    border-radius: 0;
    margin: 0;
}

.dark .is-wa-media-header .is-wa-media-placeholder {
    background: linear-gradient(135deg, rgb(55 65 81), rgb(75 85 99));
    color: rgb(156 163 175);
}

.is-wa-media-header .is-wa-media-placeholder span {
    font-size: 12px;
    font-weight: 500;
}

/* Media Icon Sizing */
.is-wa-media-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.is-wa-play-icon {
    width: 24px;
    height: 24px;
}

/* Video Play Button Overlay */
.is-wa-play-button {
    position: absolute;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin-top: -12px;
}

.is-wa-play-button svg {
    margin-left: 4px;
}

/* Document Placeholder Specific Styling */
.is-wa-document-placeholder {
    background: linear-gradient(135deg, rgb(239 246 255), rgb(219 234 254)) !important;
    color: rgb(59 130 246) !important;
}

.dark .is-wa-document-placeholder {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2)) !important;
    color: rgb(147 197 253) !important;
}

/* Image Header Specific */
.is-wa-media-image .is-wa-media-placeholder {
    background: linear-gradient(135deg, rgb(240 253 244), rgb(220 252 231)) !important;
    color: rgb(34 197 94) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.dark .is-wa-media-image .is-wa-media-placeholder {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(21, 128, 61, 0.15)) !important;
    color: rgb(134 239 172) !important;
}

/* Video Header Specific */
.is-wa-media-video .is-wa-media-placeholder {
    background: linear-gradient(135deg, rgb(254 242 242), rgb(254 226 226)) !important;
    color: rgb(239 68 68) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.dark .is-wa-media-video .is-wa-media-placeholder {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15)) !important;
    color: rgb(252 165 165) !important;
}

/* Image Preview Container (Alpine.js controlled) */
.is-wa-image-preview-container {
    width: 100%;
    display: block;
}

.is-wa-image-preview-container .is-wa-media-preview {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

.is-wa-image-preview-container .is-wa-media-placeholder {
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Video Preview Container */
.is-wa-video-preview-container {
    width: 100%;
    background: #000;
}

.is-wa-video-preview {
    width: 100%;
    max-height: 180px;
    display: block;
}

/* Uploaded State for Video/Document */
.is-wa-video-uploaded,
.is-wa-document-uploaded {
    flex-direction: column;
    gap: 6px !important;
}

.is-wa-video-uploaded {
    background: linear-gradient(135deg, rgb(254 242 242), rgb(254 226 226)) !important;
    color: rgb(185 28 28) !important;
}

.dark .is-wa-video-uploaded {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15)) !important;
    color: rgb(252 165 165) !important;
}

.is-wa-document-uploaded {
    background: linear-gradient(135deg, rgb(239 246 255), rgb(219 234 254)) !important;
    color: rgb(30 64 175) !important;
}

.dark .is-wa-document-uploaded {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.15)) !important;
    color: rgb(147 197 253) !important;
}

/* Filename display */
.is-wa-filename {
    font-size: 11px;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Upload badge */
.is-wa-upload-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.5);
}

.dark .is-wa-upload-badge {
    background: rgba(0, 0, 0, 0.2);
}
