/* web_moderation/static/css/moderation.css - Стили для модерации */

/* Компактная панель ML предсказаний - фиксированная высота */
.ml-predictions-compact {
    min-height: 75px !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 8px !important;
}

/* Подкатегория - занимает 1-2 строки с процентом на первой */
.subcategory-line {
    min-height: 42px;
    display: flex;
    align-items: flex-start;
    margin-bottom: 2px;
}

.subcategory-text {
    flex: 1;
    line-height: 1.35;
    max-height: 42px;
    overflow: hidden;
    word-wrap: break-word;
    padding-right: 4px;
}

/* Badge процента всегда справа на первой строке */
.subcategory-badge {
    margin-left: auto;
    white-space: nowrap;
    align-self: flex-start;
    flex-shrink: 0;
}

/* Категория ВСЕГДА внизу панели (3-я строка) */
.category-line {
    margin-top: auto;
    line-height: 1.3;
}

/* ML Predictions Panel */
.ml-predictions-panel {
    font-size: 0.9rem;
}

.ml-predictions-panel .card {
    background-color: #f8f9fa;
}

.ml-predictions-panel .similar-item {
    transition: background-color 0.2s;
    cursor: pointer;
}

.ml-predictions-panel .similar-item:hover {
    background-color: #e9ecef !important;
}

.ml-predictions-panel .prediction-item {
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.ml-predictions-panel h6 {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Статистические блоки */
.stat-box {
    padding: 1rem;
    text-align: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-box .stat-number {
    font-size: 2rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.stat-box .stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Карточки фотографий */
.photo-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.photo-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.photo-card.selected {
    border: 3px solid #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.photo-preview {
    cursor: pointer;
    transition: all 0.3s ease;
    object-fit: cover;
}

.photo-preview:hover {
    transform: scale(1.02);
}

/* Чекбоксы для выбора фото */
.photo-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    transform: scale(1.2);
    z-index: 10;
}

/* ML статус индикаторы */
.ml-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.ml-status-badge.ml-ready {
    background: rgba(25, 135, 84, 0.9);
    color: white;
}

.ml-status-badge.ml-loading {
    background: rgba(255, 193, 7, 0.9);
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.ml-status-badge:hover {
    transform: scale(1.1);
    cursor: help;
}

.photo-card .card-header {
    position: relative;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem;
}

/* Действия с фото */
.photo-actions {
    padding: 0.5rem;
}

.photo-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

/* Модальные окна */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(45deg, #6f42c1, #8b5cf6);
    color: white;
    border-bottom: none;
    border-radius: 15px 15px 0 0;
}

.modal-body {
    padding: 1.5rem;
}

#modal-photo {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Формы */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #6f42c1;
    box-shadow: 0 0 0 0.2rem rgba(111, 66, 193, 0.25);
}

/* Кнопки в модальном окне */
.modal-footer .btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
}

/* Уведомления (тосты) */
.toast {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.toast-header {
    background: linear-gradient(45deg, #6f42c1, #8b5cf6);
    color: white;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

/* Анимации загрузки */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    z-index: 100;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #6f42c1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Сетка фотографий */
#photos-grid {
    min-height: 400px;
}

.photo-grid-item {
    margin-bottom: 1.5rem;
}

/* Вид списка */
.list-view .photo-card {
    margin-bottom: 1rem;
}

.list-view .photo-preview {
    height: 80px;
    width: 80px;
    object-fit: cover;
}

.list-view .card-body {
    display: flex;
    align-items: center;
    padding: 1rem;
}

.list-view .photo-info {
    flex-grow: 1;
    margin-left: 1rem;
}

.list-view .photo-actions {
    margin-left: auto;
}

/* Полноэкранный режим */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    overflow-y: auto;
    padding: 1rem;
}

.fullscreen-mode .navbar {
    margin: -1rem -1rem 1rem -1rem;
}

/* Поиск и фильтры */
.search-highlight {
    background-color: yellow;
    font-weight: bold;
}

/* Драг-н-дроп */
.drop-zone {
    border: 3px dashed #6c757d;
    border-radius: 15px;
    padding: 3rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    border-color: #6f42c1;
    background: #f0e6ff;
    transform: scale(1.02);
}

.drop-zone i {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* Прогресс-бар */
.progress {
    height: 8px;
    border-radius: 10px;
    background: #e9ecef;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(45deg, #6f42c1, #8b5cf6);
    transition: width 0.3s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .stat-box .stat-number {
        font-size: 1.5rem;
    }
    
    .photo-card {
        margin-bottom: 1rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .photo-grid-item {
        margin-bottom: 1rem;
    }
    
    .stat-box {
        padding: 0.5rem;
    }
    
    .stat-box .stat-number {
        font-size: 1.25rem;
    }
    
    .modal-xl {
        max-width: 95vw;
    }
}

/* Темы */
.dark-theme {
    background-color: #1a1a1a;
    color: #ffffff;
}

.dark-theme .card {
    background-color: #2d2d2d;
    color: #ffffff;
}

.dark-theme .form-control,
.dark-theme .form-select {
    background-color: #3d3d3d;
    border-color: #555;
    color: #ffffff;
}

.dark-theme .form-control:focus,
.dark-theme .form-select:focus {
    background-color: #4d4d4d;
    border-color: #6f42c1;
    color: #ffffff;
}

/* Accessibility */
.btn:focus {
    outline: 2px solid #6f42c1;
    outline-offset: 2px;
}

.photo-card:focus-within {
    outline: 2px solid #6f42c1;
    outline-offset: 2px;
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Стили для карточек товаров */
.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-color: #6f42c1;
}

.card-img-container {
    position: relative;
    background: #f8f9fa;
    overflow: hidden;
}

.card-img-container img {
    transition: transform 0.3s ease;
}

.card-img-container:hover img {
    transform: scale(1.05);
}

/* Контейнер существующих товаров */
#existing-products-container {
    animation: fadeInUp 0.3s ease-in-out;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

#existing-products-container .card-header {
    background: linear-gradient(45deg, #17a2b8, #20c997);
    color: white;
    border-bottom: none;
}

#existing-products-container .card-body {
    background: #f8f9fa;
}

/* Скролл для списка товаров */
#existing-products-list {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #6f42c1 #f1f1f1;
}

#existing-products-list::-webkit-scrollbar {
    width: 8px;
}

#existing-products-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#existing-products-list::-webkit-scrollbar-thumb {
    background: #6f42c1;
    border-radius: 10px;
}

#existing-products-list::-webkit-scrollbar-thumb:hover {
    background: #5a2d91;
}

