/* contractor_ratings.css */
.contractor-ratings-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
.page-title {
    color: #2c3e50;
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 600;
}
.filters-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid #e9ecef;
}
.filters-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.filter-group {
    flex: 1;
    min-width: 200px;
}
.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out;
}
.form-control:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
#reset-filters {
    height: 38px;
    min-width: 120px;
    background: #6c757d;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    transition: background-color 0.2s;
}
#reset-filters:hover {
    background: #5a6268;
}
.work-type-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}
.work-type-title {
    color: #495057;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
}
.table-responsive {
    overflow-x: auto;
}
.ratings-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}
.ratings-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}
.ratings-table td {
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}
.contractor-row {
    cursor: pointer;
    transition: background-color 0.2s;
}
.contractor-row:hover {
    background-color: #f8f9fa;
}
.contractor-name {
    color: #2c3e50;
    font-size: 16px;
}
.object-count {
    color: #6c757d;
    font-size: 12px;
}
.small.gray {
    font-size: small;
    color: gray;
}
.details-row {
    background-color: #f8fafc;
}
.details-container {
    padding: 16px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}
.objects-table {
    width: 100%;
    border-collapse: collapse;
}
.objects-table th {
    background: #f1f3f5;
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
    color: #495057;
}
.objects-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
}
.object-row:hover {
    background-color: #f8f9fa;
}
.rating-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    min-width: 50px;
    text-align: center;
}
.rating-green {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.rating-yellow {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}
.rating-red {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.rating-gray {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
}
.rating-green-bar {
    background-color: #28a745;
}
.rating-yellow-bar {
    background-color: #ffc107;
}
.rating-red-bar {
    background-color: #dc3545;
}
.rating-gray-bar {
    background-color: #6c757d;
}
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}
.no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #adb5bd;
}
.no-results h4 {
    margin-bottom: 8px;
    color: #495057;
}
.error-state {
    text-align: center;
    padding: 40px 20px;
}
.error-icon {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 16px;
}
.error-text {
    color: #721c24;
    margin-bottom: 16px;
    font-size: 16px;
}
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}
/* Стили для контейнера поиска с подсказками */
.combined-search-group {
    position: relative;
    flex: 1;
    min-width: 300px;
}
.combined-search-container {
    position: relative;
    width: 100%;
}
/* Выпадающие подсказки */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
    display: none;
}
.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
    transition: background-color 0.15s;
}
.suggestion-item:last-child {
    border-bottom: none;
}
.suggestion-item:hover {
    background-color: #f0f0f0;
}
.suggestion-item.no-results:hover {
    background-color: transparent;
}
.suggestion-item:focus {
    outline: none;
    background-color: #f0f0f0;
}
.suggestion-item.no-results {
    color: #666;
    font-style: italic;
    cursor: default;
    text-align: center;
    padding: 15px;
}
/* Скроллбар */
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}
.search-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.search-suggestions::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}
.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: #555;
}
/* Стили для статуса поиска */
.search-status {
    margin-bottom: 16px;
}
.search-status .alert {
    margin: 0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
    background: #e8f4fd;
    border: 1px solid #b6d4fe;
    color: #055160;
}
.search-status .alert i {
    font-size: 14px;
}
#clear-search {
    margin-left: auto;
    padding: 0;
    color: #055160;
    text-decoration: underline;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
}
#clear-search:hover {
    color: #033e4b;
}
@media (max-width: 768px) {
    .combined-search-group {
        min-width: 100%;
    }
    .search-suggestions {
        position: absolute;
        max-height: 200px;
    }
    .suggestion-item {
        padding: 12px 16px;
        font-size: 15px;
    }
}
/* Анимация появления */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@media (max-width: 768px) {
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}
@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }
    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}
/* Мобильные стили */
.mobile-only {
    display: none;
}
@media (max-width: 768px) {
    .mobile-only {
        display: block;
        margin-top: 4px;
        font-size: 13px;
        color: #6c757d;
    }
    .contractor-info {
        display: flex;
        flex-direction: column;
    }
}
/* Адаптивность */
@media (max-width: 768px) {
    .contractor-ratings-page {
        padding: 12px;
    }
    .filters-row {
        flex-direction: column;
        gap: 12px;
    }
    .filter-group {
        min-width: 100%;
    }
    #reset-filters {
        width: 100%;
    }
    .ratings-table th,
    .ratings-table td {
        padding: 8px 12px;
    }
    .work-type-section {
        padding: 12px;
    }
}
/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    display: none;
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
}
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
.overall-score {
    text-align: center;
    margin: 20px 0;
}
.large {
    font-size: 32px;
    padding: 10px 20px;
}
.work-types-bars {
    margin-bottom: 20px;
}
.objects-list {
    padding: 16px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}
.obj-work-types {
    padding: 8px;
}
.work-type-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}
.obj-details-row {
    background-color: #f8fafc;
}

/* Обновленные стили для прогресс-баров в модальном окне */
#modal-work-types .work-type-bar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
    flex-wrap: nowrap;
    min-width: 100%;
    box-sizing: border-box;
}

#modal-work-types .work-type-bar:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

#modal-work-types .work-type-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: #6c757d;
    font-size: 16px;
    flex-shrink: 0;
    order: 1;
}

