/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --bg:           #f5f5f7;
  --surface:      #ffffff;
  --surface-2:    #f9f9fb;
  --border:       #e5e5ea;
  --border-focus: #6366f1;

  --text:         #1c1c1e;
  --text-2:       #6c6c70;
  --text-3:       #aeaeb2;

  --primary:      #6366f1;
  --primary-h:    #4f46e5;
  --primary-fg:   #ffffff;

  --meta-blue:    #1877f2;
  --meta-h:       #1465d8;

  --danger:       #ef4444;
  --success:      #22c55e;
  --warning:      #f59e0b;

  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    6px;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  --nav-h:        60px;
  --sidebar-w:    280px;
  --transition:   0.2s ease;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
textarea, input, select { font-family: inherit; font-size: inherit; }

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-ghost    { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-meta     { background: var(--meta-blue); color: #fff; }
.btn-meta:hover:not(:disabled) { background: var(--meta-h); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-sm       { padding: 5px 10px; font-size: 13px; }
.btn-lg       { padding: 11px 22px; font-size: 15px; }
.btn-icon-sm  {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--radius-xs);
  background: transparent; border: none; color: var(--text-2);
  transition: all var(--transition);
}
.btn-icon-sm:hover { background: var(--border); color: var(--text); }
.btn-generate {
  padding: 11px 24px; font-size: 15px; font-weight: 600;
  border-radius: var(--radius-sm);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--border-focus); }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.form-hint  { font-size: 12px; color: var(--text-3); margin-top: 4px; display: block; }
.form-group { display: flex; flex-direction: column; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.required   { color: var(--danger); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}
.navbar-brand { display: flex; align-items: center; }
.navbar-center { flex: 1; display: flex; justify-content: center; }
.navbar-right  { display: flex; align-items: center; gap: 12px; }

.usage-indicator { display: flex; align-items: center; gap: 10px; }
.usage-bar {
  width: 120px; height: 6px;
  background: var(--border);
  border-radius: 99px; overflow: hidden;
}
.usage-fill {
  height: 100%; background: var(--primary);
  border-radius: 99px; transition: width 0.4s ease;
}
.usage-text { font-size: 12px; color: var(--text-2); white-space: nowrap; }

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-name-nav { font-size: 13px; font-weight: 500; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  margin-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-height: calc(100vh - var(--nav-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--nav-h);
  align-self: flex-start;
  max-height: calc(100vh - var(--nav-h));
  overflow: hidden;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
.variations-list { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar-empty { padding: 24px 8px; text-align: center; color: var(--text-3); font-size: 13px; }

.saved-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 2px;
  position: relative;
}
.saved-item:hover { background: var(--surface-2); }
.saved-item-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-item-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.saved-item-actions { display: flex; gap: 4px; margin-top: 8px; }
.saved-item-actions .btn { padding: 3px 8px; font-size: 11px; }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   GENERATOR SECTION
   ============================================================ */
.generator-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}
.generator-header { margin-bottom: 20px; }
.generator-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.generator-header p  { color: var(--text-2); font-size: 14px; }

.textarea-wrapper { position: relative; margin-bottom: 12px; }
.textarea-wrapper textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14px;
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--transition);
  color: var(--text);
}
.textarea-wrapper textarea:focus { border-color: var(--border-focus); background: var(--surface); }
.textarea-wrapper textarea::placeholder { color: var(--text-3); }
.char-count {
  position: absolute; bottom: 10px; right: 12px;
  font-size: 11px; color: var(--text-3);
}

.generator-actions { display: flex; gap: 12px; align-items: center; }
.form-select {
  width: auto; flex-shrink: 0; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 14px; outline: none; cursor: pointer;
}
.form-select:focus { border-color: var(--border-focus); }

.btn-spinner { flex-shrink: 0; }

/* ============================================================
   VARIATIONS GRID
   ============================================================ */
.results-section { animation: fadeInUp 0.3s ease; }
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.results-header h2 { font-size: 18px; font-weight: 700; }

.variations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* AD PREVIEW CARD */
.ad-preview-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  animation: fadeInUp 0.4s ease both;
  display: flex;
  flex-direction: column;
}
.ad-preview-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.ad-image-wrapper {
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}
.ad-image-wrapper img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.ad-preview-card:hover .ad-image-wrapper img { transform: scale(1.03); }
.ad-image-placeholder {
  width: 100%; aspect-ratio: 1/1;
  background: linear-gradient(135deg, #f0f0f5 0%, #e8e8ef 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 28px; gap: 6px;
}
.ad-image-placeholder small { font-size: 11px; }

.img-loading-state {
  width: 100%; aspect-ratio: 1/1;
  background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text-3); font-size: 13px;
}
.img-spinner { font-size: 20px; }

