﻿/* ============================================
   EMAIL THREADING STYLES
   ============================================ */

/* Thread count badge */
.thread-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #495057;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

    .thread-count-badge:hover {
        background-color: #4a6cf7;
        color: white;
        border-color: #4a6cf7;
        transform: scale(1.1);
    }

.email-item.thread-expanded .thread-count-badge {
    background-color: #4a6cf7;
    color: white;
    border-color: #4a6cf7;
}

/* Thread expansion container */
.thread-expansion {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin: 0 -12px -8px;
    padding: 8px 12px;
    border-radius: 0 0 6px 6px;
}

/* Thread email items */
.thread-emails-list {
    padding: 4px 0;
}

.thread-email-item {
    padding: 8px 10px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    position: relative;
}

    .thread-email-item:hover {
        background-color: #e9ecef;
    }

    .thread-email-item.unread {
        background-color: rgba(74, 108, 247, 0.04);
    }

        .thread-email-item.unread:hover {
            background-color: rgba(74, 108, 247, 0.08);
        }

    .thread-email-item.latest {
        background-color: rgba(74, 108, 247, 0.06);
        border-left: 3px solid #4a6cf7;
        padding-left: 7px;
    }

/* Thread timeline */
.thread-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 16px;
    flex-shrink: 0;
    padding-top: 4px;
}

.thread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #dee2e6;
    flex-shrink: 0;
    z-index: 1;
}

    .thread-dot.unread {
        background-color: #4a6cf7;
        box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.2);
    }

.thread-line {
    width: 2px;
    flex-grow: 1;
    background-color: #dee2e6;
    margin-top: 4px;
    min-height: 20px;
}

/* Thread email preview */
.thread-email-preview {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.thread-email-content {
    min-width: 0; /* Needed for text-truncate to work in flex */
}

/* Avatar small for thread */
.avatar-circle-sm {
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* Email item with thread indicator */
.email-item.has-thread {
    position: relative;
}

    .email-item.has-thread::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 60%;
        background-color: transparent;
        border-radius: 0 2px 2px 0;
        transition: background-color 0.2s ease;
    }

    .email-item.has-thread:hover::before,
    .email-item.has-thread.thread-expanded::before {
        background-color: #4a6cf7;
    }

/* Loading state */
.thread-loading {
    padding: 12px;
    color: #6c757d;
}

/* Smooth expand/collapse animation */
.thread-expansion {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

/* Thread email item selected state */
.thread-email-item.selected {
    background-color: rgba(74, 108, 247, 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(74, 108, 247, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .thread-timeline {
        display: none;
    }

    .thread-email-item {
        padding: 6px 8px;
    }

    .thread-count-badge {
        min-width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }
}
