/* ============================================================
   CONVERSATIONS - ServiceDesk Plus Compact Style
   ============================================================ */

/* Conversations Content Container */
.conversations-content {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}

/* Conversations Toolbar */
.conv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    gap: 20px;
    flex-wrap: wrap;
}

.conv-toolbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    min-width: 300px;
}

.conv-toolbar-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}

.conv-filters-inline {
    display: flex;
    align-items: center;
    gap: 20px;
}

.conv-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.conv-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--sd-primary);
}

.conv-checkbox-label i {
    color: #64748b;
    font-size: 14px;
}

.conv-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-toolbar-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.conv-toolbar-btn:hover {
    border-color: var(--sd-primary);
    color: var(--sd-primary);
    background: rgba(var(--sd-primary-rgb), 0.05);
}

.conv-add-note-btn {
    padding: 7px 14px;
    background: linear-gradient(135deg, var(--sd-primary) 0%, rgba(var(--sd-primary-rgb), 0.88) 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(var(--sd-primary-rgb), 0.2);
}

.conv-add-note-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--sd-primary-rgb), 0.3);
}

/* Conversations List Container */
.conv-list-container {
    background: white;
}

/* Conversation Item - Compact Single Row with Better Separation */
.conv-item {
    border-bottom: 2px solid #f1f5f9;
    transition: all 0.2s;
    margin-bottom: 3px;
    border-left: 3px solid transparent;
}

.conv-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.conv-item:hover {
    background: #f8fafc;
    border-left-color: var(--sd-primary);
}

