@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

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

:root {
  --red:        #e02020;
  --red-soft:   rgba(224, 32, 32, 0.08);
  --red-mid:    rgba(224, 32, 32, 0.18);
  --text-1:     #111318;
  --text-2:     #6b7280;
  --text-3:     #adb5bd;
  --surface:    #ffffff;
  --bg:         #f5f6f8;
  --border:     #e8eaed;
  --border-2:   #d1d5db;
  --success:    #16a34a;
  --r-sm:       8px;
  --r-md:       12px;
  --r-lg:       16px;
  --ease:       cubic-bezier(.4, 0, .2, 1);
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ──────────────────────────────────────── */
.header {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.header-brand-img {
  height: 26px;
  width: auto;
  display: none;
}

.header-brand-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
}
.header-brand-text em { color: var(--red); font-style: normal; }

.header-pipe {
  width: 1px;
  height: 16px;
  background: var(--border-2);
  flex-shrink: 0;
}

.header-title {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 400;
}

.header-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-dim {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
  color: var(--red);
  background: var(--red-soft);
  padding: 3px 9px;
  border-radius: 100px;
}

.header-by {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-by-img {
  height: 16px;
  width: auto;
  display: none;
  opacity: .7;
}

.header-by-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .2px;
}

/* ── LAYOUT ──────────────────────────────────────── */
.layout {
  display: flex;
  height: calc(100vh - 52px);
  margin-top: 52px;
}

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* ── SIDEBAR BLOCK ───────────────────────────────── */
.block {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.block:last-child { border-bottom: none; }

.block-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

/* ── FORMAT SELECTOR ─────────────────────────────── */
.fmt-group {
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--r-md);
}

.fmt-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
  color: var(--text-2);
  font-family: 'Inter', sans-serif;
}

.fmt-btn:hover { background: rgba(0,0,0,.04); }

.fmt-btn.active {
  background: var(--surface);
  color: var(--red);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.fmt-shape {
  background: currentColor;
  opacity: .35;
  border-radius: 2px;
  transition: opacity .15s;
}
.fmt-btn.active .fmt-shape { opacity: 1; }

.fmt-shape-45  { width: 16px; height: 20px; }
.fmt-shape-11  { width: 18px; height: 18px; }
.fmt-shape-916 { width: 11px; height: 20px; }

.fmt-name {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
}

.fmt-px {
  font-size: 9.5px;
  opacity: .6;
  line-height: 1;
}

/* ── UPLOAD ZONE ─────────────────────────────────── */
.upload {
  position: relative;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}

.upload:hover    { border-color: var(--red); background: var(--red-soft); }
.upload.over     { border-color: var(--red); background: var(--red-mid);  }
.upload.filled   { border-color: var(--success); border-style: solid; background: #fff; }

.upload input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-empty {
  padding: 28px 16px;
  text-align: center;
}

.upload-ico {
  width: 36px;
  height: 36px;
  background: var(--red-soft);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  transition: background .18s var(--ease);
  color: var(--red);
}
.upload:hover .upload-ico { background: var(--red-mid); }

.upload-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}
.upload-hint {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.upload-filled-inner { padding: 10px; }

.upload-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: var(--r-sm);
  display: block;
}

.upload-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.upload-filename {
  font-size: 11.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.upload-change {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--red);
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.upload-change:hover { opacity: .75; }

/* ── FIELD ───────────────────────────────────────── */
.field + .field { margin-top: 12px; }

.field-lbl {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--text-2);
  margin-bottom: 5px;
}

.field-ta {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-1);
  resize: none;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.field-ta::placeholder { color: var(--text-3); }
.field-ta:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
  background: #fff;
}

.field-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 3px;
}

.char-ct {
  font-size: 10.5px;
  color: var(--text-3);
}
.char-ct.warn   { color: #d97706; }
.char-ct.over   { color: var(--red); }

/* ── SLIDERS ─────────────────────────────────────── */
.slider-pair { display: flex; gap: 10px; align-items: center; }
.slider-pair + .slider-pair { margin-top: 10px; }

.slider-lbl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.slider-lbl { font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--text-2); }
.slider-val { font-size: 11px; font-weight: 700; color: var(--text-1); }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: var(--border-2);
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  cursor: pointer;
  transition: transform .15s var(--ease);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── BUTTONS ─────────────────────────────────────── */
.btn-dl {
  width: 100%;
  padding: 12px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .18s var(--ease), transform .15s var(--ease), box-shadow .18s var(--ease);
  box-shadow: 0 2px 12px rgba(224,32,32,.25);
  letter-spacing: -.1px;
}
.btn-dl:hover   { opacity: .9; transform: translateY(-1px); box-shadow: 0 4px 18px rgba(224,32,32,.35); }
.btn-dl:active  { transform: translateY(0); opacity: 1; }

