/* ==========================================================================
   NERI · Imajinasi (K-Image 2.5)
   Antarmuka tenang dan profesional: warna netral mengikuti tema aplikasi,
   garis tipis, tipografi sebagai penentu hierarki, gerak seperlunya.
   ========================================================================== */

.image-generator-page { background: var(--bg-body); }
.image-generator-page .image-gen-shell { width: min(760px, 100%); padding: 12px 24px 72px; }

/* ---------- topbar ---------- */
.image-generator-page .image-gen-topbar { margin: 2px 0 40px; padding: 0 0 14px; border-bottom: 1px solid var(--border-modal); }
.image-generator-page .image-gen-back { border: 0; border-radius: 8px; padding: 8px 10px; margin-left: -10px; background: transparent; font-size: 13px; font-weight: 500; color: var(--text-muted); transition: color .15s, background .15s; }
.image-generator-page .image-gen-back:hover { background: var(--text-hover); color: var(--text-main); }
.image-generator-page .image-gen-brand { padding: 0; border: 0; background: none; font-size: 13px; font-weight: 500; color: var(--text-muted); letter-spacing: .01em; }
.image-generator-page .image-gen-brand b { font-weight: 600; color: var(--text-main); }

/* ---------- hero ---------- */
.image-generator-page .image-gen-hero { max-width: none; margin: 0 0 28px; text-align: left; }
.image-generator-page .image-gen-eyebrow { display: block; margin: 0 0 10px; padding: 0; border: 0; background: none; font-size: 11px; font-weight: 600; letter-spacing: .09em; color: var(--text-muted); }
.image-generator-page .image-gen-hero h1 { margin: 0; font-size: clamp(26px, 4.6vw, 34px); line-height: 1.2; letter-spacing: -.02em; font-weight: 600; color: var(--text-main); background: none; -webkit-text-fill-color: currentColor; animation: none; }
.image-generator-page .image-gen-hero p { max-width: 520px; margin: 10px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--text-muted); text-align: left; }
.image-generator-page .image-gen-hero > * { animation: igFade .4s ease both; }
.image-generator-page .image-gen-hero > :nth-child(2) { animation-delay: .04s; }
.image-generator-page .image-gen-hero > :nth-child(3) { animation-delay: .08s; }
@keyframes igFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- komposer ---------- */
.image-generator-page .image-gen-workspace { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.imagine-composer { border: 1px solid var(--border-modal); border-radius: 16px; background: var(--bg-input-wrapper); transition: border-color .18s, box-shadow .18s; animation: igFade .4s .12s ease both; }
.imagine-composer:hover { border-color: var(--text-muted); }
.imagine-composer:focus-within { border-color: var(--text-muted); box-shadow: 0 0 0 3px rgba(128,128,128,.14); }
.imagine-composer-inner { padding: 14px 14px 12px; }

.imagine-attach-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.imagine-attach-row.is-empty { display: none; }
.imagine-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 6px 4px 4px; border: 1px solid var(--border-modal); border-radius: 9px; background: var(--bg-body); font-size: 12.5px; font-weight: 500; color: var(--text-main); animation: igFade .2s ease both; }
.imagine-chip img { display: block; width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.imagine-chip .sw { width: 28px; height: 28px; border-radius: 6px; background: linear-gradient(90deg, var(--g1) 50%, var(--g2) 50%); filter: saturate(.75); }
.imagine-chip button { width: 20px; height: 20px; border: 0; border-radius: 5px; padding: 0; font-size: 15px; line-height: 1; cursor: pointer; color: var(--text-muted); background: transparent; transition: background .15s, color .15s; }
.imagine-chip button:hover { background: var(--text-hover); color: var(--text-main); }

.image-generator-page .image-gen-workspace textarea,
.imagine-composer textarea { display: block; box-sizing: border-box; width: 100%; min-height: 52px; max-height: 220px; resize: none; border: 0; border-radius: 0; padding: 2px 2px 8px; background: transparent; color: var(--text-main); font: inherit; font-size: 15px; line-height: 1.55; outline: none; box-shadow: none; }
.imagine-composer textarea::placeholder { color: var(--text-muted); opacity: .75; }

.imagine-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.imagine-tool-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--border-modal); border-radius: 9px; background: transparent; color: var(--text-main); font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; }
.imagine-tool-btn svg { width: 16px; height: 16px; flex: none; }
.imagine-tool-btn:hover { background: var(--text-hover); }
.imagine-tool-btn.has-photo { border-color: var(--text-main); }
.imagine-spacer { flex: 1; }
.imagine-toolbar #imageGenCharCount { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.image-generator-page .image-gen-create-btn.imagine-send { display: grid; place-items: center; flex: none; width: 36px; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 10px; background: var(--text-main); color: var(--bg-body); box-shadow: none; transition: opacity .15s, transform .15s; }
.imagine-send svg { width: 17px; height: 17px; }
.image-generator-page .image-gen-create-btn.imagine-send:hover { opacity: .85; transform: none; filter: none; }
.image-generator-page .image-gen-create-btn.imagine-send:active { transform: scale(.96); }
.imagine-send.is-idle { opacity: .28; }
.image-generator-page .image-gen-create-btn.imagine-send.is-idle:hover { opacity: .28; }