/* Skeleton loading */
.skeleton {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.skeleton-wave::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.7) 50%, transparent 100%);
  animation: wave 1.6s ease infinite;
}
@keyframes wave {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ad-content { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ad-name      { font-size: 11px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; }
.ad-headline  { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; }
.ad-subheadline { font-size: 13px; font-weight: 500; color: var(--text-2); }
.ad-body      { font-size: 13px; color: var(--text-2); line-height: 1.5; flex: 1; }
.ad-cta-preview {
  display: inline-block;
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 4px;
}

.ad-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.ad-actions .btn { flex: 1; justify-content: center; font-size: 12px; padding: 7px 10px; }

/* ============================================================
   TARGETING SUGGESTION
   ============================================================ */
.targeting-suggestion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.targeting-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.targeting-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }
.t-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3   { font-size: 18px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.empty-state p    { font-size: 14px; }

/* ============================================================
   REGION PICKER
   ============================================================ */
.region-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.region-picker-header .form-label { margin-bottom: 0; }
.region-picker-actions { display: flex; gap: 6px; }

.region-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.region-grid::-webkit-scrollbar { width: 4px; }
.region-grid::-webkit-scrollbar-track { background: transparent; }
.region-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.region-pill {
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.region-pill:hover   { border-color: var(--primary); color: var(--primary); }
.region-pill.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.region-loading {
  width: 100%;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 12px 0;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-lg { max-width: 680px; }

.view-variation-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.view-variation-image img {
  width: 100%; border-radius: var(--radius-sm); object-fit: cover;
}
.view-variation-content { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 540px) {
  .view-variation-layout { grid-template-columns: 1fr; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px;
  animation: slideUp 0.2s ease;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.modal-body {
  overflow-y: auto;
  flex: 1;
}
.modal-sm { max-width: 360px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title  { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.modal-close  {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer; transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body   { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.modal-info {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px; background: #eff6ff; border-radius: var(--radius-sm);
  font-size: 13px; color: #1d4ed8; line-height: 1.5;
}
.modal-info svg { flex-shrink: 0; margin-top: 1px; stroke: #3b82f6; }

/* ============================================================
   COUNTRY PICKER
   ============================================================ */
.country-picker {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 6px 8px;
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  cursor: text;
  transition: border-color var(--transition);
}
.country-picker:focus-within { border-color: var(--border-focus); }

.country-tags { display: contents; }

.country-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: #fff;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.country-tag-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
}
.country-tag-remove:hover { color: #fff; }

.country-search-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  min-width: 120px;
  flex: 1;
  padding: 2px 4px;
  font-family: inherit;
}
.country-search-input::placeholder { color: var(--text-3); }

.country-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 500;
  max-height: 200px;
  overflow-y: auto;
  list-style: none;
  padding: 4px 0;
}
.country-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition);
}
.country-option:hover,
.country-option.focused { background: var(--surface-2); }
.country-option .c-code {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.25s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }
.toast.info    { background: #1e3a5f; }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; }
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 60px;
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo    { margin-bottom: 24px; }
.login-title   { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.login-subtitle { font-size: 14px; color: var(--text-2); margin-bottom: 24px; line-height: 1.6; }

.login-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.feature-item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.feature-icon { font-size: 18px; }

.btn-meta-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px;
  background: var(--meta-blue); color: #fff;
  border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  transition: background var(--transition);
}
.btn-meta-login:hover { background: var(--meta-h); }
.login-note { text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-3); }

.login-preview {
  flex: 1; max-width: 440px;
  display: flex; align-items: center; justify-content: center;
}
.preview-mockup { position: relative; }
.mockup-card {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-lg); width: 220px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.mockup-card.offset-card {
  position: absolute; top: 30px; left: 60px;
  z-index: -1; opacity: 0.7;
  transform: scale(0.96);
}
.mockup-img       { height: 110px; border-radius: var(--radius-sm); background: var(--surface-2); position: relative; overflow: hidden; }
.mockup-content   { display: flex; flex-direction: column; gap: 6px; }
.mockup-title     { height: 14px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; }
.mockup-text      { height: 10px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; }
.mockup-cta       { height: 28px; border-radius: 99px; background: var(--surface-2); position: relative; overflow: hidden; margin-top: 4px; }
.skeleton-wave    { position: relative; overflow: hidden; }

/* ============================================================
   PUBLIC VIEW PAGE
   ============================================================ */
.public-view-page { background: var(--bg); }
.public-view-container { max-width: 680px; margin: 0 auto; padding: 24px 20px 60px; }
.public-view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.public-created-by { font-size: 13px; color: var(--text-2); }
.ad-preview-card.public { max-width: 480px; margin: 0 auto; }
.public-targeting { padding: 16px; border-top: 1px solid var(--border); }
.targeting-label  { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.targeting-pills  { display: flex; flex-wrap: wrap; gap: 6px; }
.public-cta       { text-align: center; margin-top: 32px; }
.public-cta p     { color: var(--text-2); margin-bottom: 14px; font-size: 14px; }

/* ============================================================
   SKELETON CARDS (loading state)
   ============================================================ */
.skeleton-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.skeleton-img  { aspect-ratio: 1/1; background: var(--surface-2); position: relative; overflow: hidden; }
.skeleton-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 12px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .variations-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 16px; }
  .variations-grid { grid-template-columns: 1fr; }
  .generator-actions { flex-direction: column; }
  .form-select, .btn-generate { width: 100%; justify-content: center; }
  .usage-indicator { display: none; }
  .login-preview { display: none; }
}

/* ============================================================
   IMAGE OVERLAY  (CSS gradient + headline/CTA text)
   ============================================================ */
.img-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(6, 8, 24, 0.82) 100%);
  padding: 36px 12px 12px;
  pointer-events: none;
}
.img-overlay-headline {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.img-overlay-cta {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}

/* ============================================================
   IMAGE ACTION BUTTONS  (zoom + change – hover-reveal)
   ============================================================ */
.img-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--transition);
}
.ad-image-wrapper:hover .img-actions { opacity: 1; }

.img-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: none;
  transition: background var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  user-select: none;
  backdrop-filter: blur(4px);
}
.img-action-btn:hover  { background: rgba(99, 102, 241, 0.85); }
.img-zoom-btn { padding: 5px 7px; }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: lb-fade-in 0.18s ease;
}
@keyframes lb-fade-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox-overlay.hidden { display: none !important; }
.lightbox-overlay img {
  max-width: min(90vw, 840px);
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 12px 60px rgba(0,0,0,0.7);
  cursor: default;
  animation: lb-scale-in 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes lb-scale-in { from { transform: scale(0.88); opacity:0; } to { transform: scale(1); opacity:1; } }
.lightbox-close {
  position: absolute;
  top: 18px; right: 22px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  font-size: 18px;
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 20px 24px;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--primary); }
.footer-sep { color: var(--border); }

/* ============================================================
   LOGIN LEGAL LINKS
   ============================================================ */
.login-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
}
.login-legal a { color: var(--text-2); }
.login-legal a:hover { color: var(--primary); }
.login-legal span { color: var(--border); }

/* ============================================================
   LEGAL PAGES
   ============================================================ */
.legal-page { max-width: 780px; margin: 0 auto; padding: 48px 24px 80px; }
.legal-page h1 { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.legal-page .legal-meta { font-size: 13px; color: var(--text-2); margin-bottom: 40px; }
.legal-page h2 { font-size: 16px; font-weight: 700; margin: 32px 0 10px; }
.legal-page p, .legal-page li { font-size: 14px; color: var(--text-2); line-height: 1.75; }
.legal-page ul { padding-left: 20px; margin: 8px 0; }
.legal-page a { color: var(--primary); text-decoration: underline; }
.legal-nav { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.legal-nav a { font-size: 13px; color: var(--text-2); }
.legal-nav a:hover { color: var(--primary); }
