/* Стили для подгрупп компонентов */



.group-item {
    position: relative;
    transition: all 0.2s ease;
    margin-bottom: 0px;
    cursor: pointer;
}

.group-item:hover {
    background-color: #f8f9fa;
}

.group-item[data-group-id] {
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.group-item[data-group-id]:hover {
    border-left-color: #007bff;
    box-shadow: -3px 0 8px rgba(0, 123, 255, 0.3);
}

/* Стили для подгрупп */
.subgroup-item {
    margin-left: 0px;
    border-left: 2px solid #e9ecef;
    padding-left: 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.subgroup-item:hover {
    background-color: #e9ecef;
    border-left-color: #28a745;
    box-shadow: -2px 0 8px rgba(40, 167, 69, 0.3);
}

.subgroup-item .item-info h4 {
    font-size: 0.95rem;
    color: #495057;
}

.subgroup-item .item-info p {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Убираем лишние контейнеры для подгрупп */
.subgroups-section {
    display: none;
}

.subgroups-list {
    display: contents;
}

/* Стили для компонентов в подгруппах */
.subgroup-item .group-content .components-list {
    display: contents;
}

.subgroup-item .group-content .components-list .component-card {
    margin-bottom: 8px;
}

/* Стили для иерархии */
.group-item .item-info h4 {
    font-weight: 500;
    margin-bottom: 4px;
}

.group-item .item-info p {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

/* Стили для подгрупп */
.subgroups-section {
    margin: 16px 0;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.subgroups-section h5 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 600;
}

.subgroups-list {
    margin-left: 0;
}

/* Отступы для разных уровней вложенности */
.group-item[style*="margin-left: 0px"] {
    border-left-color: #007bff;
}

.group-item[style*="margin-left: 20px"] {
    border-left-color: #28a745;
}

.group-item[style*="margin-left: 40px"] {
    border-left-color: #ffc107;
}

.group-item[style*="margin-left: 60px"] {
    border-left-color: #dc3545;
}

/* Стили для кнопок действий */
.item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    pointer-events: auto;
}

.item-actions .btn {
    pointer-events: auto;
}

.item-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    gap: 0.5rem;
}

/* Стили для кнопки загрузки */
.item-actions .btn-primary {
    background-color: #007bff;
    color: white;
}

.item-actions .btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.item-actions .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.item-actions .btn-secondary:hover {
    background-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* Стили для счетчиков */
.group-item .item-info h4::after {
    content: '';
    margin-left: 8px;
    font-size: 0.8rem;
    font-weight: normal;
    color: #6c757d;
}

/* Анимации для разворачивания/сворачивания */
.group-content {
    padding-top: 0rem !important;
    overflow: hidden;
    transition: all 0.3s ease;
}

.group-content[style*="display: none"] {
    max-height: 0;
    opacity: 0;
}

.group-content[style*="display: block"] {
    margin: 1rem;
    max-height: 1000px;
    opacity: 1;
}

/* Стили для пустых состояний */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state.locked {
    color: #dc3545;
}

.empty-state.info {
    color: #17a2b8;
}

/* Стили для загрузки */
.loading-state {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Адаптивность */
@media (max-width: 768px) {
    .group-item {
        margin-left: 0 !important;
        padding: 12px;
    }
    
    .item-actions {
        flex-wrap: wrap;
        gap: 2px;
    }
    
    .item-actions .btn {
        padding: 2px 6px;
        font-size: 0.7rem;
    }
}

/* Стили для модальных окон */
.modal-form .form-group {
    margin-bottom: 16px;
}

.modal-form .form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #495057;
}

.modal-form .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.modal-form .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.modal-form .form-help {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 4px;
}

/* Стили для селекта с иерархией */
.modal-form select option {
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.modal-form select option[value=""] {
    font-style: italic;
    color: #6c757d;
}

/* Стили для отображения иерархии в селекте */
.modal-form select {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.4;
}

/* Подсветка групп с подгруппами */
.modal-form select option:not([value=""]) {
    border-bottom: 1px solid #f0f0f0;
}

/* Стили для счетчиков в селекте */
.modal-form select option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}