/* Улучшенные кнопки в футере модального окна */
.modal-footer .btn-group .btn {
    margin: 0 2px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-footer .btn-info {
    background: linear-gradient(45deg, #17a2b8, #20c997);
    border: none;
    color: white;
}

.modal-footer .btn-info:hover {
    background: linear-gradient(45deg, #138496, #1c7f75);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(23, 162, 184, 0.3);
}

/* Информация о товаре */
.product-card .card-body small {
    line-height: 1.4;
}

.product-card .card-body small div {
    margin-bottom: 2px;
}

.product-card .card-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    font-size: 0.8rem;
}

/* Улучшенные стили для похожих товаров с фото */
.similar-item-row {
    background: white;
    position: relative;
    overflow: hidden;
}

.similar-item-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(13, 110, 253, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.similar-item-row:hover::before {
    opacity: 1;
}

.similar-item-photo {
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.similar-item-row:hover .similar-item-photo {
    border-color: #0d6efd;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.similar-item-photo img {
    transition: transform 0.3s ease;
}

.similar-item-row:hover .similar-item-photo img {
    transform: scale(1.1);
}

/* Анимация загрузки изображений */
.similar-item-photo img {
    opacity: 0;
    animation: fadeInImage 0.3s ease forwards;
}

@keyframes fadeInImage {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Стили для фильтрованных товаров */
.card-header.bg-info .similar-item-photo {
    border-color: #0dcaf0;
}

.card-header.bg-info .similar-item-row:hover .similar-item-photo {
    border-color: #0dcaf0;
    box-shadow: 0 4px 8px rgba(13, 202, 240, 0.25);
}

/* Стили для деталей товара */
.similar-item-row .product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    margin-top: 8px;
}

.similar-item-row .product-details > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.similar-item-row .product-details strong {
    color: #6c757d;
    font-weight: 600;
}

/* Увеличиваем высоту строки для отображения всех данных */
.similar-item-row {
    min-height: 100px;
}

/* Badge для ID товара */
.similar-item-row .badge.bg-secondary {
    font-size: 0.75rem;
    font-weight: normal;
    padding: 0.2rem 0.5rem;
}

/* Пустое состояние */
.alert-info {
    border: none;
    background: linear-gradient(45deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-radius: 10px;
}

/* Адаптивность для карточек товаров */
@media (max-width: 768px) {
    .product-card .card-body {
        padding: 1rem;
    }
    
    .product-card .card-title {
        font-size: 0.8rem;
    }
    
    .product-card .card-body small {
        font-size: 0.7rem;
    }
}

/* Слайдер товаров */
.products-slider-container {
    position: relative;
    overflow: visible; /* Убираем прокрутку */
    height: auto; /* Автоматическая высота */
    min-height: 450px; /* Минимальная высота */
}

.products-slider {
    display: flex;
    flex-wrap: wrap; /* Переносим товары на новую строку */
    gap: 1rem;
    justify-content: flex-start;
}

.transition-transform {
    transition: transform 0.3s ease;
}

.products-slider .product-card-wrapper {
    flex: 0 0 auto;
    width: 320px; /* Еще больше увеличиваем ширину карточки */
    height: 420px; /* Еще больше увеличиваем высоту карточки */
}

.products-slider .product-card {
    width: 100%;
    height: 100%;
    transition: all 0.3s ease;
}

.products-slider .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #6f42c1;
}

/* Пагинация точками */
.pagination-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-dot.active {
    background: #6f42c1;
    transform: scale(1.2);
}

.pagination-dot:hover {
    background: #17a2b8;
}

/* Кнопки навигации слайдера */
#products-prev-btn:disabled,
#products-next-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Счетчик товаров */
#products-count {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

@media (max-width: 768px) {
    .products-slider-container {
        min-height: 400px; /* Минимальная высота для планшетов */
    }
    
    .products-slider .product-card-wrapper {
        width: 280px; /* Размер для планшетов */
        height: 380px; /* Высота для планшетов */
    }
    
    #existing-products-container .card-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    #existing-products-container .card-header .d-flex {
        align-self: flex-end;
    }
}

@media (max-width: 576px) {
    .products-slider-container {
        min-height: 350px; /* Минимальная высота для мобильных */
    }
    
    .products-slider .product-card-wrapper {
        width: 250px; /* Размер для мобильных */
        height: 330px; /* Высота для мобильных */
    }
    
    .products-slider .product-card .card-img-container {
        height: 150px !important; /* Еще больше увеличиваем высоту изображений */
    }
    
    .products-slider .product-card .card-body {
        padding: 0.5rem !important;
    }
    
    .products-slider .product-card .card-title {
        font-size: 0.75rem !important;
    }
    
    .products-slider .product-card small {
        font-size: 0.65rem !important;
    }
}

/* Стили для ML анализа */
.similar-item-thumbnail {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #ddd;
}

.similar-items {
    font-size: 0.85rem;
}

.similar-items .text-muted {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

/* Стили для кнопок ссылок на Google таблицы */
.nav-link i.bi-table {
    font-size: 1.1rem;
}

.btn-outline-success i.bi-table {
    margin-right: 0.25rem;
}

/* Анимация для кнопки таблицы в навигации */
.navbar .nav-link:hover i.bi-table {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Стили для кнопки таблицы в панели управления */
.btn-outline-success.btn-sm {
    border-color: #198754;
    color: #198754;
    font-weight: 500;
}

.btn-outline-success.btn-sm:hover {
    background-color: #198754;
    border-color: #198754;
    color: white;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Адаптивность для кнопки таблицы */
@media (max-width: 768px) {
    .nav-link .d-none.d-md-inline {
        display: none !important;
    }
    
    .btn-outline-success.btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* ==================== Choices.js Кастомные стили ==================== */

/* Интеграция с Bootstrap form-select */
.choices {
    margin-bottom: 0;
    font-size: inherit;
}

.choices__inner {
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    min-height: 38px;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.choices__inner:hover {
    border-color: #86b7fe;
}

.choices.is-focused .choices__inner {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Поисковое поле */
.choices__input {
    background-color: transparent;
    margin-bottom: 0;
    padding: 2px 0;
    font-size: 1rem;
}

.choices__input::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

/* Dropdown список */
.choices__list--dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
    max-height: 300px;
}

.choices__list--dropdown .choices__item {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #0d6efd;
    color: #fff;
}

/* Плейсхолдер */
.choices__placeholder {
    color: #6c757d;
    opacity: 1;
}

/* "Ничего не найдено" */
.choices__item--choice.has-no-results {
    color: #6c757d;
    font-style: italic;
}

/* Кнопки очистки и dropdown */
.choices[data-type*="select-one"] .choices__button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3E%3Cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3E%3C/svg%3E");
    padding: 0;
    background-size: 12px;
    height: 20px;
    width: 20px;
    opacity: 0.5;
}

.choices[data-type*="select-one"] .choices__button:hover {
    opacity: 1;
}

/* Адаптация под темную тему (если понадобится) */
@media (prefers-color-scheme: dark) {
    .choices__inner {
        background-color: #212529;
        border-color: #495057;
        color: #fff;
    }
    
    .choices__list--dropdown {
        background-color: #212529;
        border-color: #495057;
    }
    
    .choices__list--dropdown .choices__item {
        color: #fff;
    }
}

/* Компактный режим для input-group */
.input-group .choices {
    flex: 1 1 auto;
    width: 1%;
}

.input-group .choices__inner {
    border-radius: 0;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

/* Фикс для кнопок рядом с Choices в input-group */
.input-group > .choices:not(:last-child) .choices__inner {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > .btn:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}