/* Основные переменные и сброс */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Prevent horizontal scroll globally */
* {
    max-width: 100%;
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    /* Styles for touch devices */
    .btn:hover {
        transform: none; /* Remove hover effects on touch */
    }

    .image-item:hover {
        transform: none; /* Remove hover effects on touch */
    }

    .task-item:hover {
        border-color: var(--border-color); /* Remove hover effects on touch */
    }

    /* Improve touch targets */
    .image-item {
        min-height: 120px;
        min-width: 120px;
    }

    .modal-close {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing for touch */
    .task-actions .btn {
        margin: 0.125rem;
    }

    .section-header .btn {
        margin: 0.125rem;
    }

    /* Improve form elements for touch */
    .checkbox-label {
        min-height: 44px;
        padding: 0.5rem 0;
        display: flex;
        align-items: center;
    }

    .checkbox-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
    -webkit-text-size-adjust: 100%; /* Prevent text scaling on mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Заголовок */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.icon-logo {
    width: 48px;
    height: 48px;
    stroke-width: 2;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Карточки */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Иконки */
.icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.icon-large {
    width: 64px;
    height: 64px;
    stroke-width: 1.5;
    opacity: 0.3;
}

/* Формы */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.975rem;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Индикатор извлеченного артикула */
.extracted-article {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #dcfce7;
    border: 2px solid #22c55e;
    border-radius: var(--radius-md);
    color: #166534;
    font-size: 0.875rem;
}

.extracted-article .icon {
    flex-shrink: 0;
    color: #22c55e;
    width: 18px;
    height: 18px;
}

.extracted-article strong {
    color: #15803d;
    font-size: 1rem;
}

/* Cooldown сообщение */
.cooldown-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: var(--radius-md);
    color: #92400e;
    font-size: 0.975rem;
}

.cooldown-message .icon {
    flex-shrink: 0;
    color: #f59e0b;
}

.cooldown-message strong {
    color: #b45309;
    font-size: 1.1rem;
}

/* Сообщение о блокировке активной задачей */
.cooldown-message.task-blocking {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.cooldown-message.task-blocking .icon {
    color: #3b82f6;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #16a34a;
}

/* Список задач */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-item {
    position: relative;
    padding: 1.75rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    animation: taskItemSlideIn 0.4s ease-out;
    animation-fill-mode: both;
}

.task-item:nth-child(1) { animation-delay: 0s; }
.task-item:nth-child(2) { animation-delay: 0.1s; }
.task-item:nth-child(3) { animation-delay: 0.2s; }
.task-item:nth-child(4) { animation-delay: 0.3s; }
.task-item:nth-child(5) { animation-delay: 0.4s; }

@keyframes taskItemSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color), var(--success-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.task-item:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 8px 16px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(99, 102, 241, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(99, 102, 241, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(248, 250, 252, 0.1) 100%);
}

.task-item:hover::before {
    opacity: 1;
}

.task-item:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    gap: 1.25rem;
    position: relative;
}

.task-info {
    flex: 1;
    position: relative;
}

.task-id {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(59, 130, 246, 0.1));
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.2);
    margin-bottom: 0.75rem;
    display: inline-block;
    letter-spacing: 0.025em;
    transition: all 0.2s ease;
}

.task-id:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.15));
    transform: translateY(-1px);
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.task-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.task-meta span:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--text-primary);
}

.task-meta .icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.task-meta span:hover .icon {
    opacity: 1;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.task-actions .btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-actions .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
}

.task-actions .btn:active::before {
    width: 120px;
    height: 120px;
}

.task-actions .btn .icon {
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

.task-actions .btn:hover .icon {
    transform: scale(1.1);
}

/* Статус бейдж */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.status-pending {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.1);
}

.status-processing {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
    animation: pulse 2s infinite;
}

.status-completed {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.2);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.status-failed {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.1);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Современный прогресс бар задач */
.progress-bar {
    position: relative;
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(248, 250, 252, 0.8) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color), var(--success-color));
    opacity: 0.6;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
    position: relative;
    z-index: 2;
}