.conv-item.expanded {
    background: #f8fafc;
    border-left-color: var(--sd-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Type-specific left border colors */
.conv-item[data-type="email"]:hover,
.conv-item[data-type="email"].expanded {
    border-left-color: #10b981;
}

/* Incoming (requester) emails - red theme */
.conv-item.conv-incoming {
    background: #fef2f2;
}

.conv-item.conv-incoming:hover,
.conv-item.conv-incoming.expanded {
    border-left-color: #dc2626 !important;
    background: #fef2f2;
}

.conv-item.conv-incoming .conv-item-row {
    background: transparent;
}

.conv-item.conv-incoming .conv-item-details {
    background: linear-gradient(to bottom, #fef2f2 0%, #fff5f5 100%);
}

.conv-item.conv-incoming .conv-message-content {
    border-left-color: #dc2626;
}

.conv-icon-incoming {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.conv-incoming-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.2);
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Split button styling - red to match incoming */
.conv-btn-split {
    color: #dc2626;
    border-color: #fca5a5;
}

.conv-btn-split:hover {
    border-color: #dc2626;
    background: #fef2f2;
    color: #b91c1c;
}

/* Split icon button in row actions - red */
.conv-icon-btn-split {
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

.conv-icon-btn-split:hover {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
    color: #b91c1c !important;
}

.conv-item[data-type="note"]:hover,
.conv-item[data-type="note"].expanded {
    border-left-color: #f59e0b;
}

.conv-item[data-type="system"]:hover,
.conv-item[data-type="system"].expanded {
    border-left-color: #8b5cf6;
}

/* Single Row Layout with Better Spacing */
.conv-item-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.15s;
}

.conv-row-system {
    cursor: default;
    background: #fefce8;
    border-left: 3px solid #eab308;
}

/* Icon - Enhanced with Background */
.conv-item-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 50%;
    background: rgba(0,0,0,0.03);
}

.conv-icon-email {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.conv-icon-note {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.conv-icon-system {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

/* Name - Blue Clickable Style */
.conv-item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #0066cc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.conv-item-row:hover .conv-item-name {
    text-decoration: underline;
    color: #0052a3;
}

.conv-row-system .conv-item-name {
    color: #475569;
}

.conv-row-system:hover .conv-item-name {
    text-decoration: none;
}

/* Date - Right Aligned */
.conv-item-date {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    margin-left: auto;
}

/* Action Icons - Show on Hover */
.conv-item-actions-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.conv-item:hover .conv-item-actions-icons {
    opacity: 1;
}

.conv-icon-btn-sm {
    width: 28px;
    height: 28px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.conv-icon-btn-sm:hover {
    border-color: var(--sd-primary);
    color: var(--sd-primary);
    background: rgba(var(--sd-primary-rgb), 0.05);
}

/* Expanded Details with Better Styling */
.conv-item-details {
    padding: 20px 24px 20px 68px;
    background: linear-gradient(to bottom, #fafbfc 0%, white 100%);
    border-top: 2px solid #e2e8f0;
    animation: slideDown 0.2s ease-out;
}

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

/* Details Box - Enhanced Header Info */
.conv-details-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.conv-detail-line {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
    line-height: 1.6;
}

.conv-detail-line:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

.conv-detail-label {
    font-weight: 600;
    color: #475569;
    min-width: 70px;
    flex-shrink: 0;
}

.conv-detail-text {
    color: #1e293b;
    word-break: break-word;
    flex: 1;
    font-weight: 500;
}

/* Message Content with Better Styling */
.conv-message-content {
    padding: 16px 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 16px;
    min-height: 80px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Action Bar - Bottom Buttons */
.conv-action-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.conv-btn {
    padding: 6px 16px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #475569;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.conv-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    color: #1e293b;
}

.conv-btn-danger {
    color: #dc2626;
}

.conv-btn-danger:hover {
    border-color: #dc2626;
    background: #fef2f2;
}

/* Empty State */
.conv-empty,
.conv-empty-state {
    text-align: center;
    padding: 80px 20px;
}

.conv-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conv-empty-icon i {
    font-size: 32px;
    color: #94a3b8;
}

.conv-empty h4,
.conv-empty h3,
.conv-empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 8px 0;
}

.conv-empty p,
.conv-empty-state p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* Modal Conversations Styles */
.modal-conv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    gap: 16px;
}

.modal-conv-filters {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.modal-conv-filter-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.modal-conv-filter-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #1e293b;
}

.modal-conv-filter-btn.active {
    background: white;
    color: var(--sd-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.modal-conv-actions {
    display: flex;
    gap: 4px;
}

.modal-conv-action-icon {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-conv-action-icon:hover {
    border-color: var(--sd-primary);
    color: var(--sd-primary);
    background: rgba(var(--sd-primary-rgb), 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .conv-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .conv-toolbar-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .conv-filters-inline {
        flex-wrap: wrap;
    }

    .conv-item-row {
        flex-wrap: wrap;
    }

    .conv-item-date {
        margin-left: 32px;
        width: 100%;
    }

    .conv-item-actions-icons {
        opacity: 1;
    }

    .conv-action-bar {
        gap: 6px;
    }

    .conv-btn {
        flex: 1;
        justify-content: center;
    }
}

/* Note Modal */
.note-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

.note-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.note-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.note-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.note-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #8b95a5;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.note-modal-close:hover {
    background-color: #f1f5f9;
    color: #2c3e50;
}

.note-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.note-modal-body .form-group {
    margin-bottom: 0;
}

.note-modal-body label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.note-modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #2c3e50;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.note-modal-body textarea:focus {
    outline: none;
    border-color: var(--sd-primary);
    box-shadow: 0 0 0 3px rgba(var(--sd-primary-rgb), 0.1);
}

.note-modal-body textarea::placeholder {
    color: #a0aec0;
}

.note-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
}

.note-modal-footer .btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.note-modal-footer .btn-secondary {
    background-color: #f1f5f9;
    color: #64748b;
}

.note-modal-footer .btn-secondary:hover {
    background-color: #e2e8f0;
}

.note-modal-footer .btn-primary {
    background-color: var(--sd-primary);
    color: #ffffff;
}

.note-modal-footer .btn-primary:hover {
    background-color: rgba(var(--sd-primary-rgb), 0.9);
    box-shadow: 0 4px 12px rgba(var(--sd-primary-rgb), 0.2);
}

@media (max-width: 640px) {
    .note-modal {
        width: 95%;
        max-height: 95vh;
    }

    .note-modal-header,
    .note-modal-body,
    .note-modal-footer {
        padding: 16px;
    }
}
