/*
 * GlomaxGPT — Image Studio CSS
 * ============================================================
 * Glomax token sistemi (glomax-theme-tokens.css) üzerine inşa edildi.
 * Bu dosya image-gen.php'ye özel tüm stilleri kapsar.
 * Yükleme sırası: gx-chatgpt-ui.css'den SONRA yüklenmeli.
 * ============================================================
 */

/* ============================================================
   1. LAYOUT — Ana iskelet
   ============================================================ */

.ig-main {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
  background: var(--bg-main);
}

/* Yıldız canvas — dekoratif arka plan */
.ig-stars-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

[data-theme="light"] .ig-stars-canvas {
  opacity: 0.08;
}

/* Tüm içerik canvas'ın üstünde */
.ig-active-bar,
.ig-bg-active-banner,
.ig-template-strip,
.ig-messages,
.ig-input-wrapper {
  position: relative;
  z-index: 1;
}

/* ============================================================
   2. MISAFIR BANNER
   ============================================================ */

.ig-guest-banner {
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.06);
  border-bottom: 1px solid rgba(99, 102, 241, 0.18);
  padding: 0 20px;
}

.ig-guest-banner-inner {
  max-width: var(--gx-content-max, 860px);
  margin: 0 auto;
  padding: 9px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ig-guest-banner p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  margin: 0;
}

.ig-guest-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--primary-bg);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.ig-guest-banner-btn:hover {
  opacity: 0.88;
}

/* ============================================================
   3. AKTİF GÖRSEL BAR
   ============================================================ */

.ig-active-bar {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: rgba(99, 102, 241, 0.07);
  border-bottom: 1px solid rgba(99, 102, 241, 0.18);
}

.ig-active-bar.visible {
  display: flex;
}

.ig-active-bar-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  cursor: zoom-in;
  flex-shrink: 0;
  border: 1px solid var(--border-default);
}

.ig-active-bar-info {
  flex: 1;
  min-width: 0;
}

.ig-active-bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.ig-active-bar-prompt {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ig-active-bar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ig-active-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent, #6366f1);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.ig-active-bar-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
}

/* Arka plan banner */
.ig-bg-active-banner {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  background: rgba(16, 185, 129, 0.08);
  border-bottom: 1px solid rgba(16, 185, 129, 0.18);
  font-size: 0.78rem;
  color: var(--color-success, #10b981);
}

.ig-bg-active-banner.visible {
  display: flex;
}

/* ============================================================
   4. TEMPLATE STRIP
   ============================================================ */

.ig-template-strip {
  flex-shrink: 0;
  padding: 14px 0 0;
}

.ig-template-strip-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 20px 8px;
  max-width: var(--gx-content-max, 860px);
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.ig-template-strip-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ig-template-strip-all {
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  transition: color 0.15s;
  padding: 0;
}

.ig-template-strip-all:hover {
  color: var(--text-secondary);
}

.ig-template-strip-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ig-template-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}

.ig-template-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ig-template-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 20px 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ig-template-scroll::-webkit-scrollbar {
  display: none;
}

.ig-template-card {
  flex-shrink: 0;
  width: 108px;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  background: var(--bg-surface);
}

