/**
 * Premium Chat UI Styles
 * WhatsApp/Tinder-inspired modern chat design
 * 
 * @package DatingCore
 * @version 4.0
 */

/* ==========================================================================
   HIDE WORDPRESS PAGE ELEMENTS
   ========================================================================== */
.page-template-default .entry-title,
.page .entry-title,
.single .entry-title,
article.page > header,
.page-header,
h1.entry-title,
.entry-header {
    display: none !important;
}

/* Hide duplicate headers outside chat container */
body:not(.dc-messages-container) > .dc-chat-header,
.entry-content > .dc-chat-header:first-child {
    display: none !important;
}

/* ==========================================================================
   MESSAGES CONTAINER LAYOUT
   ========================================================================== */
.dc-messages-container {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 0;
    background: var(--dc-white);
    border-radius: var(--dc-radius-xl);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    min-height: 650px;
    max-height: 85vh;
    margin: -20px auto 20px;
    max-width: 1200px;
}

/* ==========================================================================
   CONVERSATIONS SIDEBAR
   ========================================================================== */
.dc-conversations-sidebar {
    background: var(--dc-white);
    border-right: 1px solid var(--dc-gray-100);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dc-sidebar-header {
    padding: var(--dc-space-5) var(--dc-space-6);
    border-bottom: 1px solid var(--dc-gray-100);
    background: var(--dc-white);
}

.dc-sidebar-header h2 {
    margin: 0;
    font-size: var(--dc-text-xl);
    font-weight: 700;
    color: var(--dc-gray-900);
}

.dc-conversations-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--dc-gray-200) transparent;
}

.dc-conversations-list::-webkit-scrollbar {
    width: 6px;
}

.dc-conversations-list::-webkit-scrollbar-track {
    background: transparent;
}

.dc-conversations-list::-webkit-scrollbar-thumb {
    background: var(--dc-gray-200);
    border-radius: 3px;
}

/* Conversation Item */
.dc-conversation-item {
    display: flex;
    align-items: center;
    gap: var(--dc-space-4);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: var(--dc-space-4) var(--dc-space-6);
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--dc-gray-50);
    position: relative;
}

.dc-conversation-item:hover {
    background: var(--dc-gray-50);
}

.dc-conversation-item.dc-active {
    background: rgba(253, 41, 123, 0.05);
    border-left: 3px solid var(--dc-primary);
}

.dc-conversation-item.dc-unread {
    background: rgba(253, 41, 123, 0.03);
}

.dc-conversation-item.dc-unread .dc-conv-name,
.dc-conversation-item.dc-unread .dc-preview-text {
    font-weight: 600;
}

.dc-conversation-item.dc-loading {
    opacity: 0.6;
    pointer-events: none;
}

.dc-conversation-item.dc-loading::after {
    content: '';
    position: absolute;
    right: 16px;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: var(--dc-primary, #6B46C1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Avatar with online status */
.dc-conv-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: var(--dc-radius-full);
    overflow: hidden;
    flex-shrink: 0;
}

.dc-conv-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dc-conv-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--dc-white);
    background: var(--dc-gray-400);
}

.dc-conv-avatar.dc-status-online::after {
    background: var(--dc-success);
}

.dc-conv-avatar.dc-status-away::after {
    background: var(--dc-warning);
}

/* Conversation Info */
.dc-conv-info {
    flex: 1;
    min-width: 0;
}

.dc-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.dc-conv-name {
    font-weight: 600;
    color: var(--dc-gray-900);
    font-size: var(--dc-text-base);
}

.dc-conv-time {
    font-size: var(--dc-text-xs);
    color: var(--dc-gray-400);
    flex-shrink: 0;
}

.dc-conv-preview {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dc-preview-text {
    color: var(--dc-gray-500);
    font-size: var(--dc-text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Message status indicator */
.dc-msg-status {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.dc-msg-status::before {
    content: '✓';
    color: var(--dc-gray-400);
    font-size: 10px;
}

.dc-msg-status.dc-status-delivered::before {
    content: '✓✓';
}

.dc-msg-status.dc-status-seen::before {
    content: '✓✓';
    color: var(--dc-info);
}

/* Unread badge */
.dc-unread-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: var(--dc-radius-full);
    background: var(--dc-primary);
    color: var(--dc-white);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty state */
.dc-empty-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--dc-space-10);
    text-align: center;
    color: var(--dc-gray-400);
}

.dc-empty-conversations .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: var(--dc-space-4);
    opacity: 0.5;
}

.dc-empty-conversations p {
    margin: 0;
    font-weight: 500;
    color: var(--dc-gray-600);
}

.dc-empty-conversations small {
    margin-top: var(--dc-space-2);
    font-size: var(--dc-text-sm);
}

/* ==========================================================================
   CHAT AREA
   ========================================================================== */
.dc-chat-area {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #f5f5f5 0%, #ececec 100%);
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* Chat Header - Premium Design */
.dc-chat-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    gap: 12px;
    min-height: 70px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dc-back-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--dc-gray-100);
    border-radius: var(--dc-radius-full);
    color: var(--dc-gray-600);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.dc-back-btn:hover {
    background: var(--dc-gray-200);
}

.dc-chat-partner {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.dc-partner-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dc-partner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dc-partner-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #9ca3af;
}

.dc-partner-avatar.dc-status-online::after {
    background: #22c55e;
}

.dc-partner-avatar.dc-status-away::after {
    background: #fbbf24;
}

.dc-partner-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.dc-partner-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 16px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-partner-status {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-partner-status.dc-online {
    color: #22c55e;
    font-weight: 500;
}

#dc-partner-status.typing {
    color: #fd297b;
}

.dc-chat-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.dc-btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.dc-btn-icon:hover {
    background: rgba(253, 41, 123, 0.1);
    color: #fd297b;
    transform: scale(1.05);
}

.dc-btn-icon svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   MESSAGES AREA - Modern Bubble Design
   ========================================================================== */
.dc-messages-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
}

