/* Chat Widget - Shopee Style (Ramping) */
.chat-widget-container {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-widget-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 720px;
    max-width: 90vw;
    height: 520px;
    max-height: 85vh;
    background: white;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}

.chat-widget-panel.active {
    display: flex;
}

/* Chat Widget Header */
.chat-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #F25912;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-widget-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-count-badge {
    font-weight: 400;
    opacity: 0.9;
    font-size: 14px;
}

.chat-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

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

/* Search and Filter */
.chat-widget-search {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.chat-search-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 12px;
}

.chat-search-input {
    width: 100%;
    padding: 6px 10px 6px 30px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-search-input:focus {
    border-color: #F25912;
}

.chat-filter-select {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    outline: none;
    min-width: 90px;
}

/* Chat Widget Content */
.chat-widget-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Conversation List (Left Panel) */
.chat-conversation-list {
    width: 260px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.conversation-list-loading,
.conversation-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
    text-align: center;
    color: #6b7280;
    flex: 1;
}

.conversation-list-loading .loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top-color: #F25912;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}

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

.conversation-list-empty i {
    font-size: 36px;
    color: #d1d5db;
    margin-bottom: 12px;
}

.conversation-list-empty p {
    margin: 0 0 6px 0;
    font-size: 13px;
    font-weight: 500;
}

.conversation-list-empty small {
    font-size: 11px;
    color: #9ca3af;
}

.conversation-items {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.2s;
}

.conversation-item:hover {
    background: #f9fafb;
}

.conversation-item.active {
    background: #fef3e2;
    border-left: 2px solid #F25912;
}

.conversation-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F25912;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.conversation-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.conversation-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.conversation-item-name {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item-time {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    margin-left: 6px;
}

.conversation-item-message {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item-unread {
    background: #F25912;
    color: white;
    border-radius: 8px;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
    margin-left: 6px;
}

/* Chat Window (Right Panel) */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.chat-window-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #6b7280;
    text-align: center;
    padding: 30px;
}

.chat-window-empty i {
    font-size: 48px;
    color: #d1d5db;
    margin-bottom: 12px;
}

.chat-window-empty p {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}

.chat-window-header {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.chat-window-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-window-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F25912;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
}

.chat-window-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-window-user-details h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.chat-window-status {
    font-size: 11px;
    color: #10b981;
}

/* Chat Messages Area */
.chat-messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8f9fa;
}

.chat-message {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.chat-message.sent {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #F25912;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.chat-message-content {
    max-width: 70%;
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.sent .chat-message-content {
    background: #F25912;
    color: white;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    font-size: 10px;
    color: #9ca3af;
}

.chat-message.sent .chat-message-meta {
    color: rgba(255, 255, 255, 0.7);
    justify-content: flex-end;
}

.chat-message-status {
    font-size: 11px;
}

.chat-message-status.read {
    color: #3b82f6;
}

/* Unread Separator */
.chat-unread-separator {
    padding: 6px 12px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    margin: 8px 0;
}

.chat-unread-separator span {
    font-size: 11px;
    color: #F25912;
    font-weight: 600;
}

/* Chat Input Area */
.chat-input-area {
    border-top: 1px solid #e5e7eb;
    background: white;
    padding: 8px 12px 8px 12px;
}

.chat-input-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.chat-input-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 16px;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-input-btn:hover {
    background: #f3f4f6;
    color: #F25912;
}

.chat-input-wrapper {
    display: flex !important;
    gap: 12px;
    align-items: center;
    position: relative;
    width: 100%;
    padding-right: 0;
}

.chat-message-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 80px;
    font-family: inherit;
    line-height: 1.4;
    min-height: 36px;
}

.chat-message-input:focus {
    border-color: #F25912;
}

.chat-send-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: #FF7043 !important;
    color: white !important;
    border: 2px solid #FF7043 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 13px;
    box-shadow: 0 2px 5px rgba(255, 112, 67, 0.4) !important;
    font-weight: 600;
    position: relative;
    z-index: 10;
    opacity: 1 !important;
    visibility: visible !important;
    margin: 0 5px 0 0;
    padding: 0;
    align-self: center;
}

.chat-send-button i {
    color: white !important;
    font-size: 13px;
    display: block !important;
    line-height: 1;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 2;
}

.chat-send-button .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.chat-send-button:hover {
    background: #FF5722;
    border-color: #FF5722;
    box-shadow: 0 3px 8px rgba(255, 112, 67, 0.5);
    transform: scale(1.05);
}

.chat-send-button:hover i {
    color: white;
}

.chat-send-button:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(255, 112, 67, 0.4);
}

.chat-send-button:disabled {
    background: #d1d5db;
    border-color: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.6;
}

.chat-send-button:disabled i {
    color: #9ca3af;
}