.ig-template-card:hover {
  border-color: rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.ig-template-card.active {
  border-color: var(--accent, #6366f1);
}

.ig-template-card img {
  width: 108px;
  height: 108px;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.ig-template-card:hover img {
  transform: scale(1.05);
}

.ig-template-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 14px 6px 5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   5. MESAJLAR ALANI
   ============================================================ */

.ig-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0 12px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ig-messages:has(> .ig-welcome:only-child) {
  justify-content: center;
}

.ig-messages::-webkit-scrollbar {
  width: 4px;
}

.ig-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ig-messages::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.22);
  border-radius: 3px;
}

/* ── Mesaj satırı ── */
.ig-msg-row {
  width: 100%;
  max-width: var(--gx-content-max, 860px);
  margin-left: auto;
  margin-right: auto;
  padding: 4px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ig-msg-row.user {
  align-items: flex-end;
}

.ig-msg-row.assistant {
  align-items: flex-start;
}

/* ── Kullanıcı balonu ── */
.ig-bubble-user {
  max-width: 76%;
  background: var(--user-bubble-bg, #1e1e2e);
  border: 1px solid var(--user-bubble-border, rgba(99, 102, 241, 0.25));
  color: var(--text-primary);
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

[data-theme="light"] .ig-bubble-user {
  background: var(--user-bubble-bg, #eef0ff);
  border-color: var(--user-bubble-border, rgba(99, 102, 241, 0.18));
}

/* ── AI balonu ── */
.ig-bubble-ai,
.ig-card {
  max-width: 88%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 4px 18px 18px 18px;
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-primary);
  word-break: break-word;
}

/* ── Üretim kartı ── */
.ig-gen-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ig-gen-card .ig-gen-progress {
  background: var(--bg-elevated);
}

.ig-gen-card .ig-gen-title {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
}

.ig-gen-card .ig-gen-step {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

/* ── Aksiyon kartı ── */
.ig-action-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  animation: igCardIn 0.28s ease both;
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .ig-action-card {
  background: #fff;
  box-shadow: var(--shadow-sm);
}

@keyframes igCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Üretilmiş görselin kartı içinde tam genişlik */
.ig-action-card img {
  max-width: 100%;
  border-radius: 10px;
  display: block;
}

/* ── Aksiyon butonları ── */
.ig-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent, #6366f1);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.ig-action-btn:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.6);
  color: var(--accent-purple, #8b5cf6);
}

/* ============================================================
   6. WELCOME EKRANI
   ============================================================ */

.ig-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 48px 24px 32px;
  text-align: center;
  overflow-y: auto;
  min-height: 0;
  gap: 0;
  -webkit-overflow-scrolling: touch;
}

.ig-welcome-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.ig-welcome-logo {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--accent-soft);
}

.ig-welcome-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.ig-welcome-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.ig-welcome h1 {
  font-size: 1.85rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
}

.ig-welcome-sub {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
  max-width: 440px;
}

/* ── Öneri kartları ── */
.ig-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 600px;
  margin: 24px auto 0;
}

.ig-suggestion-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.ig-suggestion-card:hover {
  background: var(--bg-elevated);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Renk varyantları */
.ig-sc-color-1 { border-color: rgba(245, 158, 11, 0.2); }
.ig-sc-color-1:hover { border-color: rgba(245, 158, 11, 0.45); box-shadow: 0 4px 16px rgba(245, 158, 11, 0.1); }
.ig-sc-color-1 .ig-suggestion-thumb { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: #f59e0b; }

.ig-sc-color-2 { border-color: rgba(99, 102, 241, 0.2); }
.ig-sc-color-2:hover { border-color: rgba(99, 102, 241, 0.45); box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1); }
.ig-sc-color-2 .ig-suggestion-thumb { background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(99, 102, 241, 0.3); color: #6366f1; }

.ig-sc-color-3 { border-color: rgba(236, 72, 153, 0.2); }
.ig-sc-color-3:hover { border-color: rgba(236, 72, 153, 0.45); box-shadow: 0 4px 16px rgba(236, 72, 153, 0.1); }
.ig-sc-color-3 .ig-suggestion-thumb { background: rgba(236, 72, 153, 0.15); border: 1px solid rgba(236, 72, 153, 0.3); color: #ec4899; }

.ig-sc-color-4 { border-color: rgba(16, 185, 129, 0.2); }
.ig-sc-color-4:hover { border-color: rgba(16, 185, 129, 0.45); box-shadow: 0 4px 16px rgba(16, 185, 129, 0.1); }
.ig-sc-color-4 .ig-suggestion-thumb { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: #10b981; }

.ig-suggestion-thumb {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ig-suggestion-thumb svg {
  width: 15px;
  height: 15px;
}

.ig-suggestion-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ig-suggestion-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ig-suggestion-sub {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.ig-suggestion-arrow {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-muted);
  align-self: center;
}

/* ============================================================
   8. INPUT ALANI
   ============================================================ */

.ig-input-wrapper {
  flex-shrink: 0;
  width: 100%;
  padding: 8px 20px max(16px, env(safe-area-inset-bottom, 16px));
  background: transparent;
  box-sizing: border-box;
}

.ig-input-area {
  width: 100%;
  max-width: var(--gx-composer-max, 780px);
  margin: 0 auto;
  background: var(--bg-input);
  border: 1.5px solid var(--border-default);
  border-radius: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: visible;
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.ig-input-area:focus-within {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), var(--shadow-sm);
}

[data-theme="light"] .ig-input-area {
  background: #fff;
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .ig-input-area:focus-within {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08), var(--shadow-sm);
}

/* Cooldown overlay input içinde gizli */
.ig-input-area .ig-cooldown-overlay {
  display: none !important;
}

/* Ek görsel önizleme */
.ig-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 0;
}

.ig-attach-preview:empty {
  display: none;
}

.ig-attach-thumb {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  flex-shrink: 0;
}

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

.ig-attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: none;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Input satırı ── */
.ig-input-box {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ig-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

#ig-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  resize: none;
  max-height: 160px;
  overflow-y: auto;
  padding: 2px 0;
}

#ig-input::placeholder {
  color: var(--text-placeholder, #666);
  opacity: 1;
}

#ig-input::-webkit-scrollbar {
  width: 3px;
}

#ig-input::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

/* ── Satır içi butonlar (ataç, mikrofon) ── */
.ig-attach-inline-btn,
.ig-mic-inline-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}

.ig-attach-inline-btn:hover,
.ig-mic-inline-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Gönder butonu ── */
.ig-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.12s;
}

[data-theme="dark"] .ig-send-btn,
html:not([data-theme="light"]) .ig-send-btn {
  background: #e0e0e0;
  color: #111;
}

[data-theme="light"] .ig-send-btn {
  background: #111;
  color: #fff;
}

.ig-send-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.ig-send-btn:not(:disabled):hover {
  opacity: 0.88;
  transform: scale(1.06);
}

/* ── Durdur butonu ── */
.ig-stop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-error, #ef4444);
  border: 1px solid rgba(239, 68, 68, 0.28);
  cursor: pointer;
  transition: background 0.15s;
}

.ig-stop-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ── Seçenekler çubuğu ── */
.ig-options-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 10px;
  flex-wrap: wrap;
}

.ig-options-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ig-options-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: visible;
  flex-wrap: wrap;
}

