/* ── Otomasyon Master Premium Theme — Light/White Edition ───────────────── */
/* Per-page Jinja inline <style>:root{}</style> sets:                        */
/*   --accent, --cta-from, --cta-to, --overlay, --bg-image, --logo-h        */
/* Fallbacks below are the light-white defaults.                             */

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

/* ── light theme tokens ───────────────────────────────────────────────────── */
:root {
  --ink:          #1d2030;
  --ink-muted:    rgba(29, 32, 48, 0.62);
  --ink-faint:    rgba(29, 32, 48, 0.42);
  --panel:        rgba(255, 255, 255, 0.88);
  --panel-border: rgba(20, 20, 50, 0.10);
  --card:         #fff;
  --card-border:  rgba(20, 20, 50, 0.08);
  --logo-h:       64px;
}

/* ── base ────────────────────────────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem 3rem;
  position: relative;
  overflow-x: hidden;
}

/* ── fullscreen background + light overlay ───────────────────────────────── */
.bg {
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg-image, radial-gradient(ellipse at 30% 20%, #f4f3fb 0%, #e9e9f2 70%));
  background-size: cover;
  background-position: center;
}
.bg::after {
  content: ''; position: absolute; inset: 0;
  background: var(--overlay, rgba(255, 255, 255, 0.55));
  backdrop-filter: blur(2px);
}

/* ── content column ──────────────────────────────────────────────────────── */
.content {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; align-items: center;
  gap: 1.25rem;
}

/* ── back link ───────────────────────────────────────────────────────────── */
.back-link {
  align-self: flex-start;
  color: var(--ink-muted); font-size: .85rem;
  text-decoration: none;
  display: flex; align-items: center; gap: .35rem; padding: .25rem 0;
}
.back-link:hover { color: var(--ink); }

/* ── logo card (white rounded) ───────────────────────────────────────────── */
.logo-card {
  background: #fff;
  border-radius: 16px;
  padding: .75rem 1.25rem;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap;
  gap: .55rem .9rem;
  max-width: min(94vw, 360px); width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,.10);
  border: 1px solid var(--card-border);
}
.logo-card img {
  flex: 1 1 0;
  min-width: 72px; max-width: 150px;
  height: auto; max-height: var(--logo-h, 64px);
  object-fit: contain;
}
.logo-text {
  font-size: 1rem; font-weight: 800; letter-spacing: 3px;
  color: var(--accent, #6d5cf0);
}

/* ── glass panel (light translucent) ────────────────────────────────────── */
.glass {
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  padding: 1.75rem 1.5rem 2rem;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.10), 0 0 0 1px rgba(109,92,240,.06);
}
.glass h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: 2px; margin-bottom: .5rem; color: var(--ink); }
.glass h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: .35rem; color: var(--ink); }
.glass h3 { font-size: .95rem; font-weight: 700; margin-bottom: .6rem; color: var(--ink-muted); }
.glass p  { font-size: .88rem; color: var(--ink-muted); line-height: 1.6; }
.subtitle { font-size: .88rem; color: var(--ink-muted); margin-bottom: 1.25rem; line-height: 1.5; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: block; width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 14px; font-size: 1.05rem; font-weight: 700;
  text-align: center; text-decoration: none; cursor: pointer;
  border: none; transition: opacity .15s, transform .1s, box-shadow .15s;
  letter-spacing: .3px;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--cta-from, #5a4fe0), var(--cta-to, #7b5cf5));
  color: #fff;
  box-shadow: 0 4px 22px rgba(90,79,224,.45);
}
.btn-primary:hover  { box-shadow: 0 6px 30px rgba(90,79,224,.6); opacity: .93; }
.btn-primary:disabled { opacity: .38; box-shadow: none; cursor: not-allowed; transform: none; }

