/* assets/app.css - полная обновленная версия */

/* card */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(2,6,23,0.04);
  margin-bottom: 24px;
}

/* buttons */
.btn-primary {
  background: #0ea5a4;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: .5rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-primary:hover { background:#0b9a92; }

.btn-indigo {
  background: #6366f1;
  color: #fff;
  padding: 0.45rem .8rem;
  border-radius: .5rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-indigo:hover { background: #5a5fd1; }

/* swatch */
.swatch {
  border-radius: 8px;
  min-width: 96px;
  min-height: 96px;
  position: relative;
  overflow: hidden;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  text-align:center;
  transition: transform 0.2s ease;
}
.swatch:hover {
  transform: translateY(-4px);
}
.swatch .meta {
  width:100%;
  box-sizing:border-box;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
}

/* preview area */
#livePreview {
  border-radius: 8px;
  transition: all 0.3s ease;
}

/* saved list hover */
.saved-row { transition: box-shadow .15s ease; }
.saved-row:hover { box-shadow: 0 8px 20px rgba(2,6,23,0.06); }

/* small scrollbars */
pre { 
  max-height:220px; 
  overflow:auto; 
  font-family: monospace;
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* modal */
#downloadModal { 
  display: none; 
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#downloadModal.show { display:flex; }

/* Control groups */
.control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: flex-start;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: flex-start;
}

/* Выравниваем кнопки по центру по вертикали */
.control-item:has(button) {
  justify-content: center;
}

.control-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
}

/* Увеличиваем базовый цвет */
.control-item:first-child input[type="color"] {
  width: 60px !important;
  height: 60px !important;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  padding: 0;
}

/* Улучшаем внешний вид color input */
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
  padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 6px;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 6px;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

.color-swatch:hover {
  transform: scale(1.1);
  border-color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.extracted-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  justify-content: center;
}

.drag-area {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 12px;
}

.drag-area.active {
  border-color: #6366f1;
  background-color: #f0f9ff;
}

.drag-area p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.palette-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  justify-content: center;
}

.contrast-text {
  mix-blend-mode: difference;
}

/* Стили для подсказки количества цветов */
#countHint {
  transition: all 0.3s ease;
  min-height: 16px;
  font-size: 11px;
}

input[readonly] {
  background-color: #f8fafc;
  cursor: not-allowed;
  opacity: 0.8;
}

/* Стили для текстового контента */
.prose {
  max-width: none;
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: #1e293b;
}

.prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  color: #334155;
}

.prose p {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: #475569;
}

.prose ul, .prose ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.prose ul {
  list-style-type: disc;
}

.prose ol {
  list-style-type: decimal;
}

.prose li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.prose strong {
  font-weight: 600;
  color: #1e293b;
}

/* Сохраненные палитры - 5 В РЯД */
.saved-palettes-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.palette-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  width: 100%;
  min-width: 0;
}

.palette-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.palette-colors {
  display: flex;
  height: 100px;
  flex-direction: row;
}

.palette-color {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font-size: 10px;
  font-weight: 600;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  min-width: 28px;
}

.palette-info {
  padding: 12px;
}

.palette-date {
  font-size: 12px;
  color: #64748b;
}

.palette-actions {
  display: flex;
  padding: 12px;
  border-top: 1px solid #f1f5f9;
  justify-content: space-between;
}

.palette-action {
  font-size: 12px;
  color: #6366f1;
  text-decoration: none;
}

.palette-action:hover {
  text-decoration: underline;
}

/* Информация о файле */
.file-info {
  margin-top: 8px;
  padding: 8px 12px;
  background-color: #f1f5f9;
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-info svg {
  width: 16px;
  height: 16px;
  color: #64748b;
}

.file-name {
  font-weight: 500;
  color: #334155;
}

.file-remove {
  margin-left: auto;
  cursor: pointer;
  color: #ef4444;
  font-size: 18px;
}

.file-info.hidden {
  display: none;
}

/* Пагинация */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  gap: 8px;
}

.pagination-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid #e2e8f0;
}

.pagination-item.active {
  background-color: #6366f1;
  color: white;
  border-color: #6366f1;
}

.pagination-item:not(.active):hover {
  background-color: #f1f5f9;
}

/* Main content layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  margin-bottom: 24px;
}

.saved-palettes-fullwidth {
  grid-column: 1 / -1;
}

/* Адаптивность */
@media (max-width: 1200px) {
  .saved-palettes-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .saved-palettes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .main-content {
    grid-template-columns: 1fr 280px;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .control-group {
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  
  .control-item {
    width: 100%;
  }
  
  /* Базовый цвет на мобильных */
  .control-item:first-child {
    order: -1;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  
  .control-item:first-child .control-label {
    min-width: 80px;
  }
  
  .control-item:first-child input[type="color"] {
    width: 50px !important;
    height: 50px !important;
    flex: none;
  }
  
  /* Кнопки */
  .control-item:has(button) {
    width: 100%;
  }
  
  .btn-primary, .btn-indigo {
    width: 100%;
    text-align: center;
  }
  
  /* Карточки на мобильных */
  .saved-palettes-grid {
    grid-template-columns: repeat(2, 1fr);
    justify-items: center;
  }
  
  .palette-card {
    max-width: 100%;
  }
  
  /* Main content layout для мобильных */
  .main-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Выравниваем по центру */
  .palette-container {
    justify-content: center !important;
  }
  
  .extracted-colors {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .saved-palettes-grid {
    grid-template-columns: 1fr;
  }
  
  .control-item:first-child {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  
  .control-item:first-child .control-label {
    min-width: auto;
    text-align: left;
  }
  
  .palette-color {
    font-size: 9px;
    padding: 4px;
  }
  
  .prose h2 {
    font-size: 1.25rem;
  }
  
  .prose h3 {
    font-size: 1.1rem;
  }
  
  .card {
    padding: 16px;
  }
  
  .control-item:first-child input[type="color"] {
    width: 60px !important;
    height: 60px !important;
  }
}

/* Гарантируем выравнивание по вертикали */
.control-item > * {
  align-self: flex-start;
}

/* Выравниваем кнопки */
.btn-primary, .btn-indigo {
  align-self: center;
  height: fit-content;
  white-space: nowrap;
}

/* Убираем стрелки у number input */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}
.seo-header {
  position: absolute;
  left: -9999px;
  height: 1px;
  overflow: hidden;
}
/* Стили для ссылок палитр */
.palette-card-link {
  text-decoration: none;
  color: inherit;
}

.palette-card-link:hover {
  background-color: #f8fafc;
}

/* Убираем стандартные стили ссылок */
.palette-card-link:hover .palette-colors,
.palette-card-link:hover .palette-info {
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

/* Для действий с палитрой (JSON, CSS, ZIP) */
.palette-actions a {
  z-index: 10;
  position: relative;
}