.ig-options-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Seçenek butonları ── */
.ig-opt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
  padding: 0;
}

.ig-opt-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ig-opt-btn.active {
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent, #6366f1);
}

/* ── Seçenek pill butonlar ── */
.ig-opt-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 20px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.73rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-family: inherit;
}

.ig-opt-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.ig-opt-pill.active {
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent, #6366f1);
  border-color: rgba(99, 102, 241, 0.3);
}

.ig-opt-pill.bg-active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success, #10b981);
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .ig-opt-pill {
  background: #f5f5f7;
  border-color: var(--border-default);
  color: var(--text-secondary);
}

[data-theme="light"] .ig-opt-pill:hover {
  background: #ebebef;
  color: var(--text-primary);
}

/* Kamera butonu */
.ig-cam-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-family: inherit;
}

.ig-cam-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ── Upload aksiyon grubu ── */
.ig-upload-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   9. DROPDOWN
   ============================================================ */

.ig-dropdown-wrap {
  position: relative;
  display: inline-flex;
}

.ig-dropdown {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 6px;
  min-width: 210px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.ig-dropdown.open {
  display: flex;
}

[data-theme="light"] .ig-dropdown {
  background: #fff;
  box-shadow: var(--shadow-md);
}

.ig-dropdown-label {
  padding: 6px 10px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ig-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border: none;
  background: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}

.ig-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ig-dropdown-item.selected {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent, #6366f1);
}

/* ── Boyut grid ── */
.ig-size-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
}

.ig-size-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
}

.ig-size-item:hover {
  background: var(--bg-hover);
}

.ig-size-item.selected {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.28);
}

.ig-size-preview {
  background: var(--border-strong);
  border-radius: 3px;
  flex-shrink: 0;
}

.ig-size-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ig-size-ratio {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ── Arka plan şehir butonu ── */
.ig-bg-city-btn {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ig-bg-city-btn:hover {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent, #6366f1);
  border-color: rgba(99, 102, 241, 0.32);
}

.ig-bg-city-btn.selected {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success, #10b981);
  border-color: rgba(16, 185, 129, 0.32);
}

/* ============================================================
   10. COOLDOWN OVERLAY
   ============================================================ */

.ig-cooldown-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.ig-cooldown-overlay.hidden {
  display: none !important;
}

.ig-cooldown-ring {
  position: relative;
  width: 68px;
  height: 68px;
}

.ig-cooldown-ring svg {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.ig-cooldown-ring .track {
  fill: none;
  stroke: var(--bg-surface);
  stroke-width: 5;
}

.ig-cooldown-ring .progress {
  fill: none;
  stroke: var(--accent, #6366f1);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.ig-cooldown-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ig-cooldown-msg {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ig-cooldown-upgrade {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--primary-bg);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.ig-cooldown-upgrade:hover {
  opacity: 0.85;
}

/* ============================================================
   11. LİGHTBOX
   ============================================================ */

.ig-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: zoom-out;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ig-lightbox.open,
.ig-lightbox.active {
  display: flex;
}

.ig-lightbox img {
  max-width: min(90vw, 900px);
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  object-fit: contain;
}

.ig-lightbox-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.ig-lightbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: inherit;
}

.ig-lightbox-btn:hover {
  background: rgba(99, 102, 241, 0.35);
  border-color: rgba(99, 102, 241, 0.6);
}

/* ============================================================
   12. MASK MODAL
   ============================================================ */

.ig-mask-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.82);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ig-mask-modal.open {
  display: flex;
}

.ig-mask-inner {
  background: var(--bg-elevated);
  border-radius: 16px;
  overflow: hidden;
  max-width: 90vw;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default);
}

[data-theme="light"] .ig-mask-inner {
  background: #fff;
}

.ig-mask-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.ig-mask-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.ig-mask-tool-btn:hover,
.ig-mask-tool-btn.active {
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent, #6366f1);
  border-color: rgba(99, 102, 241, 0.32);
}

.ig-mask-canvas-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.ig-mask-canvas-wrap canvas {
  position: absolute;
  top: 0;
  left: 0;
}

.ig-mask-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

/* ============================================================
   13. GEÇMİŞ PANELİ
   ============================================================ */

.ig-history-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  max-width: 90vw;
  height: 100dvh;
  z-index: 99980;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-default);
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.28s var(--anim-smooth, cubic-bezier(0.4, 0, 0.2, 1));
  transform: translateX(100%);
}

