/* ==========================================================================
   Видео-воспоминания из фото — design tokens & layout
   Warm, calm, sensitive tone. Compact density.
   ========================================================================== */

:root {
  --vm-bg: #FAF8F5;
  --vm-surface: #FFFFFF;
  --vm-text: #1F1F1F;
  --vm-text-secondary: #6B6560;
  --vm-border: #E7E1DA;
  --vm-accent: #C8843C;
  --vm-accent-dark: #AD6F2E;
  --vm-success: #5B8C6E;
  --vm-danger: #B24B3E;
  --vm-radius-lg: 18px;
  --vm-radius-md: 12px;
  --vm-radius-sm: 8px;
  --vm-shadow-card: 0 1px 3px rgba(31, 31, 31, 0.06), 0 8px 24px rgba(31, 31, 31, 0.05);
  --vm-shadow-btn: 0 2px 6px rgba(200, 132, 60, 0.28);
  --vm-shadow-btn-hover: 0 6px 16px rgba(200, 132, 60, 0.38);
  --vm-font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  background: var(--vm-bg);
  color: var(--vm-text);
  font-family: var(--vm-font);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

.vm-container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 767px) {
  .vm-container { padding: 0 16px; }
}

/* ---------------- Header ---------------- */

.vm-header {
  padding: 28px 0 8px;
}

.vm-header-row {
  display: flex;
  align-items: center;
}

.vm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vm-logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--vm-accent), #DFA75E);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--vm-shadow-btn);
}

.vm-logo-text {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.vm-tagline {
  margin: 10px 0 0;
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 640px;
}

@media (max-width: 767px) {
  .vm-tagline { font-size: 26px; line-height: 32px; }
}

/* ---------------- Card shell ---------------- */

.vm-main { padding: 20px 0 48px; }

.vm-card {
  background: var(--vm-surface);
  border: 1px solid var(--vm-border);
  border-radius: var(--vm-radius-lg);
  box-shadow: var(--vm-shadow-card);
  margin-top: 20px;
  animation: vm-fade-in .35s ease both;
}

.vm-card-body { padding: 28px; }

@media (max-width: 767px) {
  .vm-card-body { padding: 18px; }
}

/* ---------------- Dropzone ---------------- */

.vm-dropzone {
  border: 2px dashed var(--vm-border);
  border-radius: var(--vm-radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
  background: #FDFBF9;
}

.vm-dropzone:hover,
.vm-dropzone:focus-visible {
  border-color: var(--vm-accent);
  outline: none;
}

.vm-dropzone.vm-dragover {
  border-color: var(--vm-accent);
  background: #FBF1E4;
  box-shadow: 0 0 0 3px rgba(200, 132, 60, 0.14);
}

.vm-dropzone-icon {
  font-size: 34px;
  color: var(--vm-accent);
  margin-bottom: 10px;
}

.vm-dropzone-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 4px;
}

.vm-dropzone-hint {
  font-size: 13px;
  color: var(--vm-text-secondary);
  margin: 0;
}

.vm-inline-error {
  color: var(--vm-danger);
  font-size: 13px;
  margin: 10px 2px 0;
}

/* ---------------- Thumbnail grid ---------------- */

.vm-thumbs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.vm-thumbs-grid:empty { margin-top: 0; }

@media (max-width: 767px) {
  .vm-thumbs-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

.vm-thumb {
  position: relative;
  border-radius: var(--vm-radius-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--vm-bg);
  border: 1px solid var(--vm-border);
  box-shadow: 0 2px 6px rgba(31,31,31,0.06);
  animation: vm-thumb-in .28s cubic-bezier(.2,.8,.3,1) both;
}

.vm-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vm-thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(31, 31, 31, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: background-color .15s ease;
}

.vm-thumb-remove:hover { background: rgba(178, 75, 62, 0.9); }

.vm-thumb-warning {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(178, 75, 62, 0.88);
  color: #fff;
  font-size: 11px;
  line-height: 1.35;
  padding: 6px 8px;
}

/* ---------------- Info banner ---------------- */

.vm-info-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #FBF1E4;
  border: 1px solid #EFD9B8;
  color: #7A5424;
  border-radius: var(--vm-radius-md);
  padding: 12px 16px;
  font-size: 13px;
  margin-top: 20px;
}

.vm-info-banner i { margin-top: 2px; color: var(--vm-accent-dark); }

/* ---------------- Occasion chips ---------------- */

.vm-chips-row { margin-top: 22px; }

.vm-chips-label {
  font-size: 13px;
  color: var(--vm-text-secondary);
  margin: 0 0 8px;
  font-weight: 600;
}

.vm-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .vm-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .vm-chip { flex: 0 0 auto; }
}

