/* ============================================
   Arhibet Vizualizator — design system
   Paleta iz logoa: siva + lime zelena
   ============================================ */

:root {
  --green: #a4c400;
  --green-dark: #8aa600;
  --green-soft: #f2f7dc;
  --gray-900: #2e2f30;
  --gray-700: #58595b;
  --gray-500: #8a8b8d;
  --gray-300: #d6d7d8;
  --gray-100: #f0f1ef;
  --bg: #f7f8f5;
  --white: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(46, 47, 48, 0.08);
  --shadow-lift: 0 14px 40px rgba(46, 47, 48, 0.14);
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2 { font-family: var(--font-head); }

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

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.logo { height: 34px; width: auto; }

.header-tag {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-700);
  background: var(--green-soft);
  border: 1px solid var(--green);
  padding: 4px 12px;
  border-radius: 999px;
}

/* ---------- Hero ---------- */

.hero {
  background:
    radial-gradient(ellipse 80% 120% at 85% -20%, rgba(164, 196, 0, 0.28), transparent 60%),
    var(--gray-900);
  color: var(--white);
  padding: 72px 0 84px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* suptilna behaton šara u pozadini hero sekcije */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 56px 28px;
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
  pointer-events: none;
}

.hero > .container { position: relative; }

.hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid rgba(164, 196, 0, 0.4);
  border-radius: 999px;
  padding: 5px 16px;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero h1 .accent { color: var(--green); }

.hero-sub {
  max-width: 560px;
  margin: 18px auto 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1.05rem;
}

/* ---------- Koraci ---------- */

.step {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-top: 28px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.step:first-of-type { margin-top: -36px; }

.step-locked {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.step-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.step-num {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1.2;
}

.step-head h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.step-head p {
  color: var(--gray-500);
  font-size: 0.95rem;
  margin-top: 2px;
}

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

.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--bg);
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.drag-over {
  border-color: var(--green);
  background: var(--green-soft);
}

.dropzone-idle { text-align: center; padding: 36px 20px; }

.dz-icon {
  width: 44px;
  height: 44px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.dz-title { font-weight: 500; font-size: 1.02rem; }

.accent-text { color: var(--green-dark); font-weight: 600; }

.dz-hint {
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-top: 4px;
}

.dz-camera { margin-top: 18px; display: none; }

/* camera dugme samo na touch uređajima */
@media (pointer: coarse) {
  .dz-camera { display: inline-flex; }
}

.dropzone-preview {
  position: relative;
  width: 100%;
  padding: 12px;
}

.dropzone-preview img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
}

.btn-change {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(46, 47, 48, 0.82);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.btn-change:hover { background: var(--gray-900); }

.field-error {
  color: #c0392b;
  font-size: 0.9rem;
  margin-top: 10px;
}

/* ---------- Galerija pločica ---------- */

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tile-card {
  border: 2px solid var(--gray-100);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.tile-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.tile-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(164, 196, 0, 0.25);
}

.tile-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #fff;
}

.tile-info { padding: 12px 14px 14px; position: relative; }

.tile-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
}

.tile-variant {
  color: var(--gray-500);
  font-size: 0.82rem;
  margin-top: 1px;
}

.tile-check {
  position: absolute;
  top: -14px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.tile-card.selected .tile-check { display: flex; }

/* ---------- Generate ---------- */

.generate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.generate-summary {
  color: var(--gray-700);
  font-size: 0.95rem;
  min-height: 1.2em;
}

.generate-summary strong { color: var(--gray-900); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  border-radius: 999px;
  padding: 14px 28px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
  border: none;
  text-decoration: none;
}

.btn svg { width: 20px; height: 20px; }

.btn-primary {
  background: var(--green);
  color: var(--gray-900);
  box-shadow: 0 6px 20px rgba(164, 196, 0, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: var(--green-dark);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  background: var(--gray-300);
  color: var(--gray-500);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--gray-900);
  border: 2px solid var(--gray-300);
}

.btn-outline:hover { border-color: var(--green); color: var(--green-dark); }

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  padding: 14px 16px;
}