/* Chat Widget Toggle Button */
.chat-widget-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #F25912;
    color: white;
    border: none;
    box-shadow: 0 3px 10px rgba(242, 89, 18, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 9999;
    transition: all 0.3s;
}

.chat-widget-toggle:hover {
    background: #E64A19;
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(242, 89, 18, 0.45);
}

.chat-toggle-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    border-radius: 8px;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.chat-widget-panel.active ~ .chat-widget-toggle {
    display: none;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .chat-widget-panel {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chat-widget-header {
        padding: 8px 12px;
    }
    
    .chat-widget-title {
        font-size: 14px;
    }
    
    .chat-widget-close {
        font-size: 16px;
        padding: 2px 4px;
    }
    
    .chat-widget-search {
        padding: 6px 10px;
        gap: 6px;
    }
    
    .chat-search-input {
        padding: 5px 8px 5px 28px;
        font-size: 12px;
    }
    
    .chat-search-icon {
        left: 8px;
        font-size: 11px;
    }
    
    .chat-filter-select {
        padding: 5px 8px;
        font-size: 12px;
        min-width: 80px;
    }
    
    .chat-widget-content {
        flex-direction: column;
    }
    
    .chat-conversation-list {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        max-height: 35vh;
    }
    
    .conversation-item {
        padding: 6px 10px;
        gap: 8px;
    }
    
    .conversation-item-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .conversation-item-name {
        font-size: 12px;
    }
    
    .conversation-item-time {
        font-size: 10px;
    }
    
    .conversation-item-message {
        font-size: 11px;
    }
    
    .chat-window {
        flex: 1;
        min-height: 0;
    }
    
    .chat-window-header {
        padding: 6px 10px;
    }
    
    .chat-window-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .chat-window-user-details h6 {
        font-size: 13px;
    }
    
    .chat-window-status {
        font-size: 10px;
    }
    
    .chat-messages-container {
        padding: 10px;
    }
    
    .chat-message {
        gap: 5px;
        margin-bottom: 8px;
    }
    
    .chat-message-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .chat-message-content {
        max-width: 75%;
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 8px;
    }
    
    .chat-message-meta {
        font-size: 9px;
        margin-top: 2px;
    }
    
    .chat-unread-separator {
        padding: 4px 10px;
        margin: 6px 0;
    }
    
    .chat-unread-separator span {
        font-size: 10px;
    }
    
    .chat-input-area {
        padding: 6px 12px;
    }
    
    .chat-input-toolbar {
        gap: 4px;
        margin-bottom: 4px;
    }
    
    .chat-input-btn {
        font-size: 14px;
        padding: 2px 4px;
    }
    
    .chat-input-wrapper {
        gap: 10px;
    }
    
    .chat-message-input {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 16px;
        max-height: 60px;
    }
    
    .chat-input-wrapper {
        align-items: center !important;
        gap: 6px;
    }
    
    .chat-message-input {
        min-height: 32px;
    }
    
    .chat-send-button {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        min-height: 30px !important;
        font-size: 12px;
        box-shadow: 0 2px 4px rgba(255, 112, 67, 0.4) !important;
        border: 2px solid #FF7043 !important;
        background: #FF7043 !important;
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        align-self: center !important;
    }
    
    .chat-send-button i {
        font-size: 12px !important;
        color: white !important;
        display: block !important;
    }
    
    .chat-send-button:hover {
        box-shadow: 0 3px 8px rgba(255, 112, 67, 0.6) !important;
        border-color: #FF5722 !important;
        background: #FF5722 !important;
    }
    
    .chat-send-button:disabled {
        border-color: #d1d5db !important;
        background: #d1d5db !important;
    }
    
    .chat-widget-toggle {
        width: 48px;
        height: 48px;
        font-size: 18px;
        bottom: 12px;
        right: 12px;
    }
    
    .chat-toggle-badge {
        font-size: 9px;
        padding: 1px 4px;
        min-width: 14px;
    }
    
    .chat-window-empty {
        padding: 20px;
    }
    
    .chat-window-empty i {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .chat-window-empty p {
        font-size: 12px;
    }
    
    .conversation-list-loading,
    .conversation-list-empty {
        padding: 20px 12px;
    }
    
    .conversation-list-loading .loading-spinner {
        width: 20px;
        height: 20px;
        margin-bottom: 8px;
    }
    
    .conversation-list-empty i {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .conversation-list-empty p {
        font-size: 12px;
    }
    
    .conversation-list-empty small {
        font-size: 10px;
    }
}

/* Mobile Landscape */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-conversation-list {
        max-height: 30vh;
    }
    
    .chat-messages-container {
        padding: 8px;
    }
    
    .chat-message {
        margin-bottom: 6px;
    }
}

