/* Base stylesheet: source of truth for versioned CSS. */

/* ==== Copied from current version + tweaks ==== */
/* Распознанные данные: ширина и отступы */
#recognized-data-section {
    width: calc(100vw - 40px); /* по 20px слева и справа от окна */
    margin: 20px;              /* внешний отступ секции */
    border-radius: 12px;
    overflow-x: auto;
    background: transparent;
    box-shadow: none;
    border: none;
}

#recognized-data-section h2 {
    margin: 20px 0 12px 20px;
    padding: 0;          /* без внутренних отступов */
}

#recognized-data-section .recognized-content {
    padding: 0; /* таблица сама занимает всю ширину секции */
}

#recognized-data-section .table-container {
    width: 100%;
    overflow-x: auto;
}

#recognized-data-section table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#recognized-data-section thead th {
    position: sticky;
    top: 0;
    background: #ff6b6b; /* как в шапке таблицы */
    color: #fff;
}

/* Подпись кода/артикула под наименованием */
.item-article {
    display: block;
    margin-top: 4px;
    color: #718096;
    font-size: 0.85rem;
}

/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: #f7fafc;
}

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

/* Header */
.main-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header-left { display: flex; align-items: center; }
.header-logo { height: 32px; width: auto; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-nav { display: flex; align-items: center; gap: 2rem; }
.nav-link { color: #4a5568; text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: color 0.2s ease; }
.nav-link:hover { color: #2d3748; }
.header-right { display: flex; align-items: center; gap: 20px; }

/* Contact icons */
.contact-icons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    text-decoration: none;
    font-size: 28px;
}

.contact-icon[title="Telegram"] {
    color: #0088cc;
}

.contact-icon[title="WhatsApp"] {
    color: #25D366;
}

.logout-btn { background: #f7fafc; border: 1px solid #e2e8f0; color: #4a5568; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.9rem; cursor: pointer; transition: all 0.2s ease; }
.logout-btn:hover { background: #edf2f7; border-color: #cbd5e0; }

/* Main content */
.main-content { margin-top: 60px; min-height: calc(100vh - 60px); background: #f7fafc; padding: 2rem 0; }
.page-header { text-align: left; margin-bottom: 2rem; padding: 0; }
.page-header h1 { color: #FF6B6B; font-size: 1.5rem; font-weight: 600; margin-bottom: 0; }

/* Шаги */
.step-section { background: #f7f8fa; border-radius: 12px; margin-bottom: 2rem; padding: 0; border: 1px solid #e2e8f0; transition: all 0.3s ease; }
.step-section.active { border: 1px solid #e2e8f0; }
.step-section.collapsed .step-content { display: none; }
.step-section.collapsed .step-toggle-icon { transform: rotate(-90deg); }

.step-header { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 2rem; background: transparent; border-bottom: none; cursor: pointer; user-select: none; transition: background-color 0.2s ease; }
.step-header:hover { background: rgba(0, 0, 0, 0.03); }
.step-header { gap: 12px; }

.step-number { width: 32px; height: 32px; border-radius: 50%; background: #FF6B6B; color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1rem; }
.step-number.completed { background: #10b981; }
.step-number.inactive { background: #9ca3af; }

.step-title { flex: 1; margin: 0; color: #2d3748; font-size: 1.3rem; font-weight: 600; line-height: 1.2; }

.step-toggle-icon { color: #FF6B6B; font-size: 1.2rem; transition: transform 0.3s ease; margin-left: 1rem; }

.step-content { padding: 0 2rem 2rem 2rem; display: block; }

.step-description { margin-bottom: 1.5rem; }
.step-description p { color: #6b7280; font-size: 0.95rem; line-height: 1.5; margin: 0; }

/* Загрузка */
.upload-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }

/* Для Шага 2 - одна колонка на всю ширину */
#step-2 .upload-methods { grid-template-columns: 1fr; }
.upload-method { background: white; border-radius: 8px; padding: 1.5rem; border: 1px solid #e2e8f0; display: flex; flex-direction: column; min-height: 320px; }
.upload-method h3 { color: #4a5568; font-size: 1rem; font-weight: 600; margin-bottom: 1rem; text-align: center; }

/* Зона загрузки файлов */
.upload-zone { 
  background: #fafafa; 
  border: 2px dashed #cbd5e0; 
  border-radius: 8px; 
  padding: 2rem 1rem; 
  text-align: center; 
  cursor: pointer; 
  transition: all 0.3s ease; 
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 200px !important;
  min-height: 200px;
  max-height: 200px;
}
.upload-zone:hover { background: #f0f0f0; border-color: #a0aec0; }
.upload-zone.dragover { background: #ebf8ff; border-color: #3182ce; }
.upload-zone h4 { color: #4a5568; font-size: 1rem; font-weight: 500; margin-bottom: 0.5rem; }
.upload-zone p { color: #718096; font-size: 0.9rem; margin-bottom: 1rem; }
.upload-info { text-align: center; font-size: 0.85rem; color: #718096; margin-top: 0.5rem; }

/* Исходная спецификация */
/* Ручной ввод - гармонизация с загрузкой файлов */
.manual-input-wrapper { 
  margin-bottom: 0.25rem; 
  flex: 1;
  display: flex;
  flex-direction: column;
}
.manual-input-wrapper textarea {
  width: 100%;
  height: 200px !important;
  min-height: 200px;
  max-height: 200px;
  padding: 2rem 1rem;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  font-size: 0.95rem;
  resize: none;
  font-family: inherit;
  transition: all 0.2s ease;
  background: #fafafa;
  color: #2d3748;
}
.manual-input-wrapper textarea:hover { background: #f0f0f0; border-color: #a0aec0; }
.manual-input-wrapper textarea:focus { outline: none; border-color: #a0aec0; background: #fff; box-shadow: none; }
.input-info { 
  text-align: center; 
  margin-top: 0.5rem; 
  margin-bottom: 0.75rem; 
  font-size: 0.85rem;
  color: #718096;
}
.input-info span { color: #718096; font-size: 0.85rem; }
#add-manual { display: block; margin: 0.75rem auto 0 auto; }



/* Статус обработки - легкий дизайн */
.processing-status { 
  background: #fff; 
  padding: 2rem; 
  margin: 1.5rem 0; 
  text-align: center; 
  border: 1px solid #e2e8f0; 
  border-radius: 12px; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.status-text { 
  font-size: 1rem; 
  font-weight: 500; 
  color: #4a5568; 
  margin-bottom: 1.5rem; 
  line-height: 1.4;
}
.progress-container { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 0.75rem; 
}
.progress-bar { 
  width: 100%; 
  max-width: 600px; 
  height: 12px; 
  background: #f1f5f9; 
  border-radius: 6px; 
  overflow: hidden; 
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.progress-fill { 
  height: 100%; 
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%); 
  border-radius: 6px; 
  transition: width 0.4s ease; 
  width: 0%; 
}
.progress-text { 
  font-weight: 600; 
  color: #10b981; 
  font-size: 0.9rem;
}

/* Множественные прогресс-бары для поставщиков */
.multiple-progress-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.supplier-progress-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.supplier-progress-text {
  font-size: 0.9rem;
  color: #4a5568;
  margin-bottom: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
}

.supplier-progress-bar {
  width: 100%;
  height: 10px;
  background: #f1f5f9;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.supplier-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  border-radius: 5px;
  transition: width 0.4s ease;
  width: 0%;
}

.supplier-progress-fill.error {
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
}

.supplier-progress-fill.completed {
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
}


/* Распознанные данные */
.recognized-content { padding: 2rem; }
.recognized-data-container { overflow-x: auto; width: 100%; }
.recognized-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.9rem; min-width: 800px; }
.recognized-table th, .recognized-table td { vertical-align: top; padding: 0.75rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
.recognized-table th { background-color: #FF6B6B; color: white; font-weight: 600; position: sticky; top: 0; }
.recognized-table tr:nth-child(even) { background-color: #f8f9fa; }
.recognized-table tr:hover { background-color: #f8f9fa; }

/* Подписи под наименованием */
.item-article { font-size: 0.8rem; color: #718096; font-weight: 400; display: block; margin-top: 0.25rem; }
.item-article-value { font-weight: 600; }
.item-notes { display: block; margin-top: 2px; color: #8B0000; font-style: italic; }
/* Примечание в одну строку с артикулом */
.item-article .item-notes { display: inline; margin: 0 0 0 6px; }
/* Метка "аналог" - бордовый цвет */
.analog-label { color: #8B0000; font-style: italic; font-weight: 500; }

/* Подсветка лучших цен - светло-зеленый */
.best-price { background-color: #C6F6D5 !important; font-weight: 600; }

/* Кнопки */
.btn { display: inline-block; padding: 0.7rem 1.5rem; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 500; text-decoration: none; cursor: pointer; transition: all 0.2s ease; text-align: center; }
.btn-primary { background: #FF6B6B; color: white; }
.btn-primary:hover { background: #e53e3e; }
.btn-secondary { background: #e2e8f0; color: #4a5568; border: 1px solid #cbd5e0; }
.btn-secondary:hover { background: #d1d5db; }

/* Компактная информация о поставщиках */
.suppliers-info-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.5s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.supplier-info-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.supplier-info-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.supplier-info-card h4 {
  color: #FF6B6B;
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.supplier-info-details p {
  margin: 0.15rem 0;
  line-height: 1.3;
}

.supplier-info-details strong {
  color: #4a5568;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Сворачиваемые детали для длинных текстов */
.supplier-detail {
  margin: 0.5rem 0;
  padding: 0;
}

.supplier-detail summary {
  cursor: pointer;
  list-style: none;
  padding: 0.5rem;
  border-radius: 4px;
  background: #f7fafc;
  transition: background 0.2s ease;
  user-select: none;
}

.supplier-detail summary::-webkit-details-marker {
  display: none;
}

.supplier-detail summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s ease;
  color: #718096;
  font-size: 0.7rem;
}

.supplier-detail[open] summary::before {
  transform: rotate(90deg);
}

.supplier-detail summary:hover {
  background: #edf2f7;
}

.supplier-detail summary strong {
  display: inline;
}

.supplier-detail-content {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #ffffff;
  border-left: 3px solid #FF6B6B;
  border-radius: 4px;
  color: #2d3748;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: slideDown 0.2s ease;
}

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

/* Контейнер результатов анализа - на полную ширину */
.analysis-result {
  width: 100%;
  max-width: 100vw;
  padding: 0 1rem;
  box-sizing: border-box;
}

/* Сводная таблица сравнения */
.comparison-table-container {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  animation: fadeInUp 0.6s ease-out;
  width: 100%;
  max-width: 100%;
}

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

.comparison-table {
  width: 100%;
  max-width: none;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: white;
  min-width: 1400px;
  table-layout: auto;
}

/* Оптимизированная ширина колонок */
.comparison-table th:nth-child(1),
.comparison-table td:nth-child(1) { 
  min-width: 50px; 
  width: 50px;
} /* № */

.comparison-table th:nth-child(2),
.comparison-table td:nth-child(2) { 
  min-width: 350px; 
  width: auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.3;
} /* Наименование спецификации */

.comparison-table th:nth-child(3),
.comparison-table td:nth-child(3) { 
  min-width: 50px; 
  width: 50px;
  white-space: nowrap;
} /* Кол-во спецификации */

/* Колонки поставщиков - по классам */
.comparison-table .supplier-name-col { 
  min-width: 350px; 
  width: auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.3;
} /* Наименование поставщика */

.comparison-table .supplier-qty-col { 
  min-width: 50px; 
  width: 50px;
  white-space: nowrap;
} /* Кол-во поставщика */

.comparison-table .supplier-vat-col { 
  min-width: 70px; 
  width: 70px;
  white-space: nowrap;
} /* НДС */

.comparison-table .supplier-sum-col { 
  min-width: 100px; 
  width: 100px;
  white-space: nowrap;
  text-align: right;
} /* Сумма */

.comparison-table th {
  background: #f8f9fa;
  color: #4a5568;
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Стили для ошибок обработки данных */
.supplier-error {
  background-color: #fee2e2 !important;
  color: #dc2626 !important;
  font-weight: 600;
}

.supplier-error .item-article {
  color: #dc2626 !important;
}

.supplier-info-error {
  background-color: #fee2e2 !important;
  border-left: 4px solid #dc2626 !important;
}

.supplier-info-error h4 {
  color: #dc2626 !important;
}

.supplier-info-error p {
  color: #7f1d1d !important;
}

/* Убираем разделители - оставляем только стандартные границы таблицы */

.comparison-table .spec-header {
  background: #e2e8f0;
  color: #2d3748;
}

.comparison-table .supplier-header {
  background: #FF6B6B;
  color: white;
}

.comparison-table td {
  padding: 0.75rem 0.5rem;
  text-align: center;
  border: 1px solid #e2e8f0;
  vertical-align: top;
}

.comparison-table tr:nth-child(even) {
  background: #f8f9fa;
}

.comparison-table tr:hover {
  background: #f1f5f9;
}

/* Стили для ячеек */
.comparison-table .spec-name,
.comparison-table .supplier-name {
  text-align: left;
  max-width: 250px;
  word-wrap: break-word;
}

.comparison-table .price {
  font-weight: 600;
  color: #2d3748;
  text-align: right;
}

.comparison-table .quantity-warning {
  color: #dc2626;
  font-weight: 500;
}

.comparison-table .warning-icon {
  color: #f59e0b;
  margin-left: 0.25rem;
  font-size: 1.1rem;
  font-weight: bold;
}

.comparison-table .not-available {
  color: #9ca3af;
  font-style: italic;
}

.comparison-table .total-row {
  background: #edf2f7 !important;
  border-top: 2px solid #cbd5e0;
}

.comparison-table .total-row td {
  font-size: 1rem;
  padding: 1rem 0.5rem;
  font-weight: 600;
  text-align: center;
}

/* Стили для ячеек итого */
.comparison-table .total-label {
  text-align: right !important;
  padding-right: 1rem;
}

.comparison-table .total-skip {
  background: #edf2f7 !important;
}

.comparison-table .total-vat {
  background: #edf2f7 !important;
  color: #4a5568;
  text-align: right;
  font-weight: 600;
}

.comparison-table .total-amount {
  background: #edf2f7 !important;
  color: #4a5568;
  text-align: right;
  font-weight: 600;
}

/* Адаптив */
@media (max-width: 768px) {
  .container { padding: 0 1rem; }
  .upload-methods { grid-template-columns: 1fr; gap: 1.5rem; }
  
  .comparison-table {
    font-size: 0.8rem;
  }
  
  .comparison-table th,
  .comparison-table td {
    padding: 0.5rem 0.25rem;
  }
}

/* === AUTH FORMS === */
.auth-container {
  max-width: 500px;
  margin: 2rem auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  overflow: hidden;
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
}

.auth-tab {
  flex: 1;
  padding: 1rem;
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  color: #FF6B6B;
  border-bottom: 3px solid #FF6B6B;
  margin-bottom: -2px;
}

.auth-form {
  display: none;
  padding: 2rem;
}

.auth-form.active {
  display: block;
}

.auth-form h3 {
  margin: 0 0 1.5rem 0;
  color: #2d3748;
  font-size: 1.3rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #4a5568;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #FF6B6B;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  margin-top: 0.25rem;
  cursor: pointer;
}

.checkbox-group label {
  margin: 0;
  font-weight: normal;
  font-size: 0.85rem;
}

.checkbox-group a {
  color: #FF6B6B;
  text-decoration: underline;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form-actions button {
  width: 100%;
}

.forgot-password,
.back-to-login {
  text-align: center;
  color: #4a5568;
  font-size: 0.9rem;
  text-decoration: none;
}

.forgot-password:hover,
.back-to-login:hover {
  color: #FF6B6B;
  text-decoration: underline;
}

.form-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
}

.form-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.form-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #718096;
}