.dc-messages-wrapper::-webkit-scrollbar {
    width: 6px;
}

.dc-messages-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.dc-messages-wrapper::-webkit-scrollbar-thumb {
    background: var(--dc-gray-200);
    border-radius: 3px;
}

/* Date Separator */
.dc-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--dc-space-4) 0;
}

.dc-date-separator span {
    background: rgba(0, 0, 0, 0.08);
    padding: 6px 14px;
    border-radius: var(--dc-radius-full);
    font-size: var(--dc-text-xs);
    font-weight: 500;
    color: var(--dc-gray-600);
}

/* Message Bubbles */
.dc-message {
    display: flex;
    margin-bottom: 2px;
}

.dc-message.dc-mine {
    justify-content: flex-end;
}

.dc-message.dc-theirs {
    justify-content: flex-start;
}

.dc-message-content {
    max-width: 320px;
    min-width: 60px;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.dc-message.dc-mine .dc-message-content {
    background: linear-gradient(135deg, #fd297b 0%, #ff5864 50%, #ff655b 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(253, 41, 123, 0.25);
}

.dc-message.dc-theirs .dc-message-content {
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dc-message-content p {
    margin: 0;
    line-height: 1.45;
    font-size: 15px;
    letter-spacing: 0.01em;
}

/* Emoji-only messages */
.dc-message.dc-emoji-only .dc-message-content {
    background: transparent !important;
    box-shadow: none;
    padding: var(--dc-space-2);
}

.dc-message.dc-emoji-only .dc-message-content p {
    font-size: 2.5rem;
    line-height: 1.2;
}

/* Message with image */
.dc-message-image {
    max-width: 280px;
    border-radius: var(--dc-radius-md);
    overflow: hidden;
    margin-bottom: var(--dc-space-2);
    cursor: pointer;
}

.dc-message-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Message Meta */
.dc-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.dc-message-time {
    font-size: 11px;
    opacity: 0.7;
}

.dc-message.dc-mine .dc-message-time {
    color: rgba(255,255,255,0.8);
}

.dc-message.dc-theirs .dc-message-time {
    color: var(--dc-gray-400);
}

.dc-message-status {
    display: flex;
    align-items: center;
}

.dc-message-status .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: rgba(255,255,255,0.8);
}

.dc-message-status.dc-status-seen .dashicons {
    color: rgba(255,255,255,1);
}

/* Typing Indicator */
.dc-typing-indicator {
    display: flex;
    align-items: center;
    gap: var(--dc-space-2);
    padding: var(--dc-space-3) var(--dc-space-4);
    background: var(--dc-white);
    border-radius: var(--dc-radius-lg);
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.dc-typing-dots {
    display: flex;
    gap: 4px;
}

.dc-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dc-gray-400);
    animation: typingBounce 1.4s infinite both;
}

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

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

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.dc-typing-text {
    font-size: var(--dc-text-xs);
    color: var(--dc-gray-500);
}

/* ==========================================================================
   MESSAGE INPUT AREA
   ========================================================================== */
.dc-message-input-area {
    padding: var(--dc-space-4) var(--dc-space-6);
    background: var(--dc-white);
    border-top: 1px solid var(--dc-gray-100);
}

.dc-message-form {
    display: flex;
    gap: var(--dc-space-3);
}

.dc-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--dc-space-2);
    flex: 1;
    background: var(--dc-gray-100);
    border-radius: var(--dc-radius-xl);
    padding: var(--dc-space-2);
    padding-left: var(--dc-space-4);
    transition: box-shadow 0.2s ease;
}

.dc-input-wrapper:focus-within {
    box-shadow: 0 0 0 2px var(--dc-primary-light);
}

/* Attachment buttons */
.dc-input-actions {
    display: flex;
    gap: var(--dc-space-1);
}

.dc-input-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--dc-gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--dc-radius-full);
    transition: all 0.2s ease;
}

.dc-input-btn:hover {
    background: var(--dc-gray-200);
    color: var(--dc-gray-700);
}

/* Text input */
#dc-message-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: var(--dc-text-base);
    font-family: inherit;
    padding: var(--dc-space-2) 0;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    outline: none;
}

#dc-message-input::placeholder {
    color: var(--dc-gray-400);
}

