/* embeddings_viewer.css - Стили для просмотра эмбеддингов */
/* v1.0.0 - 24.10.2025 22:00 */

/* ═══════════════════════════════════════════════════════════
   ОБЩИЕ СТИЛИ
   ═══════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */

.embeddings-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.header-left h1 {
    font-size: 24px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 15px;
    color: #999;
}

.search-box input {
    padding: 12px 15px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    width: 300px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    align-items: center;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    transition: background 0.2s;
}

.filter-checkbox:hover {
    background: #e8e8e8;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.filter-checkbox span {
    font-size: 14px;
    color: #555;
}

/* Stats Badge */
.stats-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.stats-badge .divider {
    opacity: 0.6;
}

/* Stats Button */
.stats-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stats-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */

.embeddings-main {
    max-width: 1600px;
    margin: 30px auto;
    padding: 0 30px;
}

/* Loading */
.loading-indicator {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    color: white;
    font-size: 16px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
}

.empty-state i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h2 {
    color: #555;
    margin-bottom: 10px;
}

.empty-state p {
    color: #888;
}

/* ═══════════════════════════════════════════════════════════
   PRODUCTS GRID
   ═══════════════════════════════════════════════════════════ */

.products-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Product Card - ГОРИЗОНТАЛЬНЫЙ БЛОК */
.product-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: row;
}

.product-card:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Product Header - LEFT SIDE */
.product-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-width: 280px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-id {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.product-name {
    font-size: 14px;
    opacity: 0.95;
    margin-bottom: 12px;
}

.product-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    opacity: 0.9;
}

.product-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Product Info - MIDDLE */
.product-info {
    padding: 20px;
    border-right: 1px solid #f0f0f0;
    min-width: 200px;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    color: #888;
    font-weight: 500;
}

.info-value {
    color: #333;
    font-weight: 600;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.enabled {
    background: #d4edda;
    color: #155724;
}

.status-badge.disabled {
    background: #f8d7da;
    color: #721c24;
}

/* Photos Grid - RIGHT SIDE (С ПЕРЕНОСОМ НА НОВУЮ СТРОКУ) */
.photos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
    flex: 1;
    align-content: flex-start;
}

.photo-slot {
    position: relative;
    width: 150px;
    height: 150px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
}

.photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.photo-slot:hover img {
    transform: scale(1.1);
}

/* Delete Button */
.photo-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
}

.photo-slot:hover .photo-delete {
    opacity: 1;
}

.photo-delete:hover {
    transform: scale(1.1);
    background: rgba(200, 35, 51, 1);
}

.photo-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.photo-badge.source-k {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.photo-badge.source-r {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.photo-index {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* No Photos */
.no-photos {
    padding: 30px;
    text-align: center;
    color: #999;
}

.no-photos i {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 20px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

/* Stats Display */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Distribution Chart */
.distribution-chart {
    margin-top: 20px;
}

.distribution-chart h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
}

.distribution-bar {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.distribution-label {
    width: 100px;
    font-size: 14px;
    color: #555;
}

.distribution-bar-container {
    flex: 1;
    height: 24px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.distribution-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
}

.distribution-value {
    margin-left: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    min-width: 40px;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */

.embeddings-footer {
    text-align: center;
    padding: 30px 20px;
    color: white;
    font-size: 14px;
}

.version-info {
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .product-card {
        flex-direction: column;
    }
    
    .product-header,
    .product-info {
        min-width: 100%;
        max-width: 100%;
    }
    
    .photos-grid {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-left,
    .header-right {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .product-header,
    .product-info {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .photo-slot {
        width: 120px;
        height: 120px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

