/**
 * Waita Market Add-on - Chat Interface
 * Clean, minimal design inspired by Canva
 */

/* ============================================
   Variables - Use Theme Variables Directly
   ============================================ */

/* ============================================
   Chat Modal - Overlay & Container
   ============================================ */
.wma-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.wma-chat-modal.wma-modal-open {
    display: flex;
}

.wma-chat-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.wma-chat-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: min(1200px, 95vw);
    max-height: calc(100vh - 40px);
    background: var(--wma-bg);
    border-radius: 12px;
    box-shadow: var(--wma-shadow-xl);
    display: flex;
    flex-direction: column;
    height: auto; /* allow content to size naturally */
    animation: slideUp 0.3s ease;
    z-index: 1;
}

/* Mobile - Full screen */
@media (max-width: 767px) {
    .wma-chat-modal-content {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        width: 100%;
        border-radius: 0;
    }
    
    .wma-chat-modal .wma-chat {
        padding: 0 !important;
        width: 100% !important;
    }
    
    .wma-chat-modal .wma-chat-messages {
        width: 100% !important;
        padding: 12px 12px !important;
    }
}

/* Desktop - Centered modal */
@media (min-width: 768px) {
    .wma-chat-modal {
        padding: 20px 40px; /* add side spacing */
    }
    
    .wma-chat-modal-content {
        max-height: calc(100vh - 80px);
        height: auto;
    }
}

.wma-chat {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
    background: var(--wma-bg);
    height: 100%;
    min-height: 0; /* allow flex children to size and scroll properly */
}

/* Override canvas template padding when chat is inside modal */
.wma-chat-modal .wma-chat {
    padding: 0 !important;
    min-height: 0 !important;
    width: 100% !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Header - Simple & Clean
   ============================================ */
.wma-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--wma-bg);
    border-bottom: 1px solid var(--wma-border-light);
    flex-shrink: 0;
}

.wma-chat-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--wma-text);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s;
    margin: -4px;
}

.wma-chat-close:hover {
    background: var(--wma-bg-tertiary);
}

.wma-chat-close svg {
    width: 20px;
    height: 20px;
}

.wma-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--wma-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wma-bg);
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.wma-chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.wma-chat-info {
    flex: 1;
    min-width: 0;
}

.wma-chat-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--wma-text);
    margin: 0;
    line-height: 1.3;
}

.wma-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--wma-text-light);
    margin-top: 2px;
}

.wma-chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wma-success);
}

.wma-chat-status-dot.offline {
    background: var(--wma-border);
}

.wma-chat-order-badge {
    padding: 6px 12px;
    background: var(--wma-bg-tertiary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--wma-text-light);
    flex-shrink: 0;
}

/* ============================================
   Messages Container
   ============================================ */
.wma-chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px; /* horizontal padding for edge spacing */
    background: var(--wma-bg);
    display: flex;
    flex-direction: column;
    min-height: 0; /* important for proper scrolling inside flex */
    width: 100% !important;
    box-sizing: border-box;
}

.wma-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.wma-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wma-chat-messages::-webkit-scrollbar-thumb {
    background: var(--wma-border);
    border-radius: 3px;
}

/* Date Separator */
.wma-chat-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.wma-chat-date-separator span {
    padding: 6px 14px;
    background: var(--wma-bg);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--wma-text-light);
    box-shadow: var(--wma-shadow-sm);
}

/* Empty State */
.wma-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    text-align: center;
}

.wma-chat-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    background: var(--wma-bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wma-chat-empty-icon svg {
    width: 28px;
    height: 28px;
    color: var(--wma-text-lighter);
}

.wma-chat-empty h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--wma-text);
}

.wma-chat-empty p {
    margin: 0;
    font-size: 14px;
    color: var(--wma-text-light);
    line-height: 1.5;
}

/* ============================================
   Message Bubbles
   ============================================ */