/* Send button */
.dc-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--dc-gradient-primary);
    color: var(--dc-white);
    border-radius: var(--dc-radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dc-send-btn:disabled {
    background: var(--dc-gray-300);
    cursor: not-allowed;
}

.dc-send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(253, 41, 123, 0.4);
}

.dc-send-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   EMOJI PICKER
   ========================================================================== */
.dc-emoji-picker-container {
    position: relative;
}

.dc-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 320px;
    max-height: 280px;
    background: var(--dc-white);
    border-radius: var(--dc-radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--dc-gray-100);
    margin-bottom: var(--dc-space-2);
    display: none;
    overflow: hidden;
    z-index: 100;
}

.dc-emoji-picker.active {
    display: block;
    animation: slideUp 0.2s ease;
}

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

.dc-emoji-search {
    padding: var(--dc-space-3);
    border-bottom: 1px solid var(--dc-gray-100);
}

.dc-emoji-search input {
    width: 100%;
    padding: var(--dc-space-2) var(--dc-space-3);
    border: 1px solid var(--dc-gray-200);
    border-radius: var(--dc-radius-md);
    font-size: var(--dc-text-sm);
    outline: none;
}

.dc-emoji-search input:focus {
    border-color: var(--dc-primary);
}

.dc-emoji-categories {
    display: flex;
    padding: var(--dc-space-2) var(--dc-space-3);
    border-bottom: 1px solid var(--dc-gray-100);
    gap: var(--dc-space-1);
}

.dc-emoji-category-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--dc-radius-sm);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.dc-emoji-category-btn:hover,
.dc-emoji-category-btn.active {
    background: var(--dc-gray-100);
}

.dc-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: var(--dc-space-3);
    max-height: 180px;
    overflow-y: auto;
}

.dc-emoji-item {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    background: transparent;
    border-radius: var(--dc-radius-sm);
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.dc-emoji-item:hover {
    background: var(--dc-gray-100);
}

/* ==========================================================================
   IMAGE PREVIEW
   ========================================================================== */
.dc-image-preview-container {
    padding: var(--dc-space-3) var(--dc-space-6);
    background: var(--dc-gray-50);
    border-top: 1px solid var(--dc-gray-100);
}

.dc-image-preview {
    position: relative;
    display: inline-block;
    border-radius: var(--dc-radius-md);
    overflow: hidden;
}

.dc-image-preview img {
    max-width: 200px;
    max-height: 150px;
    display: block;
}

.dc-image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0,0,0,0.6);
    color: var(--dc-white);
    border-radius: var(--dc-radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.dc-image-preview-remove:hover {
    background: rgba(0,0,0,0.8);
}

/* Image upload progress */
.dc-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0,0,0,0.2);
}

.dc-upload-progress-bar {
    height: 100%;
    background: var(--dc-primary);
    transition: width 0.3s ease;
}

/* ==========================================================================
   NO CONVERSATION SELECTED
   ========================================================================== */
.dc-no-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--dc-space-10);
    text-align: center;
}

.dc-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--dc-radius-full);
    background: var(--dc-gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--dc-space-6);
}

.dc-empty-icon .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: var(--dc-gray-300);
}

.dc-no-conversation h3 {
    margin: 0 0 var(--dc-space-2) 0;
    color: var(--dc-gray-800);
    font-weight: 600;
}

.dc-no-conversation p {
    margin: 0;
    color: var(--dc-gray-500);
    font-size: var(--dc-text-sm);
}

/* ==========================================================================
   IMAGE LIGHTBOX
   ========================================================================== */
.dc-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--dc-space-6);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.dc-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.dc-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--dc-radius-md);
}

.dc-lightbox-close {
    position: absolute;
    top: var(--dc-space-6);
    right: var(--dc-space-6);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: var(--dc-white);
    border-radius: var(--dc-radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: background 0.2s ease;
}

.dc-lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 900px) {
    .dc-messages-container {
        grid-template-columns: 1fr;
        max-height: none;
        height: calc(100vh - 200px);
    }
    
    .dc-conversations-sidebar {
        height: 100%;
    }
    
    .dc-conversations-sidebar.dc-hidden-mobile {
        display: none;
    }
    
    .dc-chat-area.dc-hidden-mobile {
        display: none;
    }
    
    .dc-back-btn {
        display: flex;
    }
}

@media (max-width: 480px) {
    .dc-message-content {
        max-width: 85%;
    }
    
    .dc-messages-wrapper {
        padding: var(--dc-space-4);
    }
    
    .dc-emoji-picker {
        width: calc(100vw - 24px);
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.dc-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: var(--dc-space-3) var(--dc-space-6);
    background: var(--dc-gray-800);
    color: var(--dc-white);
    border-radius: var(--dc-radius-full);
    font-size: var(--dc-text-sm);
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s var(--dc-ease-out);
}

.dc-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.dc-toast.success {
    background: var(--dc-success);
}

.dc-toast.error {
    background: var(--dc-error);
}

.dc-toast.warning {
    background: var(--dc-warning);
    color: var(--dc-gray-900);
}

.dc-toast.info {
    background: var(--dc-info);
}


