/* 🎨 ЭЛЕГАНТНЫЕ СТИЛИ В СТИЛЕ ARMANI - ТЕМНО-СИНИЙ ФОН 2025 - EXCEL COMPACT */

/* === HEADER === */
.clients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--users-bg-secondary, #1a1a1a);
    border-bottom: 1px solid var(--users-border, #333);
}

.clients-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-select-compact,
.search-input-compact {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    background: var(--users-bg-primary, #0a0a0a);
    border: 1px solid var(--users-border, #333);
    border-radius: 6px;
    color: #fff;
}

.search-input-compact {
    width: 200px;
}

.search-input-compact:focus {
    outline: none;
    border-color: #3b82f6;
}

.btn-refresh-compact {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    background: var(--users-bg-tertiary, #2a2a2a);
    border: 1px solid var(--users-border, #333);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh-compact:hover {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* === EXCEL-STYLE TABLE === */
.clients-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.35);
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    line-height: 1.3;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* Заголовки таблицы - Компактный Armani */
.clients-table thead th {
    height: 40px;
    background: linear-gradient(180deg, #13214a, #163079);
    color: #ffffff;
    padding: 8px 10px;
    font-weight: 600;
    text-align: left;
    font-size: 12px;
    letter-spacing: 0.06em;
    border-right: 1px solid rgba(59, 130, 246, 0.22);
    border-bottom: 2px solid #3b82f6;
    position: sticky;
    top: 0;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    backdrop-filter: saturate(120%) blur(6px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.clients-table thead th:last-child {
    border-right: none;
}

.clients-table thead th:first-child {
    width: 40%;
}

.clients-table thead th.stats-header {
    width: 20%;
}

.clients-table thead th.activity-header {
    width: 20%;
}

.clients-table thead th.actions-header {
    width: 15%;
}

/* Строки таблицы - Компактная темная сеточка */
.client-row {
    border-bottom: 2px solid #1e293b;
    transition: all 0.2s ease;
    height: 34px;
    background: #0f172a;
}

/* Zebra stripes для лучшей читаемости */
.clients-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

/* Hover эффект */
.clients-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08) !important;
    transform: none;
    box-shadow: none;
}

.client-row:hover {
    background: linear-gradient(90deg, #1e3a8a15, #3b82f615);
    transform: none;
    box-shadow: none;
}

.client-row:nth-child(even) {
    background: #1e293b;
}

.client-row:nth-child(even):hover {
    background: linear-gradient(90deg, #1e3a8a20, #3b82f620);
}

.client-row.has-problems {
    border-left: 4px solid #ef4444;
    background: linear-gradient(90deg, #7f1d1d15, #0f172a);
}

.client-row.has-problems:hover {
    background: linear-gradient(90deg, #7f1d1d25, #1e3a8a15);
}

/* Ячейки таблицы - Компактная темная сеточка */
.clients-table td {
    padding: 4px 8px;
    border-right: 1px solid rgba(59, 130, 246, 0.2);
    vertical-align: middle;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.3;
}

/* Числовые колонки - выравнивание по правому краю + табличные цифры */
.clients-table td.number-cell,
.clients-table th.number-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    font-weight: 500;
}

/* Заголовки числовых колонок */
.clients-table th.number-cell {
    text-align: right;
}

.clients-table td:last-child {
    border-right: none;
}

/* Ячейка с названием чата - Золотой акцент - Компактная */
.chat-name-cell {
    padding: 4px 10px;
    font-weight: 600;
    color: #fbbf24;
    max-width: 300px;
}

.chat-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #f7c948;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.chat-title:hover {
    color: #f6ad37;
    text-decoration: none;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

/* Числовые ячейки - Элегантные цифры */
.number-cell {
    text-align: right;
    font-family: 'JetBrains Mono', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.number-cell.problems-cell {
    color: #f87171;
    font-weight: 600;
    text-shadow: 0 0 4px rgba(248, 113, 113, 0.3);
}

/* Ячейка времени - Приглушенный стиль */
.time-cell {
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
    font-style: italic;
}

/* Заголовки сортировки */
.clients-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.clients-table th.sortable:hover {
    background: linear-gradient(180deg, #18338c, #1d4ed8);
}

.clients-table th.sortable:after {
    content: '↕';
    position: absolute;
    right: 10px;
    opacity: 0.35;
    font-size: 11px;
}

.clients-table th.sortable:hover:after {
    opacity: 0.8;
}

.problems-badge {
    background: #ff6b6b;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.username-tag {
    background: #e2e8f0;
    color: #4a5568;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.chat-id {
    color: #a0aec0;
    font-size: 11px;
    font-family: 'Monaco', 'Menlo', monospace;
}

/* Ячейка со статистикой */
.stats-cell {
    padding: 20px 16px;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
}

.stat-item.problems .stat-value {
    color: #e53e3e;
}

.stat-label {
    font-size: 12px;
    color: #718096;
    font-weight: 500;
}

/* Ячейка с активностью */
.activity-cell {
    padding: 20px 16px;
}

.activity-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.activity-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.activity-status.active {
    color: #38a169;
}

.activity-status.inactive {
    color: #e53e3e;
}

.activity-status.unknown {
    color: #a0aec0;
}

.days-count {
    font-size: 12px;
    color: #718096;
    font-weight: 500;
}

/* Ячейка с действиями */
.actions-cell {
    padding: 20px 16px;
}

.actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.view-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
}

.view-btn:hover {
    background: linear-gradient(135deg, #3182ce, #2c5aa0);
    transform: translateY(-1px);
}

.edit-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.edit-btn:hover {
    background: linear-gradient(135deg, #38a169, #2f855a);
    transform: translateY(-1px);
}

/* Адаптивность */
@media (max-width: 1200px) {
    .chat-title {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .clients-table {
        font-size: 14px;
    }
    
    .chat-title {
        font-size: 14px;
        max-width: 200px;
    }
    
    .actions-buttons {
        flex-direction: row;
    }
    
    .action-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* Улучшения для заголовка модуля */
.clients-module .module-header h2 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* Контейнер таблицы - PREMIUM FRAME - Компактный */
.clients-table-container {
    position: relative;
    background: linear-gradient(180deg, #0b1220, #0e1628);
    padding: 8px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    margin-top: 0.75rem;
}

/* БОЛЬШОЙ БОРТИК - Premium gradient ring */
.clients-table-container::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 6px; /* thickness of the big border */
    background: linear-gradient(135deg, #1e3a8a, #3b82f6 60%, #22d3ee);
    -webkit-mask: 
        linear-gradient(#000 0 0) content-box, 
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: 
        linear-gradient(#000 0 0) content-box, 
        linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.9;
}

/* STICKY FIRST COLUMN - Pin название чата for horizontal scanning */
.clients-table thead .col-title,
.clients-table tbody .chat-name-cell {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #0f172a;
    box-shadow: 1px 0 0 rgba(59, 130, 246, 0.20);
}

/* Ensure sortable headers remain clickable */
.clients-table thead .col-title.sortable {
    cursor: pointer;
    pointer-events: auto;
    z-index: 11; /* Higher than sticky header z-index (10) */
}

/* === COMPACT CELL STYLES === */
.time-cell {
    color: var(--users-text-secondary, #b0b0b0);
    font-size: 0.85rem;
}

.number-cell {
    font-weight: 500;
}

.problems-cell {
    color: #ef4444;
    font-weight: 600;
}

/* === PAGINATION COMPACT === */
.pagination-compact {
    padding: 0.5rem;
    text-align: right;
    font-size: 0.75rem;
    color: var(--users-text-secondary, #b0b0b0);
}

.pagination-info {
    opacity: 0.8;
}

/* === СКРЫТЬ СТАРЫЕ БОЛЬШИЕ ЭЛЕМЕНТЫ === */
.module-header {
    display: none;
}

.module-header h2 {
    display: none;
}

/* 🏭 ENTERPRISE v2: Color Coded Chips для команды */
.team-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
    max-width: 180px;
}

/* Цветной чип участника команды */
.team-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid;
    transition: all 0.15s ease;
    cursor: default;
}

.team-chip:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Имя участника */
.team-chip-name {
    font-weight: 500;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Количество сообщений - жирный */
.team-chip-count {
    font-weight: 700;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    min-width: 14px;
    text-align: center;
}

/* Если только число без детализации */
.team-total-only {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    font-variant-numeric: tabular-nums;
}

/* Индикатор "ещё N участников" */
.team-more-chip {
    font-size: 10px;
    color: #64748b;
    padding: 2px 4px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 3px;
}

/* Старый стиль - deprecated */
.team-breakdown,
.team-compact,
.team-members,
.team-member {
    display: none !important;
}

.number-cell span[title] {
    cursor: help;
}

/* Компактные стили для таблицы чатов */
.col-last-compact {
    width: 80px !important;
    max-width: 80px !important;
}

.time-cell-compact {
    color: var(--users-text-secondary, #b0b0b0);
    font-size: 0.8rem;
    white-space: nowrap;
    padding: 4px 6px !important;
}

.col-opportunities {
    width: 60px;
    text-align: center;
}

.opportunities-cell {
    color: #22c55e !important;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.1);
}

.problems-cell {
    color: #ef4444 !important;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
}