.wma-message {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* Own messages - align to RIGHT */
.wma-message.wma-own {
    align-items: flex-end;
}

/* Other messages - align to LEFT */
.wma-message.wma-other {
    align-items: flex-start;
}

.wma-message-bubble {
    display: inline-block;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 85%;
    box-sizing: border-box;
}

/* Align bubbles left/right within the full-width message container */
.wma-message.wma-own .wma-message-bubble {
    /* No margin needed - flex-end handles alignment */
}

.wma-message.wma-other .wma-message-bubble {
    /* No margin needed - flex-start handles alignment */
}

/* Own messages - Primary color */
.wma-message.wma-own .wma-message-bubble {
    background: var(--wma-primary);
    color: var(--wma-bg);
    border-radius: 20px 20px 4px 20px;
}

/* Other messages - Light background */
.wma-message.wma-other .wma-message-bubble {
    background: var(--wma-bg-tertiary);
    color: var(--wma-text);
    border-radius: 20px 20px 20px 4px;
    box-shadow: var(--wma-shadow-sm);
}

/* Sequential messages */
.wma-message.wma-own + .wma-message.wma-own .wma-message-bubble {
    border-radius: 20px 4px 4px 20px;
}

.wma-message.wma-other + .wma-message.wma-other .wma-message-bubble {
    border-radius: 4px 20px 20px 4px;
}

.wma-message.wma-own.wma-last .wma-message-bubble {
    border-radius: 20px 4px 20px 20px;
}

.wma-message.wma-other.wma-last .wma-message-bubble {
    border-radius: 4px 20px 20px 20px;
}

/* Spacing between different senders */
.wma-message.wma-own + .wma-message.wma-other,
.wma-message.wma-other + .wma-message.wma-own {
    margin-top: 16px;
}

/* Message Meta */
.wma-message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--wma-text-lighter);
    margin-top: 4px;
    padding: 0 6px;
}

.wma-message.wma-own .wma-message-meta {
    justify-content: flex-end;
}

.wma-message-sender {
    font-weight: 500;
    color: var(--wma-text-light);
}

.wma-message-status svg {
    width: 14px;
    height: 14px;
}

.wma-message-status.read svg {
    color: var(--wma-success);
}

/* Typing Indicator */
.wma-typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--wma-bg-tertiary);
    border-radius: 20px;
    box-shadow: var(--wma-shadow-sm);
    margin-bottom: 8px;
}

.wma-typing-dots {
    display: flex;
    gap: 4px;
}

.wma-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--wma-text-lighter);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.wma-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.wma-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ============================================
   Image Preview Area
   ============================================ */
.wma-chat-preview {
    padding: 12px 16px;
    background: var(--wma-bg-tertiary);
    border-top: 1px solid var(--wma-border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wma-chat-preview-content {
    position: relative;
    display: block; /* allow full width camera preview */
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--wma-shadow-md);
    box-sizing: border-box;
}

.wma-chat-preview-image {
    display: block;
    width: 100%;
    max-height: 60vh; /* match camera preview height */
    object-fit: contain;
    border-radius: 12px;
}

.wma-chat-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.wma-chat-preview-remove:hover {
    background: rgba(0, 0, 0, 0.8);
}

.wma-chat-preview-remove svg {
    width: 16px;
    height: 16px;
}

.wma-chat-preview-caption {
    margin-top: 10px;
}

.wma-chat-caption-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--wma-border-light);
    border-radius: 20px;
    font-size: 14px;
    font-family: var(--wma-font-text);
    color: var(--wma-text);
    background: var(--wma-bg);
    outline: none;
}

.wma-chat-caption-input:focus {
    border-color: var(--wma-primary);
}

/* File placeholder for non-image attachments in preview */
.wma-chat-file-placeholder {
    display: inline-block;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--wma-text);
    background: var(--wma-bg);
    border-radius: 8px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Message attachment images */
.wma-message-attachment-image {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* File link inside message bubble */
.wma-message-attachment-file {
    display: inline-block;
    padding: 8px 12px;
    background: var(--wma-bg);
    border-radius: 8px;
    color: var(--wma-text);
    text-decoration: none;
   box-shadow: var(--wma-shadow-sm);
}

/* Camera capture UI */
.wma-camera-video {
    display: block;
    width: 100%;
    max-height: 60vh; /* allow taller camera preview */
    object-fit: cover;
    border-radius: 12px;
}

.wma-camera-controls {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap; /* ensure controls don't overflow */
    padding-bottom: 8px; /* add breathing room below buttons */
}

.wma-camera-capture {
    padding: 8px 12px;
    border-radius: 20px;
    background: var(--wma-primary);
    color: var(--wma-bg);
    border: none;
    cursor: pointer;
}

.wma-camera-switch {
    padding: 8px 12px;
    border-radius: 20px;
    background: var(--wma-bg);
    color: var(--wma-text);
    border: 1px solid var(--wma-border-light);
    cursor: pointer;
}

.wma-camera-cancel {
    padding: 8px 12px;
    border-radius: 20px;
    background: var(--wma-bg);
    color: var(--wma-text);
    border: 1px solid var(--wma-border-light);
    cursor: pointer;
} 
 


/* ============================================
   Input Area
   ============================================ */
.wma-chat-input-wrapper {
    flex-shrink: 0;
    padding: 12px 16px;
    background: var(--wma-bg);
    border-top: 1px solid var(--wma-border-light);
    position: relative;
}

.wma-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

/* Attachment Button */
.wma-chat-attach-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--wma-bg-tertiary);
    color: var(--wma-text-light);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.wma-chat-attach-btn:hover {
    background: var(--wma-border-light);
    color: var(--wma-primary);
}

