/**
 * Dating Core - Messaging Styles
 *
 * @package DatingCore
 */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    --dc-primary: #e91e63;
    --dc-secondary: #9c27b0;
    --dc-msg-mine: linear-gradient(135deg, #e91e63, #9c27b0);
    --dc-msg-theirs: #f5f5f5;
    --dc-online: #4ade80;
    --dc-away: #fbbf24;
    --dc-offline: #9ca3af;
}

/* ==========================================================================
   Messages Container
   ========================================================================== */

.dc-messages-container {
    display: flex;
    height: calc(100vh - 100px);
    max-height: 800px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Conversations Sidebar
   ========================================================================== */

.dc-conversations-sidebar {
    width: 350px;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.dc-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.dc-sidebar-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.dc-conversations-list {
    flex: 1;
    overflow-y: auto;
}

.dc-conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
}

.dc-conversation-item:hover {
    background: #fafafa;
}

.dc-conversation-item.dc-active {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.08), rgba(156, 39, 176, 0.08));
    border-left: 3px solid var(--dc-primary);
}

.dc-conversation-item.dc-unread {
    background: #fef3f6;
}

.dc-conv-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.dc-conv-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dc-conv-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.dc-status-online::after { background: var(--dc-online); }
.dc-status-away::after { background: var(--dc-away); }
.dc-status-offline::after { background: var(--dc-offline); }

.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;
    font-size: 15px;
    color: #333;
}

.dc-conv-time {
    font-size: 12px;
    color: #999;
}

.dc-conv-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #666;
}

.dc-preview-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-conversation-item.dc-unread .dc-conv-name,
.dc-conversation-item.dc-unread .dc-preview-text {
    font-weight: 600;
    color: #333;
}

.dc-unread-badge {
    min-width: 22px;
    height: 22px;
    background: var(--dc-primary);
    color: #fff;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.dc-msg-status {
    width: 14px;
    height: 14px;
    display: inline-flex;
}

.dc-msg-status.dc-status-sent { opacity: 0.5; }
.dc-msg-status.dc-status-delivered { color: #999; }
.dc-msg-status.dc-status-seen { color: var(--dc-primary); }

.dc-empty-conversations {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.dc-empty-conversations .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ==========================================================================
   Chat Area
   ========================================================================== */

.dc-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dc-chat-standalone {
    height: calc(100vh - 100px);
    max-height: 800px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Header */
.dc-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dc-back-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #333;
}

.dc-chat-partner {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.dc-partner-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.dc-partner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dc-partner-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.dc-partner-info {
    display: flex;
    flex-direction: column;
}

.dc-partner-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.dc-partner-status {
    font-size: 13px;
    color: #999;
}

.dc-chat-actions .dc-btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Messages
   ========================================================================== */

.dc-messages-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.dc-messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100%;
}

.dc-date-separator {
    text-align: center;
    margin: 20px 0;
}

.dc-date-separator span {
    background: #e0e0e0;
    color: #666;
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.dc-message {
    display: flex;
    max-width: 70%;
}

.dc-message.dc-mine {
    align-self: flex-end;
}

.dc-message.dc-theirs {
    align-self: flex-start;
}

.dc-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.dc-message.dc-mine .dc-message-content {
    background: var(--dc-msg-mine);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dc-message.dc-theirs .dc-message-content {
    background: var(--dc-msg-theirs);
    color: #333;
    border-bottom-left-radius: 4px;
}

.dc-message-content p {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.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-status {
    display: flex;
    align-items: center;
}

.dc-message-status .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.dc-message.dc-mine .dc-message-status .dashicons {
    color: rgba(255, 255, 255, 0.8);
}

.dc-message.dc-mine .dc-message-status.dc-status-seen .dashicons {
    color: #fff;
}

/* Typing Indicator */
.dc-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--dc-msg-theirs);
    border-radius: 18px;
    align-self: flex-start;
    margin-top: 8px;
}

.dc-typing-dots {
    display: flex;
    gap: 4px;
}

.dc-typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.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%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.dc-typing-text {
    font-size: 13px;
    color: #666;
}

/* ==========================================================================
   Message Input
   ========================================================================== */

.dc-message-input-area {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #eee;
}

.dc-message-form {
    margin: 0;
}

.dc-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 8px 8px 8px 20px;
}

.dc-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 15px;
    line-height: 1.4;
    max-height: 120px;
    padding: 8px 0;
    font-family: inherit;
}

.dc-input-wrapper textarea:focus {
    outline: none;
}

.dc-input-wrapper textarea::placeholder {
    color: #999;
}

.dc-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--dc-msg-mine);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dc-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dc-send-btn:not(:disabled):hover {
    transform: scale(1.05);
}

.dc-send-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   No Conversation Selected
   ========================================================================== */

.dc-no-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: #999;
}

.dc-no-conversation .dc-empty-icon {
    width: 100px;
    height: 100px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.dc-no-conversation .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #ccc;
}

.dc-no-conversation h3 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #333;
}

.dc-no-conversation p {
    margin: 0;
    font-size: 15px;
}

/* ==========================================================================
   Sending Animation
   ========================================================================== */

.dc-message.dc-sending {
    opacity: 0.7;
}

.dc-message.dc-sending .dc-message-content::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -24px;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: var(--dc-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .dc-messages-container {
        height: calc(100vh - 60px);
        max-height: none;
        border-radius: 0;
    }

    .dc-conversations-sidebar {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        background: #fff;
        z-index: 10;
    }

    .dc-conversations-sidebar.dc-hidden-mobile {
        display: none;
    }

    .dc-chat-area {
        width: 100%;
    }

    .dc-chat-area.dc-hidden-mobile {
        display: none;
    }

    .dc-back-btn {
        display: flex;
    }

    .dc-mobile-only {
        display: flex;
    }

    .dc-message {
        max-width: 85%;
    }

    .dc-chat-standalone {
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
}

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */

.dc-conversations-list::-webkit-scrollbar,
.dc-messages-wrapper::-webkit-scrollbar {
    width: 6px;
}

.dc-conversations-list::-webkit-scrollbar-thumb,
.dc-messages-wrapper::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.dc-conversations-list::-webkit-scrollbar-thumb:hover,
.dc-messages-wrapper::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}


