/* Krealo — v5.0 Single column, clean and elegant */

:root {
  --lime: #c8f135;
  --lime-dim: #a8cc28;
  --lime-subtle: rgba(200,241,53,0.08);
  --lime-border: rgba(200,241,53,0.22);
  --surface: #0f0f0f;
  --surface-2: #181818;
  --surface-3: #202020;
  --border: rgba(255,255,255,0.07);
  --border-md: rgba(255,255,255,0.13);
  --text: #efefef;
  --text-muted: #888;
  --text-dim: #444;
  --danger: #ff5555;
  --radius: 16px;
  --radius-sm: 10px;
  --t: 0.16s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --surface:    #f0ede6;
  --surface-2:  #e8e4dc;
  --surface-3:  #dedad0;
  --border:     rgba(0,0,0,0.07);
  --border-md:  rgba(0,0,0,0.12);
  --text:       #1a1a1a;
  --text-muted: #5a5a5a;
  --text-dim:   #999;
  --lime:       #7aad00;
  --lime-dim:   #5e8800;
  --lime-subtle: rgba(122,173,0,0.1);
  --lime-border: rgba(122,173,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* TOP BAR */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,15,15,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
[data-theme="light"] .topbar { background: rgba(244,244,240,0.92); }
.topbar-inner {
  max-width: 720px; margin: 0 auto;
  padding: 0 1.5rem; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.topbar-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em;
  flex-shrink: 0;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border-md);
  background: var(--surface-2);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  transition: all var(--t); font-family: inherit;
}
.icon-btn:hover { border-color: var(--lime); color: var(--lime); }
.help-btn { color: var(--lime); border-color: var(--lime-border); }
.user-chip {
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  padding: 4px 10px; background: var(--surface-2);
  border-radius: 20px; border: 1px solid var(--border);
}
.btn-outline-sm {
  font-size: 0.78rem; font-weight: 500; padding: 6px 12px;
  border-radius: 9px; border: 1px solid var(--border-md);
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all var(--t); font-family: inherit;
}
.btn-outline-sm:hover { border-color: var(--danger); color: var(--danger); }

/* LOGO MARK */
.logo-mark {
  width: 30px; height: 30px; background: var(--lime);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-mark svg { width: 18px; height: 18px; }

/* MAIN CONTAINER — single column */
.app-container {
  max-width: 720px; margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex; flex-direction: column; gap: 1rem;
}

/* BRAND HEADER */
.brand-header {
  text-align: center; padding: 2rem 0 1rem;
}
.brand-logo-lg {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-bottom: 8px;
}
.logo-mark-lg {
  width: 48px; height: 48px; background: var(--lime);
  border-radius: 13px; display: flex; align-items: center; justify-content: center;
}
.logo-mark-lg svg { width: 28px; height: 28px; }
.brand-title { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; color: var(--text); }
.brand-sub { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* CARD */
.card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
}
.card-label {
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 12px; display: block;
}

/* PILLS */
.pill-group { display: flex; flex-wrap: wrap; gap: 7px; }
.pill-group input[type="radio"] { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 24px;
  border: 1.5px solid var(--border-md);
  background: var(--surface-3); color: var(--text-muted);
  font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; transition: all var(--t);
  white-space: nowrap; user-select: none; font-family: inherit;
}
.pill:hover { border-color: var(--lime-border); color: var(--text); }
input[type="radio"]:checked + .pill {
  background: var(--lime-subtle); border-color: var(--lime); color: var(--lime);
}
.pill-icon { width: 17px; height: 17px; flex-shrink: 0; }

/* TEXTAREA */
textarea {
  width: 100%; min-height: 100px;
  background: var(--surface-3); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 0.9rem; line-height: 1.65;
  padding: 13px 15px; resize: vertical;
  transition: border-color var(--t); outline: none;
}
textarea:focus { border-color: var(--lime); }
textarea::placeholder { color: var(--text-dim); }
.char-count { text-align: right; font-size: 0.7rem; color: var(--text-dim); margin-top: 5px; }

/* SLIDER */
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-end { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }
input[type="range"] {
  flex: 1; -webkit-appearance: none;
  height: 4px; background: var(--surface-3);
  border-radius: 2px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: var(--lime); cursor: pointer;
  box-shadow: 0 0 0 4px var(--lime-subtle); transition: box-shadow var(--t);
}
input[type="range"]::-webkit-slider-thumb:hover { box-shadow: 0 0 0 7px var(--lime-subtle); }
.tone-badge {
  text-align: center; margin-top: 8px;
  font-size: 0.78rem; font-weight: 600; color: var(--lime);
}

/* STYLE TABS */
.tab-nav {
  display: flex; gap: 4px; margin-bottom: 14px;
  background: var(--surface-3); border-radius: 12px; padding: 4px;
}
.tab-btn {
  flex: 1; padding: 8px; border-radius: 9px; border: none;
  background: transparent; color: var(--text-muted);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: all var(--t); font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--surface-2); color: var(--lime); box-shadow: 0 1px 6px rgba(0,0,0,0.3); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* PALETTE GRID */
.palette-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 7px; margin-bottom: 12px;
}
.palette-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 7px 5px; background: var(--surface-3);
  border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: all var(--t);
}
.palette-btn:hover { border-color: var(--lime); transform: translateY(-2px); }
.palette-btn.active { border-color: var(--lime); background: var(--lime-subtle); }
.palette-swatches { display: flex; gap: 3px; width: 100%; }
.palette-swatches span { flex: 1; height: 18px; border-radius: 4px; display: block; }
.palette-name { font-size: 0.62rem; color: var(--text-dim); font-weight: 500; text-align: center; }
.palette-btn.active .palette-name { color: var(--lime); }

