/* ============================================================
   COMPONENTS
   Reusable UI elements: cards, inputs, buttons, segments, chips
   ============================================================ */

/* --- BRAND --- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.brand-mark img {
  max-width: 32px;
  max-height: 32px;
  width: 100%;
  height: 100%;
}
.brand-text { color: var(--text-muted); font-weight: 500; }
.brand-text b { color: var(--text); font-weight: 600; }

/* --- THEME TOGGLE --- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition);
}
.theme-toggle:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.theme-toggle .opt {
  width: 32px; height: 32px;
  border-radius: 999px;
  display: grid; place-items: center;
  color: var(--text-subtle);
  transition: all var(--transition);
  border: none; background: transparent; cursor: pointer;
}
.theme-toggle .opt.active {
  background: var(--surface-elev);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
[data-theme="light"] .theme-toggle .opt.active { background: var(--bg-subtle); }
.theme-toggle svg { width: 16px; height: 16px; }

/* --- HERO --- */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 20px;
}
.hero-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.hero-sub {
  font-size: clamp(16px, 1.5vw, 20px);
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 640px;
  font-weight: 400;
}

/* --- CARD --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 30px 15px;
  box-shadow: var(--shadow-md);
  transition: background var(--transition), border-color var(--transition);
  animation: fadeUp 600ms var(--ease) both;
}
@media (min-width: 1024px) { .card { padding: 40px; } }
.card:nth-of-type(2) { animation-delay: 80ms; }

/* Sticky only when cards are side-by-side on desktop */
@media (min-width: 1024px) {
  .card-sticky { position: sticky; top: 24px; }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.card-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-subtle);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
}

