/* ============================================================
   СТИЛИ ДЛЯ ПАРТНЁРСКОГО ДАШБОРДА
   ============================================================ */

/* ============================================================
   1. Компактные карточки статистики
   ============================================================ */
.compact-stat-card {
    padding: 12px 16px;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e9ecef !important;
}
.compact-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
}
.compact-stat-card .number {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    color: #212529;
}
.compact-stat-card .label {
    color: #6c757d;
    font-size: 0.7rem;
    margin-top: 2px;
}
.compact-stat-card h6 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #343a40;
}
.compact-stat-card .btn-sm {
    font-size: 0.7rem;
    padding: 3px 8px;
}
.compact-stat-card .badge {
    font-size: 0.65rem;
    padding: 2px 8px;
}
.compact-stat-card .text-muted {
    font-size: 0.7rem;
    margin-bottom: 0;
}
.compact-stat-card .small-text {
    font-size: 0.7rem;
}
.compact-stat-card.mt-3 {
    margin-top: 10px !important;
}
.compact-stat-card.mt-2 {
    margin-top: 8px !important;
}

/* ============================================================
   2. Статистика (главная)
   ============================================================ */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s;
    height: 100%;
}
.stat-card:hover {
    transform: translateY(-2px);
}
.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
}
.stat-card .label {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 4px;
}
.stat-card .icon {
    font-size: 2rem;
    opacity: 0.2;
}

/* ============================================================
   3. Дерево структуры
   ============================================================ */
.tree-container {
    padding: 10px 0;
}
.tree-node {
    position: relative;
    padding-left: 30px;
    margin-bottom: 8px;
}
.tree-node::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}
.tree-node:last-child::before {
    height: 50%;
}
.tree-node .node-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    gap: 10px;
    width: 100%;
}
.tree-node .node-card:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(26,115,232,0.1);
}
.tree-node .node-card.senior {
    border-left: 4px solid #fd7e14;
}
.tree-node .node-card.partner {
    border-left: 4px solid #1a73e8;
}
.tree-node .node-card.blocked {
    border-left: 4px solid #dc3545;
    opacity: 0.85;
}
.tree-node .children {
    padding-left: 20px;
}
.tree-level-0 > .node-card {
    background: #f8f9fa;
    border-color: #1a73e8;
}
.tree-level-0 > .node-card .level-badge {
    background: #1a73e8;
    color: white;
}

/* ============================================================
   4. Переключатель дерева
   ============================================================ */
.level-badge-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
.level-badge {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 12px;
    background: #f1f3f5;
    color: #6c757d;
}
.tree-toggle {
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
    margin-left: 4px;
}
.tree-toggle:hover {
    background: #e9ecef;
    color: #1a73e8;
}

/* ============================================================
   5. Профиль
   ============================================================ */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #6c757d;
}

/* ============================================================
   6. Отступы
   ============================================================ */
.mt-2 {
    margin-top: 8px !important;
}
.mt-3 {
    margin-top: 12px !important;
}

/* ============================================================
   7. Детальная страница заявки
   ============================================================ */
.lead-detail-table th {
    width: 150px;
    background: #f8f9fa;
}
.lead-detail-table td {
    word-break: break-word;
}
.lead-detail-comments {
    min-height: 80px;
}

/* ============================================================
   8. Профиль
   ============================================================ */
.profile-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 3px solid #1a73e8;
}
.profile-avatar-placeholder {
    width: 120px;
    height: 120px;
    font-size: 3rem;
    background: #6c757d;
    color: white;
}
.profile-preview-card {
    border-left: 4px solid #1a73e8;
}
.color-text-input {
    width: 80px;
}

/* ============================================================
   9. Сворачивание веток дерева
   ============================================================ */
.tree-node .children {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 10000px;
    opacity: 1;
    padding-left: 20px;
}
.tree-node .children.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    overflow: hidden;
}
.contact-info {
    font-size: 0.85rem;
    color: #6c757d;
}
.tree-node.hidden-by-search {
    display: none !important;
}

/* ============================================================
   10. Подсветка найденного партнёра
   ============================================================ */
.highlighted-node > .node-card {
    border: 3px solid #1a73e8 !important;
    box-shadow: 0 0 0 4px rgba(26,115,232,0.3), 0 0 30px rgba(26,115,232,0.15) !important;
    background: #f0f7ff !important;
    animation: highlight-pulse 2s ease-in-out 4;
    border-radius: 8px;
}
@keyframes highlight-pulse {
    0% { box-shadow: 0 0 0 4px rgba(26,115,232,0.3), 0 0 30px rgba(26,115,232,0.15); }
    50% { box-shadow: 0 0 0 12px rgba(26,115,232,0.05), 0 0 50px rgba(26,115,232,0.05); }
    100% { box-shadow: 0 0 0 4px rgba(26,115,232,0.3), 0 0 30px rgba(26,115,232,0.15); }
}
.highlighted-node .node-card strong::after {
    content: ' 🔍';
    font-size: 0.9rem;
}
.highlighted-node .tree-node .node-card {
    border: 1px solid #e9ecef !important;
    box-shadow: none !important;
    background: white !important;
    animation: none !important;
    border-left: 4px solid #1a73e8 !important;
}
.highlighted-node .tree-node .node-card strong::after {
    content: '' !important;
}
.highlighted-node > .node-card {
    border-left: 4px solid #1a73e8 !important;
}

/* ============================================================
   11. Выравнивание элементов в карточке дерева
   ============================================================ */
.tree-node .node-card > div:first-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tree-node .node-card > .level-badge-wrapper {
    flex-shrink: 0;
    margin-left: auto;
}