.imagine-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; min-height: 18px; margin: 10px 2px 0; }
.imagine-meta .imagine-photo-hint { flex: 1; margin: 0; text-align: left; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.image-generator-page .imagine-error { order: 2; color: #d64545; font-size: 12.5px; }
.imagine-error:empty { display: none; }
.imagine-meta:has(.imagine-error:not(:empty)) .imagine-photo-hint { display: none; }
.imagine-error { animation: igFade .2s ease both; }

/* ---------- galeri gaya ---------- */
.imagine-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 40px 0 14px; padding-top: 20px; border-top: 1px solid var(--border-modal); }
.imagine-section-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-main); }
.imagine-section-hint { font-size: 12.5px; color: var(--text-muted); }
.image-generator-page .imagine-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
@media (min-width: 560px) { .image-generator-page .imagine-grid { grid-template-columns: repeat(3, 1fr); } }

.image-generator-page .imagine-tile { position: relative; display: flex; flex-direction: column; gap: 12px; aspect-ratio: auto; padding: 12px 12px 14px; border: 1px solid var(--border-modal); border-radius: 12px; overflow: visible; background: var(--bg-input-wrapper); color: var(--text-main); text-align: left; box-shadow: none; cursor: pointer; transform: none; -webkit-tap-highlight-color: transparent; animation: igFade .35s ease both; animation-delay: calc(var(--i, 0) * 18ms + 120ms); transition: border-color .15s, background .15s; }
.imagine-tile:hover, .imagine-tile:focus-visible { border-color: var(--text-muted); background: var(--text-hover); transform: none; box-shadow: none; outline: none; }
.imagine-tile:focus-visible { box-shadow: 0 0 0 3px rgba(128,128,128,.25); }
.imagine-tile:active { transform: none; }
.imagine-tile-sw { display: block; height: 40px; border-radius: 7px; background: linear-gradient(90deg, var(--g1) 50%, var(--g2) 50%); filter: saturate(.7); }
.imagine-tile-text { display: block; min-width: 0; }
.image-generator-page .imagine-tile-label { position: static; display: block; padding: 0; background: none; text-shadow: none; text-align: left; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--text-main); }
.imagine-tile-desc { display: block; margin-top: 3px; font-size: 12px; line-height: 1.4; color: var(--text-muted); }
.imagine-tile-check { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 700; color: var(--bg-body); background: var(--text-main); opacity: 0; transform: scale(.7); transition: opacity .15s, transform .15s; }
.imagine-tile.is-selected { border-color: var(--text-main); box-shadow: 0 0 0 1px var(--text-main); background: var(--bg-input-wrapper); }
.imagine-tile.is-selected .imagine-tile-check { opacity: 1; transform: none; }

.image-generator-page .image-gen-privacy-note { margin: 28px 0 0; text-align: left; font-size: 12px; color: var(--text-muted); }

@media (max-width: 600px) {
  .image-generator-page .image-gen-shell { padding: 8px 16px 48px; }
  .image-generator-page .image-gen-topbar { margin-bottom: 28px; }
  .imagine-tool-btn .lbl { display: none; }
  #imaginePhotoBtn { width: 34px; padding: 0; justify-content: center; }
  .imagine-section-hint { display: none; }
}
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }


/* ==========================================================================
   Loading gambar di chat: bingkai kosong dengan kilau halus + status
   ========================================================================== */
.img-loading-card { max-width: 340px; gap: 10px; padding: 8px 0 12px; animation: igFade .3s ease both; }
.img-loading-canvas { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-modal); background: var(--bg-input-wrapper); box-shadow: none; }
.img-loading-canvas::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(128,128,128,.16) 50%, transparent 70%); background-size: 250% 100%; animation: igSkel 2.4s ease-in-out infinite; }
@keyframes igSkel { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.img-loading-info { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-muted); }
.img-loading-status { animation: none; font-weight: 500; color: var(--text-main); }
.img-loading-status.swap { animation: igFade .3s ease both; }
.img-loading-time { font-variant-numeric: tabular-nums; opacity: .8; font-size: 12px; }
.img-loading-prompt { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }


/* ==========================================================================
   Hasil gambar: muncul dengan fade singkat
   ========================================================================== */
.gen-image-card.img-reveal img { animation: igReveal .6s ease both; }
@keyframes igReveal { from { opacity: 0; filter: blur(10px); } to { opacity: 1; filter: none; } }


/* ---------- hormati preferensi gerak ---------- */
@media (prefers-reduced-motion: reduce) {
  .image-gen-hero > *, .imagine-composer, .imagine-tile, .imagine-chip, .imagine-error,
  .img-loading-card, .img-loading-canvas::after, .img-loading-status.swap, .gen-image-card.img-reveal img { animation: none !important; }
}