/* --- FIELDS --- */
.field-group { margin-bottom: 24px; }
.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: -0.005em;
}
.field-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all var(--transition);
}
.input-wrap:hover { background: var(--surface-hover); }
.input-wrap:focus-within {
  background: var(--surface-elev);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-wrap input,
.input-wrap select {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  width: 100%;
}
@media (min-width: 1024px) {
  .input-wrap input, .input-wrap select { font-size: 20px; }
}
.input-wrap .unit {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-subtle);
  font-weight: 500;
  padding-left: 10px;
}
.input-wrap select {
  appearance: none;
  cursor: pointer;
  padding-right: 22px;
  background-repeat: no-repeat;
  background-position: right 0 center;
  /* Dark theme: muted gray chevron matching --text-muted (#a1a1aa). */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23a1a1aa' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
}
[data-theme="light"] .input-wrap select {
  /* Light theme: chevron matching light --text-subtle (#86868b) for adequate contrast on white. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2386868b' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
}
.input-wrap select option { background: var(--surface); color: var(--text); }

/* --- SEGMENTED CONTROL --- */
.segmented {
  display: inline-flex;
  width: 100%;
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: 12px;
  gap: 2px;
}
.segmented button {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
@media (min-width: 1024px) {
  .segmented button { font-size: 14px; padding: 11px 14px; }
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: var(--surface-elev);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
[data-theme="light"] .segmented button.active { background: var(--surface); }

.segmented.compact button { 
  padding: 8px 4px; 
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
@media (min-width: 1024px) {
  .segmented.compact button { font-size: 13px; padding: 9px 8px; }
}

/* --- CHIPS (ikonice za tip vozila) --- */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 480px) {
  .chip-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .chip-grid { gap: 10px; }
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.chip {
  padding: 12px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
@media (min-width: 640px) {
  .chip { padding: 14px 8px; gap: 6px; }
}
.chip:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}
.chip svg { width: 22px; height: 22px; stroke-width: 1.5; }
@media (min-width: 640px) {
  .chip svg { width: 24px; height: 24px; }
}
.chip span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
@media (min-width: 640px) {
  .chip span { font-size: 12px; }
}
.chip.active span { color: var(--accent-text); font-weight: 600; }

/* --- TOTAL DISPLAY --- */
.total-display {
  text-align: center;
  padding: 32px 0 28px;
  position: relative;
}
.total-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 14px;
  letter-spacing: -0.005em;
}
.total-amount {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(48px, 7vw, 104px);
  line-height: 1;
  letter-spacing: -0.055em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: transform 300ms var(--ease);
  max-width: 100%;
  overflow-wrap: break-word;
}
.total-amount.pulse { animation: pulse 400ms var(--ease); }
.total-amount sup {
  font-size: 0.32em;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 10px;
  vertical-align: 0.8em;
  letter-spacing: -0.01em;
}
.total-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
  color: var(--text-muted);
  margin-top: 14px;
}
.total-sub b {
  font-style: normal;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

/* --- QUICK STATS --- */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0 8px;
  padding: 20px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
}
.qs { text-align: center; }
.qs-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 1024px) { .qs-num { font-size: 22px; } }
.qs-label {
  font-size: 11px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* --- BREAKDOWN --- */
.breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 12px;
}
.breakdown-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.breakdown-toggle {
  font-size: 12px;
  color: var(--accent-text);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.breakdown-toggle svg {
  width: 12px; height: 12px;
  transition: transform var(--transition);
}
.breakdown-toggle.open svg { transform: rotate(180deg); }

.breakdown-list {
  display: flex;
  flex-direction: column;
  max-height: 800px;
  overflow: hidden;
  transition: max-height 400ms var(--ease);
}
.breakdown-list.collapsed { max-height: 0; }

.line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.line:last-of-type { border-bottom: none; }
.line-desc {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.line-desc small {
  display: block;
  font-size: 12px;
  color: var(--text-subtle);
  font-weight: 400;
  margin-top: 3px;
  font-family: var(--font-mono);
}
.line-val {
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.line-val.dim { color: var(--text-subtle); font-weight: 400; }
.line-val.positive { color: var(--success); }
.line-val.negative { color: var(--accent-text); }

/* --- NOTE --- */
.note {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  display: flex;
  gap: 10px;
}
.note svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 1px;
}
.note b { color: var(--text); font-weight: 600; }

/* --- BUTTON (za kasnije: Save, Login, Upgrade) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: white;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

/* --- FAQ SECTION --- */
.faq-section {
  margin-top: 80px;
  animation: fadeUp 600ms var(--ease) both;
}
@media (min-width: 1024px) { .faq-section { margin-top: 120px; } }

.faq-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 40px;
}
@media (min-width: 1024px) { .faq-header { margin-bottom: 56px; } }

.faq-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 20px;
}

.faq-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 12px;
}
.faq-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent-text);
}

.faq-subtitle {
  font-size: clamp(15px, 1.3vw, 17px);
  color: var(--text-muted);
  line-height: 1.5;
}

.faq-grid {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.faq-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.faq-item.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}

.faq-question {
  width: 100%;
  padding: 22px 24px;
  background: transparent;
  border: none;
  text-align: left;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all var(--transition);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.faq-question > span:first-child {
  flex: 1;
  min-width: 0;
}
@media (max-width: 500px) {
  .faq-question {
    padding: 18px 18px;
    font-size: 15px;
    gap: 12px;
  }
}
@media (min-width: 1024px) {
  .faq-question { padding: 26px 30px; font-size: 18px; }
}
.faq-question:hover { background: var(--surface-hover); }

.faq-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-subtle);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.faq-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
  transition: transform var(--transition);
}
.faq-item.open .faq-icon {
  background: var(--accent);
  color: white;
}
.faq-item.open .faq-icon svg { transform: rotate(45deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms var(--ease);
}
.faq-item.open .faq-answer { max-height: 1000px; }

.faq-answer-inner {
  padding: 0 24px 24px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.005em;
}
@media (min-width: 1024px) {
  .faq-answer-inner { padding: 0 30px 28px; font-size: 16px; }
}
.faq-answer-inner p {
  margin-bottom: 10px;
}
.faq-answer-inner p:last-child { margin-bottom: 0; }
.faq-answer-inner strong {
  color: var(--text);
  font-weight: 600;
}
.faq-answer-inner ul {
  margin: 10px 0;
  padding-left: 20px;
}
.faq-answer-inner li {
  margin-bottom: 6px;
}