.vm-chip {
  border: 1px solid var(--vm-border);
  background: var(--vm-surface);
  color: var(--vm-text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.vm-chip:hover { border-color: var(--vm-accent); }

.vm-chip.vm-chip-active {
  background: var(--vm-accent);
  border-color: var(--vm-accent);
  color: #fff;
}

/* ---------------- Buttons ---------------- */

.vm-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--vm-accent);
  color: #fff;
  border: none;
  border-radius: var(--vm-radius-md);
  padding: 13px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--vm-shadow-btn);
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
  text-decoration: none;
}

.vm-btn-primary:hover {
  background: var(--vm-accent-dark);
  box-shadow: var(--vm-shadow-btn-hover);
  transform: translateY(-1px);
  color: #fff;
}

.vm-btn-primary:disabled {
  background: #E2D6C6;
  color: #fff;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.vm-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--vm-text);
  border: 1px solid var(--vm-border);
  border-radius: var(--vm-radius-md);
  padding: 13px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.vm-btn-secondary:hover { border-color: var(--vm-accent); background: #FBF1E4; }

.vm-btn-generate { width: 100%; margin-top: 24px; }

.vm-btn-spinner { display: inline-flex; align-items: center; gap: 8px; }

.vm-hint-text {
  text-align: center;
  font-size: 13px;
  color: var(--vm-text-secondary);
  margin: 8px 0 0;
}

@media (max-width: 767px) {
  #state-builder .vm-btn-generate {
    position: sticky;
    bottom: 12px;
    z-index: 5;
  }
}

/* ---------------- Processing state ---------------- */

.vm-processing-body { text-align: center; padding: 48px 28px; }

.vm-processing-icon {
  font-size: 36px;
  color: var(--vm-accent);
  margin-bottom: 14px;
  animation: vm-pulse 2.2s ease-in-out infinite;
}

.vm-processing-caption {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 20px;
  transition: opacity .3s ease;
}

.vm-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--vm-border);
  overflow: hidden;
  max-width: 360px;
  margin: 0 auto;
}

.vm-progress-fill {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--vm-accent), #E3AD6C);
  animation: vm-indeterminate 1.6s ease-in-out infinite;
}

.vm-processing-note {
  font-size: 13px;
  color: var(--vm-text-secondary);
  margin: 18px 0 0;
}

/* ---------------- Result state ---------------- */

.vm-result-header { margin-bottom: 14px; }

.vm-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(91, 140, 110, 0.12);
  color: var(--vm-success);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
}

.vm-player-wrap {
  border-radius: var(--vm-radius-md);
  overflow: hidden;
  background: #111;
  animation: vm-fade-in .5s ease both;
}

.vm-player { width: 100%; aspect-ratio: 16 / 9; display: block; }

.vm-result-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .vm-result-actions { flex-direction: column; }
  .vm-result-actions > * { width: 100%; }
}

/* ---------------- Footer ---------------- */

.vm-footer {
  padding: 8px 0 40px;
  color: var(--vm-text-secondary);
  font-size: 13px;
  text-align: center;
}

.vm-footer i { margin-right: 6px; }

/* ---------------- Toasts ---------------- */

.vm-toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(480px, calc(100% - 32px));
}

.vm-toast {
  background: #2A2320;
  color: #fff;
  border-radius: var(--vm-radius-md);
  padding: 14px 16px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: vm-toast-in .25s ease both;
}

.vm-toast-retry {
  background: rgba(255,255,255,0.14);
  border: none;
  color: #fff;
  border-radius: var(--vm-radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.vm-toast-retry:hover { background: rgba(255,255,255,0.24); }

/* ---------------- Animations ---------------- */

@keyframes vm-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes vm-thumb-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes vm-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: .75; }
}

@keyframes vm-indeterminate {
  0% { transform: translateX(-100%); width: 40%; }
  50% { width: 55%; }
  100% { transform: translateX(250%); width: 40%; }
}

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

@media (prefers-reduced-motion: reduce) {
  .vm-card, .vm-thumb, .vm-player-wrap, .vm-toast,
  .vm-processing-icon, .vm-progress-fill {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------------- Focus visibility ---------------- */

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--vm-accent);
  outline-offset: 2px;
}
