/* КП-генератор Онтико — Дизайн-система
   Палитра: Claude Design (фиолетово-лавандовая) */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/JetBrainsMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/JetBrainsMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-deep: #2c1c8c;
  --bg-deep-dark: #1e1264;
  --bg-card: #ffffff;
  --bg-input: #f4f3f8;
  --bg-hover: #eeedf5;

  --text-primary: #0e0a2a;
  --text-secondary: #6b6690;
  --text-on-dark: #ffffff;
  --text-muted: #9994b8;

  --btn-primary: #2c1c8c;
  --btn-primary-hover: #3d2ba6;
  --btn-danger: #ff5b5b;
  --btn-danger-hover: #e64545;
  --accent-blue: #2bb8e6;
  --accent-blue-hover: #22a0cc;

  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;

  --sidebar-width: 280px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-input: 14px;
  --radius-btn: 22px;

  --shadow-card: 0 2px 12px rgba(14, 10, 42, 0.08);
  --shadow-lg: 0 8px 32px rgba(14, 10, 42, 0.12);

  --font: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  --transition: 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

/* ── Layout ── */
.layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-deep-dark);
  color: var(--text-on-dark);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  opacity: 0.7;
  transition: opacity var(--transition);
}
.sidebar-user a:hover { opacity: 1; }

/* Step navigation */
.step-nav { list-style: none; margin-bottom: 24px; }

.step-nav-item {
  display: block;
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  transition: all var(--transition);
  cursor: pointer;
}
.step-nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}
.step-nav-item.active {
  background: var(--bg-card);
  color: var(--btn-primary);
  font-weight: 500;
}
.step-nav-item .step-num {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  font-size: 11px;
  margin-right: 8px;
}
.step-nav-item.active .step-num {
  background: var(--btn-primary);
  color: #fff;
}

/* Saved sessions */
.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin: 16px 0 8px 0;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  transition: background var(--transition);
}
.session-item:hover { background: rgba(255,255,255,0.06); }

.session-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.session-item-delete {
  opacity: 0;
  color: var(--btn-danger);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  transition: opacity var(--transition);
}
.session-item:hover .session-item-delete { opacity: 1; }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── Main content ── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  display: flex;
  justify-content: center;
}

.content-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 40px;
  max-width: 900px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  min-height: calc(100vh - 64px);
}

/* ── Typography ── */
h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-btn);
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--btn-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--btn-primary-hover); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
  background: transparent;
  color: var(--btn-danger);
  border: 1px solid var(--btn-danger);
}
.btn-danger:hover { background: rgba(255,91,91,0.08); }

.btn-accent {
  background: var(--accent-blue);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-blue-hover); }

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-full { width: 100%; justify-content: center; }

/* Year filter buttons */
.year-filter {
  display: flex;
  gap: 4px;
}
.year-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--bg-input);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.year-btn:hover { border-color: var(--text-muted); }
.year-btn.active {
  background: var(--btn-primary);
  color: #fff;
  border-color: var(--btn-primary);
}

.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Form elements ── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius-input);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent-blue);
  background: #fff;
}
textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* ── Checkbox cards (brainstorm ideas) ── */
.idea-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--bg-input);
  margin-bottom: 12px;
  transition: all var(--transition);
}
.idea-card.selected {
  border-color: var(--accent-blue);
  background: rgba(43, 184, 230, 0.04);
}
.idea-card.deselected {
  opacity: 0.5;
}

.idea-checkbox {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.idea-content { flex: 1; }
.idea-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
.idea-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.idea-title.struck {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ── Selected deals panel ── */
.selected-panel {
  padding: 16px 20px;
  border-radius: var(--radius);
  background: rgba(43, 184, 230, 0.06);
  border: 1px solid rgba(43, 184, 230, 0.2);
  margin-bottom: 20px;
}
.selected-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(43, 184, 230, 0.1);
}
.selected-item:last-child { border-bottom: none; }
.selected-item span:first-child { flex: 1; }
.selected-item-remove {
  background: none;
  border: none;
  color: var(--btn-danger);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.5;
  transition: opacity var(--transition);
}
.selected-item-remove:hover { opacity: 1; }

/* ── Deals table ── */
.deals-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.deals-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--bg-input);
}
.deals-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bg-input);
  vertical-align: middle;
}
.deals-table tr:hover td {
  background: var(--bg-input);
}
.deals-table input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
}