#modal-work-types .work-type-icon i {
    opacity: 0.8;
}

#modal-work-types .bar-label {
    width: 120px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    order: 2;
    margin-right: 12px;
}

#modal-work-types .bar-container {
    flex: 1;
    min-width: 80px;
    background: #e9ecef;
    border-radius: 4px;
    height: 16px;
    overflow: hidden;
    margin: 0;
    order: 3;
}

#modal-work-types .bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

#modal-work-types .bar-score {
    width: 50px;
    font-weight: 600;
    font-size: 14px;
    text-align: right;
    color: #495057;
    flex-shrink: 0;
    order: 4;
    margin-left: 12px;
}

/* Обновленные стили для прогресс-баров в подробностях объекта */
.work-types-container .work-type-bar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
    flex-wrap: nowrap;
    min-width: 100%;
    box-sizing: border-box;
}

.work-types-container .work-type-bar:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.work-types-container .work-type-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: #6c757d;
    font-size: 16px;
    flex-shrink: 0;
    order: 1;
}

.work-types-container .work-type-icon i {
    opacity: 0.8;
}

.work-types-container .bar-label {
    width: 120px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    order: 2;
    margin-right: 12px;
}

.work-types-container .bar-container {
    flex: 1;
    min-width: 80px;
    background: #e9ecef;
    border-radius: 4px;
    height: 16px;
    overflow: hidden;
    margin: 0;
    order: 3;
}

.work-types-container .bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.work-types-container .bar-score {
    width: 50px;
    font-weight: 600;
    font-size: 14px;
    text-align: right;
    color: #495057;
    flex-shrink: 0;
    order: 4;
    margin-left: 12px;
}

/* Адаптивность для узких экранов */
@media (max-width: 768px) {
    /* Контейнер модального окна */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }

    /* Прогресс-бары в модальном окне - фиксированная структура */
    #modal-work-types .work-type-bar {
        flex-wrap: nowrap;
        overflow: visible;
    }

    #modal-work-types .bar-container {
        min-width: 60px;
        flex: 1;
        order: 3;
    }

    #modal-work-types .bar-score {
        width: 45px;
        order: 4;
        text-align: right;
        margin-left: 8px;
        flex-shrink: 0;
    }

    #modal-work-types .bar-label {
        width: 100px;
        order: 2;
        margin-right: 8px;
        flex-shrink: 0;
    }

    #modal-work-types .work-type-icon {
        order: 1;
        margin-right: 8px;
        flex-shrink: 0;
    }

    /* Прогресс-бары в подробностях объекта - фиксированная структура */
    .work-types-container .work-type-bar {
        flex-wrap: nowrap;
        overflow: visible;
    }

    .work-types-container .bar-container {
        min-width: 60px;
        flex: 1;
        order: 3;
    }

    .work-types-container .bar-score {
        width: 45px;
        order: 4;
        text-align: right;
        margin-left: 8px;
        flex-shrink: 0;
    }

    .work-types-container .bar-label {
        width: 100px;
        order: 2;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .work-types-container .work-type-icon {
        order: 1;
        margin-right: 8px;
        flex-shrink: 0;
    }

    /* Объекты в таблице */
    .objects-table {
        width: 100%;
        display: block;
    }

    .object-name {
        font-size: 14px;
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Удаляем неправильные стили для .work-type-header */
    .work-type-header {
        display: contents;
    }

    .bar-score {
        font-size: 13px;
    }

    /* Анимация для мобильных */
    @keyframes slideDownMobile {
        from {
            opacity: 0;
            transform: translateY(-5px);
            max-height: 0;
        }
        to {
            opacity: 1;
            transform: translateY(0);
            max-height: 1000px;
        }
    }

    .obj-details-row {
        animation: slideDownMobile 0.3s ease-out;
    }
}

/* Очень узкие экраны (меньше 400px) */
@media (max-width: 400px) {
    .modal-content {
        width: 98%;
        padding: 10px;
        margin: 5% auto;
    }

    #modal-work-types .bar-label,
    .work-types-container .bar-label {
        width: 80px;
        font-size: 13px;
    }

    #modal-work-types .bar-score,
    .work-types-container .bar-score {
        width: 40px;
        font-size: 13px;
    }

    #modal-work-types .work-type-icon,
    .work-types-container .work-type-icon {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
}

/* Цвета для баров */
.rating-green-bar {
    background-color: #28a745;
}

.rating-yellow-bar {
    background-color: #ffc107;
}

.rating-red-bar {
    background-color: #dc3545;
}

.rating-gray-bar {
    background-color: #6c757d;
}

.object-row:hover {
    background-color: #f8f9fa;
}

.object-info {
    padding: 4px 0;
}

.object-name {
    font-weight: 500;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.chevron-icon {
    margin-left: 8px;
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.object-row.active .chevron-icon {
    transform: rotate(90deg);
}

/* Анимация */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
}

.obj-details-row {
    animation: slideDown 0.3s ease-out;
}

/* Контейнер объектов */
.objects-container {
    max-width: 100%;
    overflow-x: auto;
}

.objects-table {
    min-width: 300px;
    width: 100%;
}

/* Полоса прокрутки для узких экранов */
.objects-container::-webkit-scrollbar {
    height: 6px;
}

.objects-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.objects-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.objects-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}