.wma-chat-attach-btn.active {
    background: var(--wma-primary-light);
    color: var(--wma-primary);
}

.wma-chat-attach-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.wma-chat-input-field {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid var(--wma-border-light);
    border-radius: 22px;
    font-size: 15px;
    font-family: var(--wma-font-text);
    color: var(--wma-text);
    background: var(--wma-bg);
    resize: none;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.4;
}

.wma-chat-input-field:focus {
    border-color: var(--wma-primary);
    box-shadow: 0 0 0 3px var(--wma-primary-light);
}

.wma-chat-input-field::placeholder {
    color: var(--wma-text-lighter);
}

.wma-send-message {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--wma-primary);
    color: var(--wma-bg);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.wma-send-message:hover {
    background: var(--wma-primary-dark);
}

.wma-send-message:active {
    transform: scale(0.95);
}

.wma-send-message:disabled {
    background: var(--wma-border-light);
    cursor: not-allowed;
}

.wma-send-message svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   Attachment Menu
   ============================================ */
.wma-chat-attach-menu {
    position: absolute;
    bottom: 100%;
    left: 16px;
    margin-bottom: 8px;
    background: var(--wma-primary);
    border-radius: 16px;
    box-shadow: var(--wma-shadow-lg);
    padding: 8px;
    display: flex;
    gap: 4px;
    animation: slideUp 0.2s ease;
    z-index: 100;
}

.wma-attach-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--wma-text);
    cursor: pointer;
    transition: background 0.15s;
    min-width: 70px;
}

.wma-attach-option:hover {
    background: rgba(255,255,255,0.06);
}

.wma-attach-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wma-attach-option[data-type="gallery"] .wma-attach-icon {
    background: #E8F5E9;
    color: #4CAF50;
}

.wma-attach-option[data-type="camera"] .wma-attach-icon {
    background: #E3F2FD;
    color: #2196F3;
}



.wma-attach-icon svg {
    width: 22px;
    height: 22px;
}

.wma-attach-label {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

/* ============================================
   Image Messages
   ============================================ */
.wma-message-image {
    max-width: 250px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.wma-message-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
}

.wma-message-image-caption {
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
}

.wma-message.wma-own .wma-message-image {
    background: var(--wma-primary);
}

.wma-message.wma-own .wma-message-image-caption {
    color: var(--wma-bg);
}

.wma-message.wma-other .wma-message-image {
    background: var(--wma-bg-tertiary);
    box-shadow: var(--wma-shadow-sm);
}

.wma-message.wma-other .wma-message-image-caption {
    color: var(--wma-text);
}

/* File Messages */
.wma-message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    min-width: 200px;
}

.wma-message-file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wma-message.wma-own .wma-message-file-icon {
    background: rgba(255, 255, 255, 0.2);
    color: var(--wma-bg);
}

.wma-message.wma-other .wma-message-file-icon {
    background: var(--wma-border-light);
    color: var(--wma-text-light);
}

.wma-message-file-icon svg {
    width: 20px;
    height: 20px;
}

.wma-message-file-info {
    flex: 1;
    min-width: 0;
}

.wma-message-file-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wma-message-file-size {
    font-size: 12px;
    opacity: 0.7;
}

.wma-message.wma-own .wma-message-file {
    background: var(--wma-primary);
    color: var(--wma-bg);
}

.wma-message.wma-other .wma-message-file {
    background: var(--wma-bg-tertiary);
    color: var(--wma-text);
    box-shadow: var(--wma-shadow-sm);
}

/* ============================================
   Image Lightbox
   ============================================ */
.wma-chat-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.wma-chat-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.wma-chat-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wma-chat-lightbox-close svg {
    width: 24px;
    height: 24px;
}

.wma-chat-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* ============================================
   Upload Progress
   ============================================ */
.wma-upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--wma-bg-tertiary);
    border-radius: 12px;
    margin-bottom: 8px;
}

.wma-upload-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--wma-border-light);
    border-radius: 2px;
    overflow: hidden;
}