.ig-history-panel.open {
  display: flex;
  transform: translateX(0);
}

[data-theme="light"] .ig-history-panel {
  background: rgba(255, 255, 255, 0.97);
  border-color: var(--border-default);
}

.ig-history-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.ig-history-hdr h3 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ig-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ig-history-list::-webkit-scrollbar {
  width: 3px;
}

.ig-history-list::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 2px;
}

/* ============================================================
   14. DRAG OVERLAY
   ============================================================ */

.ig-drag-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ig-drag-overlay.active {
  display: flex;
}

/* ============================================================
   15. YARDIMCI ANIMASYONLAR
   ============================================================ */

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes igFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes igSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Dönen yükleme ikonu */
.ig-spin {
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   16. MOBİL — max-width: 768px
   ============================================================ */

@media (max-width: 768px) {
  .ig-main {
    flex: 1 1 0;
    overflow: hidden;
    min-height: 0;
  }

  .ig-messages {
    padding: 12px 0 8px;
  }

  .ig-msg-row {
    padding: 4px 12px;
  }

  .ig-input-wrapper {
    padding: 6px 12px max(12px, env(safe-area-inset-bottom, 12px));
  }

  .ig-input-area {
    border-radius: 20px;
  }

  .ig-input-row {
    padding: 8px 10px;
  }

  #ig-input {
    font-size: 16px; /* iOS zoom önleme */
  }

  .ig-send-btn,
  .ig-stop-btn {
    width: 32px;
    height: 32px;
  }

  .ig-welcome {
    padding: 28px 16px 20px;
  }

  .ig-welcome h1 {
    font-size: 1.45rem;
  }

  .ig-welcome-sub {
    font-size: 0.85rem;
  }

  .ig-suggestion-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
    margin-top: 16px;
  }

  .ig-active-bar {
    padding: 6px 12px;
    gap: 8px;
  }

  .ig-active-bar-img {
    width: 32px;
    height: 32px;
  }

  .ig-active-bar-actions {
    gap: 4px;
  }

  .ig-active-bar-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .ig-history-panel {
    width: 100%;
  }

  .ig-template-strip {
    padding: 10px 0 0;
  }

  .ig-template-strip-hdr {
    padding: 0 12px 6px;
  }

  .ig-template-scroll {
    padding: 0 12px 10px;
    gap: 6px;
  }

  .ig-template-card {
    width: 88px;
  }

  .ig-template-card img {
    width: 88px;
    height: 88px;
  }

  /* Pill metinleri küçük ekranda gizle */
  .ig-opt-pill span {
    display: none;
  }

  .ig-opt-pill {
    padding: 0 8px;
  }
}

@media (max-width: 400px) {
  .ig-template-card {
    width: 72px;
  }

  .ig-template-card img {
    width: 72px;
    height: 72px;
  }

  .ig-bubble-user {
    max-width: 90%;
  }
}

/* ============================================================
   17. KÜÇÜK EKRANLARDA QUOTA BAR DÜZELTMESİ
   ============================================================ */

/* ============================================================
   18. HAREKET AZALTMA
   ============================================================ */

/* ============================================================
   19. WELCOME V2 — Alt başlıklar
   ============================================================ */

.ig-welcome-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 24px 20px;
  text-align: center;
}

.ig-welcome-v2-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.15;
}

[data-theme="light"] .ig-welcome-v2-title {
  color: #111;
}

.ig-welcome-v2-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 560px;
}

.ig-welcome-v2-sub {
  display: inline-flex;
  align-items: center;
  padding: 4px 13px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: default;
}

[data-theme="light"] .ig-welcome-v2-sub {
  background: #f5f5f7;
  color: #555;
  border-color: rgba(0,0,0,0.10);
}

@media (max-width: 640px) {
  .ig-welcome-v2 { padding: 28px 16px 14px; }
  .ig-welcome-v2-title { font-size: 1.65rem; }
  .ig-welcome-v2-sub { font-size: 0.73rem; padding: 3px 10px; }
}

/* ============================================================
   20. HAREKET AZALTMA
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .ig-template-card,
  .ig-suggestion-card,
  .ig-action-card {
    animation: none !important;
    transition: none !important;
  }
}