.btn-ghost:hover { color: var(--gray-900); }

.limit-note {
  color: var(--gray-500);
  font-size: 0.82rem;
  margin-top: 14px;
}

/* ---------- Loading ---------- */

.loading { text-align: center; padding: 48px 20px 32px; }

.loading-tiles {
  display: inline-grid;
  grid-template-columns: repeat(3, 22px);
  gap: 5px;
  margin-bottom: 24px;
}

.loading-tiles span {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--gray-300);
  animation: tile-pulse 1.5s ease-in-out infinite;
}

.loading-tiles span:nth-child(2) { animation-delay: 0.15s; }
.loading-tiles span:nth-child(3) { animation-delay: 0.3s; }
.loading-tiles span:nth-child(4) { animation-delay: 0.45s; }
.loading-tiles span:nth-child(5) { animation-delay: 0.6s; }
.loading-tiles span:nth-child(6) { animation-delay: 0.75s; }

@keyframes tile-pulse {
  0%, 100% { background: var(--gray-300); transform: scale(1); }
  50% { background: var(--green); transform: scale(1.12); }
}

.loading-msg {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  transition: opacity 0.3s;
}

.loading-hint {
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ---------- Greška ---------- */

.result-error {
  background: #fdf3f2;
  border: 1px solid #f0c7c2;
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-top: 24px;
  text-align: center;
}

.result-error p { color: #8e2f23; margin-bottom: 16px; }

/* ---------- Rezultat: before/after ---------- */

.result { margin-top: 28px; }

.ba-slider {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  touch-action: none;
  cursor: ew-resize;
  box-shadow: var(--shadow-lift);
  user-select: none;
}

.ba-img {
  width: 100%;
  display: block;
  pointer-events: none;
}

.ba-after-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* širina se kontroliše iz JS: clip-path inset */
}

.ba-after {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ba-handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--white);
  box-shadow: 0 0 12px rgba(0,0,0,0.35);
}

.ba-handle-knob {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--green);
  color: var(--gray-900);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.ba-handle-knob svg { width: 22px; height: 22px; }

.ba-label {
  position: absolute;
  top: 14px;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(46, 47, 48, 0.72);
  color: var(--white);
  backdrop-filter: blur(4px);
}

.ba-label-before { left: 14px; }
.ba-label-after { right: 14px; background: var(--green); color: var(--gray-900); }

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

.result-note {
  color: var(--gray-500);
  font-size: 0.82rem;
  margin-top: 16px;
}

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

.site-footer {
  margin-top: 64px;
  background: var(--gray-900);
  color: rgba(255,255,255,0.65);
  padding: 40px 0;
  text-align: center;
  font-size: 0.9rem;
}

.logo-footer {
  height: 26px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
  margin-bottom: 12px;
}

.site-footer a { color: var(--green); text-decoration: none; }

.footer-fine {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  margin-top: 10px;
}

/* ---------- Animacije ulaska ---------- */

@media (prefers-reduced-motion: no-preference) {
  .step {
    animation: step-in 0.5s ease both;
  }
  @keyframes step-in {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .step-locked { animation: none; }
}

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .hero { padding: 52px 0 64px; }
  .hero h1 br { display: none; }

  .step { padding: 22px 18px; margin-top: 20px; }
  .step:first-of-type { margin-top: -32px; }

  .step-head { gap: 12px; margin-bottom: 18px; }
  .step-num { font-size: 1.3rem; }
  .step-head h2 { font-size: 1.15rem; }

  .tiles-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .tile-info { padding: 10px 12px 12px; }
  .tile-name { font-size: 0.92rem; }
  .tile-variant { font-size: 0.75rem; }

  .generate-bar { flex-direction: column; align-items: stretch; }
  .btn-generate { justify-content: center; width: 100%; }

  .result-actions { flex-direction: column; }
  .result-actions .btn { justify-content: center; }

  .dropzone { min-height: 200px; }

  .ba-handle-knob { width: 40px; height: 40px; }
}