/* ── Flash messages ── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.flash-error { background: rgba(239,68,68,0.1); color: var(--error); border: 1px solid rgba(239,68,68,0.2); }
.flash-warning { background: rgba(245,158,11,0.1); color: #b45309; border: 1px solid rgba(245,158,11,0.2); }
.flash-success { background: rgba(34,197,94,0.1); color: #15803d; border: 1px solid rgba(34,197,94,0.2); }
.flash-info { background: rgba(43,184,230,0.1); color: #0e7490; border: 1px solid rgba(43,184,230,0.2); }

/* ── Spinner (HTMX indicator) ── */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.spinner-dots {
  display: flex;
  gap: 4px;
}
.spinner-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--btn-primary);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.spinner-dots span:nth-child(2) { animation-delay: 0.2s; }
.spinner-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── Tabs (step 7) ── */
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--bg-input); }
.tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--btn-primary);
  border-bottom-color: var(--btn-primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Feedback bar ── */
.feedback-bar {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: flex-end;
}
.feedback-bar input {
  flex: 1;
}

/* ── Action bar (navigation buttons) ── */
.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-input);
}
.action-bar-spacer { flex: 1; }

/* ── Theme selector (step 7) ── */
.theme-selector {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}
.theme-btn {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius);
  border: 2px solid var(--bg-input);
  background: var(--bg-card);
  cursor: pointer;
  text-align: center;
  font-family: var(--font);
  font-size: 12px;
  transition: all var(--transition);
}
.theme-btn.active {
  border-color: var(--accent-blue);
  background: rgba(43,184,230,0.06);
}
.theme-btn:hover { border-color: var(--text-muted); }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--bg-input);
  margin: 24px 0;
}

/* ── Utility ── */
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Decorative accents (from Claude Design) ── */
.accent-circle {
  position: fixed;
  top: 40px;
  right: 60px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--btn-danger);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}
.accent-rect {
  position: fixed;
  bottom: 80px;
  left: calc(var(--sidebar-width) + 40px);
  width: 80px;
  height: 20px;
  border-radius: 4px;
  background: var(--accent-blue);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* ── Login page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg-deep);
}
.login-card {
  background: var(--bg-card);
  padding: 48px 40px;
  border-radius: 20px;
  width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}
.login-error {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Карточка уточнения противоречий */
.clarification-card {
  margin-top: 20px;
  border: 1px solid #e8a04c;
  border-radius: var(--radius);
  background: #fef9f0;
  overflow: hidden;
}
.clarification-header {
  background: #f5e6cc;
  padding: 10px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.clarification-icon {
  font-size: 16px;
}
.clarification-body {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #5a4a30;
  white-space: pre-wrap;
}
.clarification-actions {
  padding: 12px 16px;
  border-top: 1px solid #e8d4b0;
}

/* ── Сохранение ручных правок ── */
.save-edits-bar {
  display: flex;
  align-items: center;
  margin-top: 8px;
  margin-bottom: 4px;
}

/* ── Корзина продуктов (шаг 6) ── */
.recommendation-block {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.recommendation-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6366f1;
  margin-bottom: 6px;
}
.recommendation-block p {
  margin: 0;
  line-height: 1.6;
}

/* Строки корзины */
.cart-group {
  margin-bottom: 16px;
}
.cart-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin: 12px 0 4px 28px;
}
.cart-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.cart-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.cart-row-selected {
  background: rgba(99, 102, 241, 0.05);
}
.cart-checkbox {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 2px;
  accent-color: #6366f1;
  cursor: pointer;
  -webkit-appearance: checkbox;
  appearance: checkbox;
}
.cart-row-info {
  flex: 1;
  min-width: 0;
}
.cart-row-name {
  font-weight: 600;
  font-size: 14px;
}
.cart-row-conf {
  font-size: 12px;
  color: #6366f1;
  margin-left: 8px;
}
.cart-row-reason {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}
.cart-row-price {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  color: #6366f1;
  min-width: 100px;
  text-align: right;
}

/* Сворачиваемые секции */
.cart-details {
  margin-top: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}
.cart-details-summary {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
}
.cart-details-summary:hover {
  background: rgba(255, 255, 255, 0.06);
}
.cart-details-inner {
  margin: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
}
.cart-details-summary-inner {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.cart-details-summary-inner:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Итого */
.pricing-summary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
}
.pricing-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}
.pricing-discount {
  color: #22c55e;
}
.pricing-total {
  font-size: 18px;
  font-weight: 700;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  margin-top: 8px;
}
.pricing-amount {
  font-weight: 700;
}