.btn-outline {
  background: rgba(29,32,48,.06);
  border: 1.5px solid rgba(29,32,48,.18);
  color: var(--ink);
}
.btn-outline:hover { background: rgba(29,32,48,.11); }
.btn-green { background: #22c55e; color: #fff; box-shadow: 0 4px 16px rgba(34,197,94,.3); }
.btn-green:disabled { opacity: .38; box-shadow: none; cursor: not-allowed; }

.btn-wrap { display: flex; flex-direction: column; gap: .75rem; width: 100%; margin-top: 1.5rem; }

/* ── dropzone (WHITE card) ───────────────────────────────────────────────── */
.dropzone {
  background: #fff;
  border: 2px dashed rgba(109,92,240,.38);
  border-radius: 18px;
  padding: 2rem 1.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent, #6d5cf0);
  box-shadow: 0 0 0 3px rgba(109,92,240,.1);
}
.dropzone.has-photo {
  border-style: solid;
  border-color: var(--accent, #6d5cf0);
  padding: 0;
}

/* icon square */
.dz-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px;
  background: rgba(109,92,240,.12);
  border-radius: 15px;
  font-size: 1.6rem;
  margin-bottom: .8rem;
}
.dz-title {
  font-size: .95rem; font-weight: 600;
  color: #1a1530; margin-bottom: .2rem;
}
.dz-sub { font-size: .8rem; color: #8b8ba7; }
.drop-btn {
  display: inline-block; margin-top: .7rem;
  background: var(--accent, #6d5cf0); color: #fff;
  font-size: .82rem; font-weight: 700;
  padding: .45rem 1.2rem;
  border-radius: 9px; cursor: pointer;
  transition: opacity .15s; pointer-events: all;
}
.drop-btn:hover { opacity: .85; }

.drop-idle { pointer-events: none; }
#preview-img {
  width: 100%; height: auto;
  max-height: 60vh;
  object-fit: contain;
  position: static;
  display: block;
  border-radius: 16px;
}
.preview-remove {
  position: absolute; top: .6rem; right: .6rem;
  background: rgba(0,0,0,.55); border: none;
  border-radius: 50%; width: 28px; height: 28px;
  color: #fff; font-size: .85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
#file-input { display: none; }

/* ── carousel (WHITE numbered cards) ────────────────────────────────────── */
.carousel-section { margin-bottom: 1.25rem; }
.carousel-section > h3 {
  font-size: .88rem; font-weight: 700;
  color: var(--ink-muted);
  text-align: center; margin-bottom: .7rem;
}
.carousel {
  display: flex; gap: .6rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel-empty {
  font-size: .8rem; color: var(--ink-faint);
  text-align: center; padding: 1rem 0; width: 100%;
}

/* individual WHITE card */
.bg-card {
  flex: 0 0 88px;
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 14px;
  cursor: pointer;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s, transform .1s;
  user-select: none;
  display: flex; flex-direction: column;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.bg-card:active { transform: scale(.96); }

/* image area */
.bg-card img {
  width: 100%; height: 76px;
  object-fit: contain; display: block;
  border-radius: 11px 11px 0 0;
  pointer-events: none;
}
/* primary label (card_label — number/short text) */
.bg-card .card-num {
  display: block; text-align: center;
  font-size: .78rem; font-weight: 700;
  color: var(--ink); padding: .25rem .3rem .1rem;
  background: var(--card);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* secondary label (display_name) — shown when present */
.bg-card .card-name {
  display: block; text-align: center;
  font-size: .68rem; font-weight: 500;
  color: var(--ink-muted); padding: 0 .3rem .3rem;
  background: var(--card);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* hide label area if both are empty (fallback) */
.bg-card .card-num:empty + .card-name:empty { display: none; }

/* selected */
.bg-card.selected {
  border-color: var(--accent, #6d5cf0);
  box-shadow: 0 0 0 2px rgba(109,92,240,.18);
}

/* tick badge top-right */
.bg-card .check {
  display: none;
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent, #6d5cf0); color: #fff;
  font-size: .68rem; font-weight: 800;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.bg-card.selected .check { display: flex; }

.sel-counter {
  font-size: .76rem; color: var(--ink-muted);
  text-align: right; margin-top: -.9rem; margin-bottom: .75rem;
}
.sel-counter span { color: var(--accent, #6d5cf0); font-weight: 700; }

/* ── spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 50px; height: 50px;
  border: 3.5px solid rgba(0,0,0,.08);
  border-top-color: var(--accent, #6d5cf0);
  border-radius: 50%;
  animation: kf-spin .85s linear infinite;
  margin: 0 auto 1.25rem;
}
.mini-spinner {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid rgba(0,0,0,.10);
  border-top-color: var(--accent, #6d5cf0);
  border-radius: 50%;
  animation: kf-spin .8s linear infinite;
}
@keyframes kf-spin { to { transform: rotate(360deg); } }

/* ── states: generating, result, error ───────────────────────────────────── */
.generating-wrap { text-align: center; padding: 2rem 1rem; }
.gen-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .5rem; color: var(--ink); }
.gen-sub   { font-size: .85rem; color: var(--ink-muted); line-height: 1.6; }
.gen-timer { font-size: .78rem; color: var(--ink-faint); margin-top: .75rem; }

.result-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 1rem; text-align: center; color: var(--ink); }
.result-cards { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 1rem; }
.result-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.result-card img {
  width: 100%; height: auto;
  display: block;
}
.result-card-body  { padding: .9rem 1rem; }
.result-card-name  { font-size: .8rem; color: var(--ink-faint); margin-bottom: .65rem; }
.result-actions    { display: flex; gap: .6rem; }
.btn-download {
  flex: 1; padding: .65rem .8rem;
  border-radius: 10px; font-size: .88rem; font-weight: 700;
  background: rgba(29,32,48,.06);
  border: 1.5px solid rgba(29,32,48,.16);
  color: var(--ink); cursor: pointer; text-decoration: none;
  text-align: center; transition: background .15s;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn-download:hover { background: rgba(29,32,48,.12); }
.btn-print {
  flex: 1; padding: .65rem .8rem;
  border-radius: 10px; font-size: .88rem; font-weight: 700;
  background: linear-gradient(135deg, var(--cta-from, #5a4fe0), var(--cta-to, #7b5cf5));
  border: none; color: #fff; cursor: pointer;
  text-decoration: none; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  transition: opacity .15s;
}
.btn-print:disabled, .btn-print.locked { opacity: .35; cursor: default; }
.btn-print .lock-icon { font-size: .75rem; }
.download-hint { font-size: .72rem; color: var(--ink-faint); text-align: center; margin-top: .45rem; }

.error-wrap  { text-align: center; padding: 1.5rem 1rem; }
.error-icon  { font-size: 2.5rem; margin-bottom: .75rem; }
.error-msg   { font-size: .9rem; color: #dc2626; margin-bottom: 1.25rem; line-height: 1.5; }
.btn-retry {
  display: inline-block; padding: .7rem 2rem;
  border-radius: 12px; font-size: .95rem; font-weight: 700;
  background: rgba(29,32,48,.07);
  border: 1.5px solid rgba(29,32,48,.18);
  color: var(--ink); cursor: pointer;
}
.btn-retry:hover { background: rgba(29,32,48,.13); }

/* ── loading row (print-start) ───────────────────────────────────────────── */
.loading-row {
  display: flex; align-items: center; gap: .65rem;
  color: var(--ink-muted); font-size: .88rem;
  margin-bottom: .75rem;
}

/* ── library / print-start image list ───────────────────────────────────── */
.image-list { display: flex; flex-direction: column; gap: .85rem; margin-bottom: 1rem; }
.image-row {
  display: flex; align-items: center; gap: .85rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px; padding: .75rem;
  text-decoration: none; color: var(--ink);
  transition: background .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.image-row:hover { background: rgba(29,32,48,.04); }
.thumb {
  width: 54px; height: 54px; border-radius: 8px;
  object-fit: contain; background: rgba(29,32,48,.06); flex-shrink: 0;
}
.image-info { flex: 1; min-width: 0; }
.image-name {
  font-size: .85rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.image-status { font-size: .73rem; color: var(--ink-muted); margin-top: .2rem; }
.arrow { color: var(--ink-faint); font-size: 1rem; }

.processing-card {
  background: rgba(109,92,240,.06);
  border: 1px solid rgba(109,92,240,.20);
  border-radius: 14px; padding: 1rem 1.1rem;
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none; color: var(--ink);
  transition: background .15s;
}
.processing-card:hover { background: rgba(109,92,240,.11); }
.processing-text { flex: 1; }
.processing-text strong { font-size: .9rem; display: block; margin-bottom: .2rem; color: var(--ink); }
.processing-text span   { font-size: .78rem; color: var(--ink-muted); }

.empty-wrap { text-align: center; padding: .5rem 0 1rem; }
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; display: block; }

/* ── /p/{token} page ─────────────────────────────────────────────────────── */
.image-frame {
  width: 100%; max-width: 340px;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--card);
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
}
.image-frame img { width: 100%; height: auto; max-height: 75vh; object-fit: contain; display: block; }
.image-frame .placeholder {
  color: var(--ink-faint); font-size: .9rem; text-align: center; padding: 1rem;
}
.image-caption { font-size: .75rem; color: var(--ink-faint); text-align: center; }

.status-box {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px; padding: 1rem 1.25rem;
  text-align: center; width: 100%; max-width: 340px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.status-box .label { font-size: 1rem; font-weight: 600; color: var(--ink); }
.status-box .sub   { font-size: .8rem; color: var(--ink-muted); margin-top: .35rem; }

.section-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px; padding: 1.25rem;
  width: 100%; max-width: 340px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.section-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: .75rem; color: var(--accent, #6d5cf0); }
.section-card p  { font-size: .82rem; color: var(--ink-muted); line-height: 1.5; }
.steps { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.steps li { font-size: .84rem; display: flex; gap: .5rem; color: var(--ink); }
.steps li .num { color: var(--accent, #6d5cf0); font-weight: 700; min-width: 1.2rem; }

.upload-area {
  border: 2px dashed rgba(29,32,48,.20);
  border-radius: 12px; padding: 1.5rem 1rem;
  text-align: center; cursor: pointer;
  transition: border-color .2s; margin-bottom: .75rem;
  background: rgba(29,32,48,.03);
}
.upload-area:hover    { border-color: var(--accent, #6d5cf0); }
.upload-area.has-file { border-color: #22c55e; border-style: solid; }
.upload-area .icon { font-size: 2rem; margin-bottom: .4rem; }
.upload-area .hint { font-size: .8rem; color: var(--ink-faint); }

.inline-error {
  color: #dc2626; font-size: .82rem; text-align: center;
  background: rgba(220,38,38,.08); border-radius: 8px; padding: .6rem;
}
.download-hint-p { font-size: .75rem; color: var(--ink-faint); text-align: center; max-width: 340px; }

/* expired */
.expired-frame-wrap { opacity: .35; }
.expired-box {
  background: rgba(220,38,38,.07); border: 1px solid rgba(220,38,38,.18);
  border-radius: 16px; padding: 1.25rem; text-align: center;
  width: 100%; max-width: 340px;
}
.expired-box .label { font-size: 1rem; font-weight: 700; color: #dc2626; }
.expired-box .sub   { font-size: .82rem; color: var(--ink-muted); margin-top: .35rem; }

/* ── utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