/* COLOR CONTROLS */
.color-controls {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px; margin-top: 4px;
}
.color-field label {
  display: block; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); margin-bottom: 6px;
}
.color-row { display: flex; align-items: center; gap: 8px; }
.color-picker {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1.5px solid var(--border-md);
  padding: 2px; background: var(--surface-3); cursor: pointer;
}
.color-row span { font-size: 0.7rem; color: var(--text-muted); font-family: monospace; }

/* CANVAS CONTROLS */
.canvas-controls { display: flex; flex-direction: column; gap: 14px; }
.canvas-field label {
  display: block; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); margin-bottom: 6px;
}
.style-select {
  width: 100%; background: var(--surface-3);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.85rem; padding: 8px 11px;
  outline: none; cursor: pointer; font-family: inherit;
}
.style-select:focus { border-color: var(--lime); }

/* UPLOAD */
.bg-upload-area {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 9px; padding: 1.75rem 1rem;
  border: 1.5px dashed var(--border-md); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--t); text-align: center;
  color: var(--text-muted); font-size: 0.85rem;
}
.bg-upload-area:hover { border-color: var(--lime); color: var(--text); }
.bg-upload-area.has-image { border-style: solid; border-color: var(--lime); }
.upload-hint { font-size: 0.72rem; color: var(--text-dim); }

/* GENERATE BUTTON */
.btn-generate {
  width: 100%; padding: 16px 24px;
  background: var(--lime); color: #0a0a0a;
  border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 700; font-family: inherit;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 10px;
  transition: all var(--t); letter-spacing: -0.01em;
}
.btn-generate:hover {
  background: var(--lime-dim); transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(200,241,53,0.22);
}
.btn-generate:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.spinner {
  display: none; width: 18px; height: 18px;
  border: 2.5px solid rgba(0,0,0,0.25); border-top-color: #0a0a0a;
  border-radius: 50%; animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ERROR */
.error-box {
  display: none; align-items: flex-start; gap: 9px;
  padding: 13px 15px;
  background: rgba(255,85,85,0.07); border: 1px solid rgba(255,85,85,0.22);
  border-radius: var(--radius-sm); color: #ff8888;
  font-size: 0.85rem; line-height: 1.5;
}

/* OUTPUT SECTION */
.output-section { display: none; }
.output-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}
.output-label {
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
}
.output-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.btn-sm {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 9px;
  border: 1.5px solid var(--border-md);
  background: var(--surface-3); color: var(--text-muted);
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all var(--t);
}
.btn-sm:hover { border-color: var(--lime); color: var(--text); }
.btn-sm.copied { border-color: var(--lime); color: var(--lime); }
.btn-sm-primary {
  background: var(--lime-subtle); border-color: var(--lime-border); color: var(--lime);
}
.btn-sm-primary:hover { background: var(--lime); color: #0a0a0a; }

/* OUTPUT CONTENT */
.output-content {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  font-size: 0.9rem; line-height: 1.75; color: var(--text);
  min-height: 80px; white-space: pre-wrap;
  transition: background var(--t), color var(--t);
}
.output-body { white-space: pre-wrap; }
.output-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.hashtag-cloud { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 7px; }
.hashtag {
  font-size: 0.78rem; padding: 4px 10px; border-radius: 20px;
  border: 1px solid var(--lime-border);
  color: var(--lime); background: var(--lime-subtle);
}
.post-text { white-space: pre-wrap; line-height: 1.75; }
.cursor::after { content: '|'; animation: blink 1s infinite; color: var(--lime); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* IMAGE PREVIEW (appears only when generated) */
.image-preview-section {
  display: none; margin-top: 1rem;
}
.image-preview-label {
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 10px; display: block;
}
#livePreview {
  width: 100%; border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  display: block; cursor: pointer;
}
.preview-hint {
  text-align: center; font-size: 0.72rem;
  color: var(--text-dim); margin-top: 6px;
}

/* TIPS */
.tips {
  padding: 1.25rem 1.5rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tips-label {
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin-bottom: 10px;
}
.tip {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 0.8rem; color: var(--text-muted);
  line-height: 1.5; padding: 3px 0;
}
.tip-mark {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--lime); opacity: 0.6;
  flex-shrink: 0; margin-top: 6px;
}

/* FOOTER */
.copyright {
  text-align: center; font-size: 0.72rem;
  color: var(--text-dim); padding: 1rem 0;
}

/* MOBILE */
@media (max-width: 600px) {
  .app-container { padding: 1rem 1rem 3rem; }
  .topbar-inner { padding: 0 1rem; }
  .topbar-actions .user-chip { display: none; }
  .brand-title { font-size: 1.6rem; }
  .color-controls { grid-template-columns: 1fr 1fr; }
  .palette-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ── LANGUAGE TOGGLE BUTTONS ── */
.lang-toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--border-md);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
  user-select: none;
}
.lang-btn:hover {
  border-color: var(--lime-border);
  color: var(--text);
}
.lang-btn.active {
  background: var(--lime-subtle);
  border-color: var(--lime);
  color: var(--lime);
}
.lang-flag {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
}

/* ── LANG FLAG EMOJI ── */
.lang-flag-emoji {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}