.wma-upload-progress-fill {
    height: 100%;
    background: var(--wma-primary);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.wma-upload-progress-text {
    font-size: 12px;
    color: var(--wma-text-light);
    white-space: nowrap;
}

/* ============================================
   Disabled State
   ============================================ */
.wma-chat-disabled {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: var(--wma-warning-light);
    border-top: 1px solid var(--wma-warning);
}

.wma-chat-disabled-icon {
    width: 20px;
    height: 20px;
    color: var(--wma-warning);
}

.wma-chat-disabled p {
    margin: 0;
    font-size: 14px;
    color: var(--wma-warning);
}

/* ============================================
   Loading State
   ============================================ */
.wma-chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

.wma-chat-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--wma-border-light);
    border-top-color: var(--wma-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.wma-chat-loading p {
    margin: 16px 0 0 0;
    font-size: 14px;
    color: var(--wma-text-light);
}

/* ============================================
   Error State
   ============================================ */
.wma-chat-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    height: 100%;
}

.wma-chat-error-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    color: var(--wma-danger);
}

.wma-chat-error h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--wma-text);
}

.wma-chat-error p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: var(--wma-text-light);
}

.wma-chat-error .wma-btn {
    padding: 10px 20px;
    background: var(--wma-primary);
    color: var(--wma-bg);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.wma-chat-error .wma-btn:hover {
    background: var(--wma-primary-dark);
}

/* ============================================
   Chat Button in Order Cards
   ============================================ */
.wma-order-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--wma-primary);
    color: var(--wma-bg);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.wma-order-chat-btn:hover {
    background: var(--wma-primary-dark);
    color: var(--wma-bg);
}

.wma-order-chat-btn svg {
    width: 18px;
    height: 18px;
}

.wma-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--wma-danger);
    color: var(--wma-bg);
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}

/* ============================================
   Toast Notifications
   ============================================ */
.wma-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: var(--wma-text);
    color: var(--wma-bg);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--wma-shadow-lg);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
}

.wma-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wma-toast-error { background: var(--wma-danger); }
.wma-toast-success { background: var(--wma-success); }

/* ============================================
   Sending State
   ============================================ */
.wma-message.wma-sending .wma-message-bubble {
    opacity: 0.7;
}

/* ============================================
   Container Overrides - Force Theme Background
   ============================================ */
.wma-chat-modal-content,
.wma-chat,
.wma-chat-messages {
    background-color: var(--wma-bg) !important;
}

/* Only color the message bubbles */
.wma-message.wma-own .wma-message-bubble {
    background: var(--wma-primary) !important;
    color: var(--wma-bg) !important;
}

.wma-message.wma-other .wma-message-bubble {
    background: var(--wma-bg-tertiary) !important;
    color: var(--wma-text) !important;
}

/* ============================================
   Utility Classes
   ============================================ */
.wma-hidden {
    display: none !important;
}

.wma-chat-messages-centered {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.wma-chat-warning-icon {
    background: var(--wma-warning-light) !important;
}

.wma-chat-warning-icon svg {
    color: var(--wma-warning) !important;
}

/* ============================================
   Tablet Adjustments
   ============================================ */
@media (max-width: 767px) and (min-width: 481px) {
    .wma-chat-messages {
        padding: 12px 10px;
    }
    
    .wma-message-bubble {
        max-width: 80%;
    }
}

/* ============================================
   Mobile Adjustments
   ============================================ */
@media (max-width: 480px) {
    .wma-chat-header {
        padding: 12px 16px;
    }
    
    .wma-chat-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .wma-chat-name {
        font-size: 15px;
    }
    
    .wma-chat-messages {
        padding: 12px 12px !important;
        width: 100% !important;
    }
    
    .wma-message-bubble {
        padding: 10px 14px;
        font-size: 15px;
        max-width: 85%;
    }
    
    .wma-chat-input-wrapper {
        padding: 10px 12px;
    }
    
    .wma-chat-input-field {
        min-height: 42px;
        padding: 10px 14px;
    }
    
    .wma-send-message {
        width: 42px;
        height: 42px;
    }
    
    /* Image messages should be wider on mobile */
    .wma-message-image {
        max-width: 85%;
    }
}

/* ============================================
   Safe Area for Notched Devices
   ============================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .wma-chat-modal-content .wma-chat-input-wrapper {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   Accessibility
   ============================================ */
.wma-chat-input-field:focus-visible,
.wma-send-message:focus-visible,
.wma-chat-close:focus-visible {
    outline: 2px solid var(--wma-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Prevent Body Scroll When Modal Open
   ============================================ */
body.wma-chat-modal-open {
    overflow: hidden;
}

/* ============================================
   Send Button - Ensure Visibility
   ============================================ */
.wma-send-message {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    background: var(--wma-primary) !important;
    color: var(--wma-bg) !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.wma-send-message:disabled {
    background: var(--wma-border) !important;
    cursor: not-allowed !important;
}

.wma-send-message svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

/* Input wrapper must be visible */
.wma-chat-input-wrapper {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
}

.wma-chat-input {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