.btn-ghost {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  margin-top: 8px;
  transition: border-color .15s, color .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-ghost:hover { border-color: var(--border-2); color: var(--text-1); background: var(--bg); }

/* ── PREVIEW PANEL ───────────────────────────────── */
.preview {
  flex: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow: auto;
  position: relative;
}

.preview-pill {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

#previewCanvas {
  display: block;
  max-height: calc(100vh - 120px);
  width: auto;
  border-radius: var(--r-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.05);
  transition: border-radius .25s var(--ease);
}

/* ── FOOTER ──────────────────────────────────────── */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 320px;
  height: 40px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
}

.footer-brand-img { height: 14px; width: auto; display: none; opacity: .55; }
.footer-brand-txt { font-size: 11px; font-weight: 700; color: var(--text-3); }
.footer-client-img { height: 13px; width: auto; display: none; opacity: .6; }
.footer-client-txt { font-weight: 700; font-size: 11px; }
.footer-client-txt em { color: var(--red); font-style: normal; }

/* ── AI ASISTAN ──────────────────────────────────── */
.ai-block { background: #fafafa; }

.block-label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ai-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  padding: 2px 7px;
  border-radius: 100px;
}

.btn-ai {
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  background: #111318;
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .18s var(--ease), transform .15s var(--ease);
  letter-spacing: -.1px;
}
.btn-ai:hover   { opacity: .82; transform: translateY(-1px); }
.btn-ai:active  { opacity: 1; transform: none; }
.btn-ai:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* Loading spinner (CSS-only) */
.btn-ai.loading svg {
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* API Key satırı */
.api-key-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.api-key-input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  color: var(--text-1);
  outline: none;
  transition: border-color .15s var(--ease);
}
.api-key-input::placeholder { color: var(--text-3); font-size: 12px; }
.api-key-input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.api-key-input.has-key { border-color: var(--success); }

.api-key-link {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  transition: border-color .15s, color .15s;
}
.api-key-link:hover { border-color: #7c3aed; color: #7c3aed; }

.api-key-hint {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 5px;
  line-height: 1.4;
}

/* AI sonuç animasyonu */
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-filled { animation: fadeSlide .3s var(--ease); }

/* ── TOAST ───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text-1);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  z-index: 10000;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── LOGIN OVERLAY ──────────────────────────────── */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #f4f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s var(--ease), visibility 0.4s;
}

.login-card {
  background: #ffffff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  width: 380px;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.login-logo {
  height: 48px;
  margin-bottom: 16px;
}

.login-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: #111;
  margin-bottom: 4px;
}
.login-title em {
  color: var(--red);
  font-style: normal;
}

.login-subtitle {
  font-size: 13.5px;
  color: var(--text-3);
  margin-bottom: 28px;
  font-weight: 500;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  text-align: center;
  transition: border-color 0.2s var(--ease);
}
.login-input:focus {
  border-color: #111;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s var(--ease);
}
.login-btn:hover {
  opacity: 0.9;
}
.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-card form {
  margin: 0;
  padding: 0;
}

.login-footer {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 30px;
  font-weight: 500;
}

/* Şifre kabul edildiğinde */
.logged-in .login-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── FLOATING AI WIDGET ─────────────────────────── */
.ai-widget-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Inter', sans-serif;
}

/* Giriş yapmayan kullanıcıdan gizle */
body:not(.logged-in) .ai-widget-container {
  display: none !important;
}

/* Yüzen Tetikleyici Kapsül Buton */
.ai-widget-trigger {
  padding: 14px 24px;
  height: auto;
  border-radius: 100px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4), 0 6px 20px rgba(124, 58, 237, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  animation: widgetFloat 3s ease-in-out infinite, widgetPulse 2s infinite;
}
.ai-widget-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 8px rgba(124, 58, 237, 0), 0 8px 24px rgba(124, 58, 237, 0.45);
  animation: widgetFloat 3s ease-in-out infinite; /* Pulse'ı durdur ama süzülmeye devam et */
  animation-play-state: paused;
}
.ai-widget-trigger:active {
  transform: translateY(0) scale(0.96);
}

@keyframes widgetFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes widgetPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5), 0 6px 20px rgba(124, 58, 237, 0.3);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(124, 58, 237, 0), 0 6px 20px rgba(124, 58, 237, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0), 0 6px 20px rgba(124, 58, 237, 0.3);
  }
}

/* Yüzen Panel */
.ai-widget-panel {
  width: 320px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.04);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: transform 0.28s var(--ease), opacity 0.28s, visibility 0.28s;
  transform-origin: bottom right;
}

/* Panel Açık Durumu */
.ai-widget-container.open .ai-widget-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Panel Header */
.ai-widget-header {
  padding: 14px 16px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-widget-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #111;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-widget-title svg {
  color: #7c3aed;
}

.ai-widget-close {
  background: none;
  border: none;
  font-size: 20px;
  font-weight: 300;
  color: var(--text-3);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.ai-widget-close:hover {
  color: #111;
}

/* Panel Body */
.ai-widget-body {
  padding: 16px;
}

.ai-widget-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-1);
  outline: none;
  resize: none;
  margin-bottom: 12px;
  background: #fafafa;
  transition: border-color 0.2s, background-color 0.2s;
}
.ai-widget-textarea:focus {
  border-color: #7c3aed;
  background: #fff;
}