.progress-label span:first-child {
    flex: 1;
    margin-right: 0.75rem;
    word-break: break-word;
    hyphens: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-label span:first-child::before {
    content: '📊';
    font-size: 1rem;
    opacity: 0.7;
}

.progress-label span:last-child {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.progress-bar:hover .progress-label span:last-child {
    opacity: 1;
}

.progress-track {
    position: relative;
    height: 16px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(226, 232, 240, 0.8) 100%);
    border-radius: 50px;
    overflow: hidden;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    min-width: 2px; /* Минимальная ширина для видимости */
    background: linear-gradient(90deg,
        var(--primary-color),
        var(--info-color),
        var(--success-color),
        var(--primary-color)
    );
    background-size: 200% 100%;
    animation: progress-gradient 3s ease-in-out infinite;
    border-radius: 50px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 0 20px rgba(99, 102, 241, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
    z-index: 1;
}

.progress-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: progress-shine 2.5s ease-in-out infinite;
}

.progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: progress-glow-move 2s ease-in-out infinite;
    pointer-events: none;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    animation: progress-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-glow-move {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes progress-gradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes progress-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes progress-dot-pulse {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateY(-50%) scale(1.2); }
}

.progress-items {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.progress-item {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

/* Индикаторы партий */
.batch-info {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.batch-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(226, 232, 240, 0.8) 100%);
    color: var(--text-muted);
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.batch-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
}

.batch-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.batch-item:hover::before {
    width: 40px;
    height: 40px;
}

.batch-item:active {
    transform: scale(0.95);
}

.batch-item.batch-completed {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

.batch-item.batch-active {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
    animation: pulse-batch 2s infinite;
}

.batch-item.batch-pausing {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
    animation: pulse-pause 1s infinite;
}

@keyframes pulse-batch {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
    }
}

@keyframes pulse-pause {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p {
    margin-top: 1rem;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.empty-state small {
    display: block;
    margin-top: 0.5rem;
}

/* Результаты */
.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.article-section {
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.95) 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.article-header > div:first-child {
    flex: 1;
    min-width: 200px;
}

.article-header > div:last-child {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.reviews-grid {
    display: none !important; /* Скрыт по требованию */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

/* Улучшенные стили для resultsSection */
#resultsSection {
    animation: fadeInSection 0.3s ease;
    position: relative;
    z-index: 1;
}

@keyframes fadeInSection {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#resultsContent {
    min-height: 200px;
}

.review-card {
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

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

.review-card.rating-5 { 
    border-left-color: #22c55e;
    border-left-width: 4px;
}
.review-card.rating-4 { 
    border-left-color: #84cc16;
    border-left-width: 4px;
}
.review-card.rating-3 { 
    border-left-color: #f59e0b;
    border-left-width: 4px;
}
.review-card.rating-2 { 
    border-left-color: #f97316;
    border-left-width: 4px;
}
.review-card.rating-1 { 
    border-left-color: #ef4444;
    border-left-width: 4px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.review-author {
    font-weight: 600;
    color: var(--text-primary);
}

.review-rating {
    display: flex;
    gap: 0.25rem;
}

.star {
    color: #fbbf24;
}

.star.empty {
    color: var(--border-color);
}

.review-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.review-text {
    margin: 1rem 0;
    line-height: 1.6;
}

.review-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 999px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tag.pro {
    background: #dcfce7;
    color: #166534;
}

.tag.con {
    background: #fee2e2;
    color: #991b1b;
}

.seller-answer {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--info-color);
}

.seller-answer-label {
    font-weight: 600;
    color: var(--info-color);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Toast уведомления */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.toast {
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success { border-left: 4px solid var(--success-color); }
.toast.error { border-left: 4px solid var(--danger-color); }
.toast.info { border-left: 4px solid var(--info-color); }
.toast.warning { border-left: 4px solid var(--warning-color); }

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Responsive Design */

/* Extra Large Screens (1440px+) */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    header h1 {
        font-size: 3rem;
    }

    .card {
        padding: 3rem;
    }

    .images-gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1.25rem;
    }
    
    .reviews-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* Large Screens (1024px - 1439px) */
@media (min-width: 1024px) and (max-width: 1439px) {
    .container {
        max-width: 1000px;
    }

    .images-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .reviews-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* Medium Screens (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        max-width: 100%;
        padding: 0 2rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Small Screens (480px - 767px) */
@media (max-width: 767px) {
    body {
        padding: 1rem 0.5rem;
    }

    .container {
        padding: 0;
    }

    /* Header */
    header {
        margin-bottom: 2rem;
        text-align: center;
    }

    header h1 {
        font-size: 1.5rem;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        line-height: 1.2;
    }

    .icon-logo {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .subtitle {
        font-size: 1rem;
        opacity: 0.9;
        max-width: 300px;
        margin: 0 auto;
    }

    /* Cards */
    .card {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
        border-radius: var(--radius-md);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        background: var(--bg-primary);
    }

    .card h2 {
        font-size: 1.25rem;
        margin-bottom: 1.25rem;
        font-weight: 600;
    }

    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.375rem;
        display: block;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevent zoom on iOS */
        border: 2px solid var(--border-color);
        border-radius: var(--radius-md);
        width: 100%;
        transition: border-color 0.2s ease;
    }

    .form-group input:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

    textarea {
        resize: vertical;
        min-height: 80px;
        font-family: inherit;
    }

    /* Buttons - Touch Optimized */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        min-height: 48px; /* Touch target size */
        font-weight: 500;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        border: none;
        border-radius: var(--radius-md);
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
        font-family: inherit;
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    }

    .btn:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }

    .btn-sm {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    /* Primary buttons */
    .btn-primary {
        background: var(--primary-color);
        color: white;
        box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
    }

    .btn-primary:active {
        transform: translateY(1px);
        box-shadow: 0 1px 2px rgba(99, 102, 241, 0.3);
    }

    /* Task List - Mobile Optimized */
    .task-item {
        padding: 1.25rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-md);
        background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(248, 250, 252, 0.8) 100%);
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.1),
            0 1px 2px rgba(0, 0, 0, 0.06),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        position: relative;
        overflow: hidden;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }

    .task-item::before {
        height: 3px;
        background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .task-info {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .task-id {
        font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--primary-color);
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(59, 130, 246, 0.1));
        padding: 0.375rem 0.75rem;
        border-radius: var(--radius-sm);
        border: 1px solid rgba(99, 102, 241, 0.2);
        align-self: flex-start;
        word-break: break-all;
        margin-bottom: 0.5rem;
        letter-spacing: 0.025em;
        transition: all 0.2s ease;
    }

    .task-id:hover {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.15));
        transform: translateY(-1px);
    }

    .task-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
        font-size: 0.8rem;
        line-height: 1.5;
    }

    .task-meta span {
        width: fit-content;
        padding: 0.375rem 0.625rem;
        background: rgba(0, 0, 0, 0.03);
        border-radius: var(--radius-sm);
        transition: all 0.2s ease;
    }

    .task-meta span:hover {
        background: rgba(99, 102, 241, 0.05);
        color: var(--text-primary);
    }

    .task-meta .icon {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }

    .task-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-top: 1rem;
    }

    .task-actions .btn {
        min-height: 44px;
        font-size: 0.9rem;
        padding: 0.625rem 0.875rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.375rem;
        font-weight: 500;
        border-radius: var(--radius-md);
        transition: all 0.2s ease;
        position: relative;
        overflow: hidden;
    }

    .task-actions .btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: all 0.4s ease;
    }

    .task-actions .btn:active::before {
        width: 120px;
        height: 120px;
    }

    .task-actions .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .task-actions .btn:active {
        transform: translateY(0);
    }

    .task-actions .btn .icon {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
        position: relative;
        z-index: 1;
        transition: transform 0.2s ease;
    }

    .task-actions .btn:hover .icon {
        transform: scale(1.1);
    }

    /* Progress bars - Mobile Optimized */
    .progress-bar {
        padding: 1rem;
        margin-top: 1rem;
        border-radius: var(--radius-md);
    }

    .progress-bar::before {
        height: 2px;
    }

    .progress-label {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 1.25rem;
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .progress-label span:first-child {
        flex: 1;
        font-size: 0.8rem;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        gap: 0.375rem;
    }

    .progress-label span:first-child::before {
        font-size: 0.9rem;
    }

    .progress-track {
        height: 14px;
        border-radius: 25px;
    }

    .progress-fill {
        position: absolute;
        top: 0;
        left: 0;
        min-width: 2px;
        border-radius: 25px;
        z-index: 1;
    }

    .progress-fill::after {
        right: 6px;
        width: 5px;
        height: 5px;
    }

    /* Gallery - Mobile Optimized */
    .images-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .image-item {
        border-radius: 10px;
    }

    .image-item:hover {
        transform: none;
    }

    .image-item:active {
        transform: scale(0.97);
    }

    .image-number {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        top: 0.4rem;
        right: 0.4rem;
    }

    .images-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .images-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        width: 100%;
    }
    
    .images-header-top .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Адаптивность для resultsSection на мобильных */
    .article-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .article-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 1rem;
    }
    
    .article-header > div:last-child {
        width: 100%;
        justify-content: flex-start;
    }
    
    .article-header > div:last-child .btn {
        flex: 1;
        min-width: 100px;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
    
    .reviews-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .review-card {
        padding: 1.25rem;
    }
    
    .analysis-trigger {
        padding: 1.5rem;
        margin-top: 2rem;
    }
    
    .analysis-trigger h3 {
        font-size: 1.25rem;
    }
    
    .analysis-trigger p {
        font-size: 0.9rem;
    }

    .images-header h3 {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
        margin: 0;
    }

    .images-header small {
        color: var(--text-muted);
        font-size: 0.8rem;
    }

    /* Modals */
    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }

    .modal-content img {
        max-height: 80vh;
    }

    .modal-close {
        top: -50px;
        width: 40px;
        height: 40px;
    }

    /* Toast notifications - Mobile Optimized */
    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        top: 1rem;
        max-width: none;
        pointer-events: none;
    }

    .toast {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        pointer-events: auto;
        backdrop-filter: blur(10px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        animation: slideInMobile 0.4s ease;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    @keyframes slideInMobile {
        from {
            transform: translateY(-100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .toast-close {
        -webkit-tap-highlight-color: transparent;
        width: 24px;
        height: 24px;
        border-radius: var(--radius-sm);
    }

    .toast-close:active {
        transform: scale(0.9);
    }

    /* Analysis */
}

/* Extra Small Screens (320px - 479px) */
@media (max-width: 479px) {
    body {
        padding: 0.5rem 0.25rem;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }

    * {
        box-sizing: border-box;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .card {
        padding: 0.875rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-sm);
        word-wrap: break-word;
    }

    .card h2 {
        font-size: 1.1rem;
        margin-bottom: 0.875rem;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .images-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .image-item {
        border-radius: 8px;
    }
    
    .product-images {
        padding: 1.25rem;
    }
    
    .images-header h3 {
        font-size: 1.1rem;
    }
    
    /* Адаптивность для resultsSection */
    .article-section {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    .article-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }
    
    .article-header > div:last-child {
        width: 100%;
        justify-content: flex-start;
    }
    
    .article-header > div:last-child .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .reviews-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .review-card {
        padding: 1.25rem;
    }
    
    .analysis-trigger {
        padding: 1.5rem;
        margin-top: 2rem;
    }
    
    .analysis-trigger h3 {
        font-size: 1.25rem;
    }
    
    .analysis-trigger p {
        font-size: 0.9rem;
    }

    .toast {
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
        word-wrap: break-word;
    }

    .progress-step {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .step-icon {
        width: 32px;
        height: 32px;
    }

    /* Batch info - Extra Small */
    .batch-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.375rem;
        margin-top: 0.75rem;
    }

    .batch-item {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    /* Fix for long text in task items */
    .task-id {
        word-break: break-all;
        font-size: 0.75rem;
    }

    /* Improve form inputs on small screens */
    input[type="text"],
    input[type="number"],
    textarea {
        width: 100%;
        font-size: 16px; /* Prevent zoom on iOS */
        border: 2px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 0.625rem 0.875rem;
        transition: border-color 0.2s ease;
    }

    input[type="text"]:focus,
    input[type="number"]:focus,
    textarea:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

    /* Better spacing for form elements */
    .form-group small {
        line-height: 1.4;
        word-wrap: break-word;
        display: block;
        margin-top: 0.5rem;
        font-size: 0.8rem;
        color: var(--text-muted);
    }

    /* Improve readability of extracted article info */
    .extracted-article {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
        word-wrap: break-word;
    }

    /* Progress bars - Extra Small Screens */
    .progress-bar {
        padding: 0.875rem;
        margin-top: 0.75rem;
        border-radius: var(--radius-sm);
    }

    .progress-bar::before {
        height: 2px;
    }

    .progress-label {
        font-size: 0.75rem;
        margin-bottom: 1rem;
        gap: 0.375rem;
    }

    .progress-label span:first-child {
        font-size: 0.75rem;
        line-height: 1.3;
        gap: 0.25rem;
    }

    .progress-label span:first-child::before {
        font-size: 0.8rem;
    }

    .progress-track {
        height: 12px;
        border-radius: 20px;
    }

    .progress-fill {
        position: absolute;
        top: 0;
        left: 0;
        min-width: 2px;
        border-radius: 20px;
        z-index: 1;
    }

    .progress-fill::after {
        right: 5px;
        width: 4px;
        height: 4px;
    }

    /* Better modal handling on small screens */
    .image-modal .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        padding: 1rem;
    }

    .image-modal .modal-content img {
        max-width: 100%;
        max-height: 85vh;
    }
    
    .modal-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    .modal-nav {
        width: 48px;
        height: 48px;
    }
    
    .modal-nav.prev {
        left: 0.5rem;
    }
    
    .modal-nav.next {
        right: 0.5rem;
    }
    
    .modal-nav .icon {
        width: 24px;
        height: 24px;
    }
    
    .modal-caption {
        font-size: 1rem;
        margin-top: 1rem;
    }
}

/* Анимации загрузки */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Галерея изображений товара */
.product-images {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    animation: fadeInGallery 0.5s ease;
    position: relative;
    z-index: 1;
}

@keyframes fadeInGallery {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.images-header {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.images-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.images-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.images-header small {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.gallery-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

/* Галерея изображений - основные стили */
.images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
    animation: galleryFadeIn 0.5s ease;
    width: 100%;
}

@keyframes galleryFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Анимация появления элементов галереи */
.images-gallery .image-item {
    animation: imageItemFadeIn 0.4s ease backwards;
}

.images-gallery .image-item:nth-child(1) { animation-delay: 0.05s; }
.images-gallery .image-item:nth-child(2) { animation-delay: 0.1s; }
.images-gallery .image-item:nth-child(3) { animation-delay: 0.15s; }
.images-gallery .image-item:nth-child(4) { animation-delay: 0.2s; }
.images-gallery .image-item:nth-child(5) { animation-delay: 0.25s; }
.images-gallery .image-item:nth-child(6) { animation-delay: 0.3s; }
.images-gallery .image-item:nth-child(7) { animation-delay: 0.35s; }
.images-gallery .image-item:nth-child(8) { animation-delay: 0.4s; }
.images-gallery .image-item:nth-child(9) { animation-delay: 0.45s; }
.images-gallery .image-item:nth-child(10) { animation-delay: 0.5s; }
.images-gallery .image-item:nth-child(n+11) { animation-delay: 0.55s; }

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

/* Элемент изображения */
.image-item {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Эффекты для элементов изображений */
.image-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.image-item.loaded {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.image-item.error {
    border-color: var(--danger-color);
    border-style: dashed;
    background: linear-gradient(135deg, #f1f5f9 0%, #fee2e2 100%);
}

.image-item.error:hover {
    transform: none;
    border-color: var(--danger-color);
}

.image-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.25), 0 8px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
    z-index: 10;
}

.image-item:hover::before {
    opacity: 1;
}

.image-item:active {
    transform: translateY(-2px) scale(1);
}

/* Изображение внутри элемента */
.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.image-item:hover img {
    transform: scale(1.08);
}

/* Плейсхолдер при ошибке загрузки */
.image-item .image-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

/* Номер изображения */
.image-number {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    z-index: 2;
    min-width: 24px;
    text-align: center;
    pointer-events: none;
    transition: all 0.3s ease;
}

.image-item:hover .image-number {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* Исключенные изображения */
.image-item.image-excluded {
    opacity: 0.5;
    filter: grayscale(70%);
    border-color: var(--danger-color);
    border-style: dashed;
}

.image-item.image-excluded:hover {
    opacity: 0.7;
    filter: grayscale(50%);
}

/* Элемент управления исключением */
.image-exclude-control {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 20;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    border: 2px solid var(--border-color);
}

.image-exclude-control:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.image-exclude-control input[type="checkbox"] {
    display: none;
}

.image-exclude-control label {
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.image-item.image-excluded .image-exclude-control {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
}

.image-item.image-excluded .image-exclude-control:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Модальное окно для изображений */
.image-modal {
    display: none;
    position: fixed;
    z-index: 99999 !important;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 100000 !important;
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    animation: imageZoomIn 0.4s ease;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
}

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

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100001 !important;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg) scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.modal-close .icon {
    color: white;
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

.modal-caption {
    margin-top: 1.5rem;
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Кнопки навигации в модальном окне */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100001 !important;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.modal-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.modal-nav.prev {
    left: 1.5rem;
}

.modal-nav.next {
    right: 1.5rem;
}

.modal-nav .icon {
    color: white;
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

.modal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal-nav:disabled:hover {
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
}

/* Бейдж бренда */
.brand-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.product-name {
    font-size: 0.975rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.analysis-trigger {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.95) 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.analysis-trigger h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.analysis-trigger p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1rem;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Скрытие блока вопросов */
.questions-section {
    display: none !important;
}

/* Стили для анализа */
.analysis-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.analysis-result {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.analysis-header {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.analysis-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.analysis-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-loading {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.analysis-content {
    padding: 1.5rem;
    background: var(--bg-primary);
}

.analysis-text {
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* Форматированный текст анализа */
.formatted-analysis {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.formatted-analysis .analysis-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.formatted-analysis .analysis-section:last-child {
    margin-bottom: 0;
}

.formatted-analysis .section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

.formatted-analysis .section-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.formatted-analysis .section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.formatted-analysis .section-content {
    color: var(--text-primary);
}

.formatted-analysis .analysis-list {
    margin: 0.75rem 0;
    padding: 0;
    list-style: none;
}

.formatted-analysis .analysis-list-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.formatted-analysis .analysis-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.formatted-analysis .list-bullet {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    margin-top: 0.5rem;
    background: var(--primary-color);
    border-radius: 50%;
}

.formatted-analysis .list-text {
    flex: 1;
    line-height: 1.6;
}

.formatted-analysis .highlight-box {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.formatted-analysis .highlight-box.positive {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.02) 100%);
    border-color: #22c55e;
}

.formatted-analysis .highlight-box.negative {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.02) 100%);
    border-color: #ef4444;
}

.formatted-analysis .highlight-box.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
    border-color: #f59e0b;
}

.formatted-analysis .highlight-box.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.02) 100%);
    border-color: #3b82f6;
}

.formatted-analysis .highlight-box-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.formatted-analysis .highlight-box.positive .highlight-box-title {
    color: #22c55e;
}

.formatted-analysis .highlight-box.negative .highlight-box-title {
    color: #ef4444;
}

.formatted-analysis .highlight-box.warning .highlight-box-title {
    color: #f59e0b;
}

.formatted-analysis .highlight-box.info .highlight-box-title {
    color: #3b82f6;
}

.formatted-analysis .key-value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.formatted-analysis .key-value-item {
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.formatted-analysis .key-value-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.formatted-analysis .key-value-text {
    font-weight: 600;
    color: var(--text-primary);
}

.formatted-analysis .paragraph {
    margin: 0.75rem 0;
    line-height: 1.7;
}

.formatted-analysis .paragraph:first-child {
    margin-top: 0;
}

.formatted-analysis .paragraph:last-child {
    margin-bottom: 0;
}

.formatted-analysis strong,
.formatted-analysis b {
    color: var(--text-primary);
    font-weight: 600;
}

.formatted-analysis .emphasis {
    color: var(--primary-color);
    font-weight: 600;
}

.formatted-analysis .numbered-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    margin: 0.75rem 0;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.formatted-analysis .numbered-badge {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.25);
}

.formatted-analysis .numbered-content {
    flex: 1;
}

.formatted-analysis .rating-stars {
    display: inline-flex;
    gap: 0.125rem;
    color: #f59e0b;
}

.formatted-analysis .tag {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.125rem;
}

/* Конкурентный анализ */


.info-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.info-item .icon {
    flex-shrink: 0;
    color: var(--primary-color);
    margin-top: 0.125rem;
}

.info-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.info-item p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}



.analysis-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.analysis-status .icon {
    color: var(--primary-color);
    width: 16px;
    height: 16px;
}

.analysis-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--bg-primary);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

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

/* Стили для прогресса анализа */
.analysis-progress {
    display: none;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.progress-header {
    margin-bottom: 2rem;
    text-align: center;
}

.progress-header h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.progress-step.completed {
    background: rgba(34, 197, 94, 0.05);
    border-color: var(--success-color);
}

.progress-step.active {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.step-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.progress-step.completed .step-icon {
    background: var(--success-color);
    color: white;
}

.progress-step.active .step-icon {
    background: var(--primary-color);
    color: white;
    animation: pulse 2s infinite;
}

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

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.step-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.progress-step.completed .step-status {
    color: var(--success-color);
}

.progress-step.active .step-status {
    color: var(--primary-color);
}

/* Стили для модального окна авторизации */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.auth-modal.hidden {
    display: none;
}

.auth-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .icon-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--primary-color);
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.auth-modal-content .form-group {
    margin-bottom: 1.5rem;
}

.auth-modal-content .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.auth-modal-content .form-group input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.auth-modal-content .form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-modal-content .btn {
    width: 100%;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.auth-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: var(--radius-md);
    color: var(--danger-color);
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    animation: shake 0.4s ease;
}

.auth-error .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@media (max-width: 640px) {
    .auth-modal-content {
        padding: 2rem 1.5rem;
    }
    
    .auth-header h2 {
        font-size: 1.5rem;
    }
}
