/* ============================================
   thought.css
   Модуль "Разобрать мысль" — чат-флоу
   Переменные берутся из styles.css (:root)
   ============================================ */

/* ===========================================
   КАРТОЧКИ ВВОДА В ЧАТЕ
   =========================================== */

.tw-chat-input-card,
.tw-emotions-card,
.tw-evidence-card,
.tw-after-card {
  background: var(--white);
  border: 1.5px solid var(--oat);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeUp 0.3s ease both;
  max-width: 78%;
}

@media (max-width: 899px) {
  .tw-chat-input-card,
  .tw-emotions-card,
  .tw-evidence-card,
  .tw-after-card {
    max-width: 100%;
  }
}

/* ===========================================
   TEXTAREA В ЧАТЕ
   =========================================== */

.tw-chat-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--oat);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--graphite);
  background: var(--white);
  outline: none;
  resize: none;
  line-height: 1.6;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.tw-chat-textarea:focus { border-color: var(--lavender); }
.tw-chat-textarea::placeholder { color: var(--graphite); opacity: 0.3; }
.tw-chat-textarea--sm { min-height: 60px; }

/* ===========================================
   ФУТЕР КАРТОЧКИ (кнопки)
   =========================================== */

.tw-chat-input-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tw-btn-next {
  background: var(--sage);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tw-btn-next:hover { background: var(--sage-deep); }
.tw-btn-next:active { transform: scale(0.98); }

.tw-btn-cancel {
  background: none;
  color: var(--graphite-soft);
  border: 1.5px solid var(--oat);
  padding: 10px 16px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.tw-btn-cancel:hover { border-color: var(--graphite-soft); }

/* ===========================================
   ЭМОЦИИ
   =========================================== */

.tw-emotions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tw-emotion-chip {
  padding: 7px 14px;
  border: 1.5px solid var(--oat);
  border-radius: 20px;
  background: var(--white);
  color: var(--graphite);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.tw-emotion-chip:hover {
  border-color: var(--lavender-pale);
  background: var(--lavender-ghost);
}

.tw-emotion-chip--active {
  border-color: var(--lavender);
  background: var(--lavender-ghost);
  color: var(--lavender);
  font-weight: 500;
}

/* ===========================================
   ИНТЕНСИВНОСТЬ
   =========================================== */

.tw-intensity-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tw-intensity-label {
  font-size: 13px;
  color: var(--graphite);
}

.tw-intensity-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--lavender);
}

.tw-intensity-compare {
  font-size: 12px;
  color: var(--graphite-soft);
  margin-top: -6px;
}

.tw-intensity-hint {
  font-size: 12px;
  color: var(--graphite-soft);
}

.tw-intensity-delta {
  font-size: 13px;
  font-weight: 500;
  min-height: 18px;
}

.tw-slider {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 5px;
  border-radius: 3px;
  background: var(--oat);
  outline: none;
  cursor: pointer;
}

.tw-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lavender);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(139, 125, 181, 0.35);
}

.tw-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lavender);
  cursor: pointer;
  border: none;
}

/* ===========================================
   ФАКТЫ (evidence card)
   =========================================== */

.tw-evidence-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tw-evidence-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--graphite);
}

/* ===========================================
   ФИНАЛЬНЫЕ КНОПКИ
   =========================================== */

.tw-final-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tw-btn-primary {
  background: var(--sage);
  color: white;
  border: none;
  padding: 13px 20px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.tw-btn-primary:hover { background: var(--sage-deep); }
.tw-btn-primary:active { transform: scale(0.98); }

.tw-btn-secondary {
  background: var(--white);
  color: var(--graphite);
  border: 1.5px solid var(--oat);
  padding: 11px 20px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.tw-btn-secondary:hover {
  border-color: var(--lavender-pale);
  background: var(--lavender-ghost);
}

.tw-btn-danger {
  background: none;
  color: var(--graphite-soft);
  border: 1.5px solid var(--oat);
  padding: 11px 20px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.tw-btn-danger:hover { border-color: #ef4444; color: #ef4444; }

/* ===========================================
   ОШИБКА INLINE
   =========================================== */

.tw-inline-error {
  font-size: 12px;
  color: #ef4444;
  text-align: center;
  animation: fadeUp 0.2s ease both;
}

/* ===========================================
   TOAST
   =========================================== */

.tw-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--white);
  color: var(--graphite);
  border: 1.5px solid var(--sage-pale);
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(143, 175, 139, 0.18);
  z-index: 9999;
  font-family: var(--font-display);
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
  white-space: nowrap;
  pointer-events: none;
}

.tw-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===========================================
   ЖУРНАЛ: карточки мыслей
   =========================================== */

.tw-limit-info {
  font-size: 12px;
  color: var(--graphite-soft);
  text-align: right;
  padding: 0 2px 10px;
}

.tw-card {
  background: var(--white);
  border: 1.5px solid var(--oat);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeUp 0.3s ease both;
}

.tw-card:hover {
  border-color: var(--lavender-pale);
  background: var(--lavender-ghost);
}

.tw-card-date {
  font-size: 11px;
  color: var(--graphite-soft);
  margin-bottom: 8px;
}

.tw-card-original {
  font-size: 14px;
  color: var(--graphite);
  margin-bottom: 6px;
  line-height: 1.5;
}

.tw-card-new {
  font-size: 13px;
  color: var(--graphite-soft);
  line-height: 1.5;
  margin-bottom: 8px;
}

.tw-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 0.5px solid var(--oat-soft);
}

.tw-card-emotions {
  font-size: 12px;
  color: var(--graphite-soft);
}

.tw-card-drop {
  font-size: 12px;
  color: var(--graphite-soft);
  font-weight: 500;
}

.tw-card-drop--positive { color: var(--sage-deep); }

.tw-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--graphite-soft);
  font-size: 14px;
}

/* ===========================================
   МОДАЛКА КАРТОЧКИ РАЗБОРА
   =========================================== */

.tw-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 43, 38, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeUp 0.2s ease both;
}

@media (min-width: 600px) {
  .tw-modal-overlay { align-items: center; }
}

.tw-modal-panel {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 32px rgba(42, 43, 38, 0.12);
  animation: modalSlide 0.3s ease both;
}

@media (min-width: 600px) {
  .tw-modal-panel { border-radius: 20px; }
}

.tw-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--oat);
  flex-shrink: 0;
}

.tw-modal-date {
  font-size: 13px;
  color: var(--graphite-soft);
}

.thought-wizard-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--graphite-soft);
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
  font-family: var(--font-body);
}

.thought-wizard-close:hover { color: var(--graphite); }

.tw-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.tw-modal-body::-webkit-scrollbar { width: 4px; }
.tw-modal-body::-webkit-scrollbar-track { background: transparent; }
.tw-modal-body::-webkit-scrollbar-thumb { background: var(--oat); border-radius: 2px; }

.tw-modal-section { margin-bottom: 16px; }

.tw-modal-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--graphite-soft);
  margin-bottom: 6px;
}

.tw-modal-text {
  font-size: 14px;
  color: var(--graphite);
  line-height: 1.6;
}

.tw-modal-section--highlight {
  background: var(--lavender-ghost);
  border-radius: 12px;
  padding: 14px;
  margin-left: -4px;
  margin-right: -4px;
}

.tw-modal-section--highlight .tw-modal-label { color: var(--lavender); }

.tw-modal-footer {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--oat);
  flex-shrink: 0;
}