/* ============================================
   STATIC ADS GENERATOR — Dark UI
   ============================================ */

:root {
  --bg-base: #0a0a0f;
  --bg-panel: #111118;
  --bg-card: #1a1a24;
  --bg-input: #14141e;
  --bg-hover: #22222e;
  --border: #2a2a3a;
  --border-focus: #6c5ce7;
  --text-primary: #eeeef0;
  --text-secondary: #888899;
  --text-muted: #555566;
  --accent: #6c5ce7;
  --accent-hover: #7c6ef7;
  --accent-dim: rgba(108, 92, 231, 0.15);
  --success: #00cec9;
  --danger: #e94560;
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* ===== TOP BAR ===== */

.top-bar {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.logo svg { color: var(--accent); }

/* ===== APP LAYOUT ===== */

.app-layout {
  display: flex;
  height: calc(100vh - 52px);
}

/* ===== LEFT PANEL ===== */

.left-panel {
  width: 400px;
  min-width: 400px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* ===== FORMS ===== */

.campaign-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group > label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

input[type="text"],
textarea,
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
}

textarea {
  resize: vertical;
  min-height: 68px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ===== UPLOAD ZONES ===== */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-zone-sm {
  max-height: 100px;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.upload-zone-sm .upload-placeholder {
  padding: 16px;
  flex-direction: row;
}

.upload-placeholder svg { color: var(--text-muted); }

.upload-preview {
  padding: 8px;
  display: flex;
  justify-content: center;
}

.upload-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius);
  object-fit: contain;
}

.upload-zone-sm .upload-preview img {
  max-height: 80px;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 8px;
}

.upload-preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
}

/* ===== COLOR PICKERS ===== */

.color-row {
  display: flex;
  gap: 12px;
}

.color-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
}

input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border);
  border-radius: 4px;
}

.color-hex {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
}

/* ===== BRAND KIT ===== */

.brand-kit-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border);
}

.brand-kit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand-kit-header label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.brand-kit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.brand-kit-actions select {
  font-size: 11px;
  padding: 5px 28px 5px 8px;
  max-width: 140px;
}

.brand-kit-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== RANGE SLIDER ===== */

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-panel);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== CHECKBOX ROW ===== */

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-label-lg {
  font-size: 13px;
  font-weight: 600;
}

.video-options {
  margin-top: 8px;
  padding-left: 22px;
}

.video-options select {
  width: 100%;
}

/* ===== BUTTONS ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-sm {
  font-size: 11px;
  padding: 5px 10px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-lg {
  padding: 14px 24px;
  font-size: 15px;
  border-radius: var(--radius-lg);
}

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ===== RIGHT PANEL ===== */

.right-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-base);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ===== EMPTY STATE ===== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 60%;
  gap: 16px;
  color: var(--text-muted);
}

.empty-state svg {
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
  max-width: 320px;
}

/* ===== PROGRESS ===== */

.progress-section {
  margin-bottom: 24px;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.progress-step {
  font-weight: 600;
  color: var(--accent);
}

.progress-message {
  color: var(--text-secondary);
}

/* ===== PERSONAS ===== */

.personas-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  transition: background 0.15s;
}

.section-header:hover {
  background: var(--bg-hover);
}

.section-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.section-header .chevron {
  transition: transform 0.2s;
  color: var(--text-muted);
}

.section-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.personas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.personas-grid.collapsed {
  display: none;
}

.persona-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.persona-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.persona-card .demographic {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.persona-card .persona-detail {
  margin-bottom: 8px;
}

.persona-card .persona-detail-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.persona-card .persona-detail-value {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ===== ADS GRID ===== */

.ads-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.ad-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.ad-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.ad-card-thumb {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-card-thumb.aspect-tall {
  aspect-ratio: 9 / 16;
}

.ad-card-thumb.aspect-wide {
  aspect-ratio: 1200 / 628;
}

.ad-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-card-thumb .placeholder-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.ad-card-thumb .placeholder-thumb .headline-preview {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.ad-card-info {
  padding: 12px;
}

.ad-card-info .persona-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.ad-card-info .template-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--success);
  background: rgba(0, 206, 201, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  margin-left: 4px;
}

.ad-card-info .ad-headline {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}

.ad-card-info .ad-format {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== VIDEOS SECTION ===== */

.videos-section {
  margin-top: 32px;
}

.videos-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.video-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.video-player {
  width: 100%;
  background: #000;
}

.video-player video {
  width: 100%;
  display: block;
  max-height: 400px;
  object-fit: contain;
}

.video-card-info {
  padding: 12px;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.video-style-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: 4px;
}

.video-duration {
  font-size: 11px;
  color: var(--text-muted);
}

.video-prompt {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
    overflow: auto;
  }

  .left-panel {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .right-panel {
    overflow: visible;
  }

  body {
    overflow: auto;
  }
}
