/* PromptPalette – Daily Art Ideas */
:root {
  --bg: #f8f6ff;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #5a5a7a;
  --accent: #6B4EFF;
  --accent-hover: #5a3ee6;
  --accent-soft: rgba(107, 78, 255, 0.12);
  --border: #e8e6f0;
  --success: #2a9d8f;
  --shadow: 0 4px 20px rgba(26, 26, 46, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --surface: #252540;
  --text: #f0eef6;
  --text-muted: #a0a0b8;
  --accent: #8b7aff;
  --accent-hover: #9d8cff;
  --accent-soft: rgba(139, 122, 255, 0.2);
  --border: #3a3a52;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* Header */
.header {
  padding: 1.5rem 0;
  position: relative;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.theme-toggle {
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.theme-icon {
  display: none;
}

[data-theme="light"] .theme-icon.sun,
[data-theme="dark"] .theme-icon.moon {
  display: block;
}

[data-theme="dark"] .theme-icon.sun,
body:not([data-theme]) .theme-icon.moon {
  display: none;
}

body:not([data-theme]) .theme-icon.sun {
  display: block;
}

/* Main */
.main {
  flex: 1;
}

.controls {
  margin-bottom: 1.5rem;
}

.prompt-type label:first-child {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.radio-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s;
}

.radio-wrap:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.radio-wrap input {
  margin: 0;
  accent-color: var(--accent);
}

.radio-wrap input:checked + span {
  font-weight: 600;
}

.type-options input:checked ~ span,
.radio-wrap:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn-icon {
  padding: 0.5rem;
  font-size: 1.25rem;
  min-width: 44px;
  min-height: 44px;
}

/* Prompt card */
.prompt-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
}

.prompt-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

.prompt-placeholder strong {
  color: var(--text);
}

.prompt-content.hidden {
  display: none;
}

.prompt-placeholder.hidden {
  display: none;
}

.prompt-words {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.prompt-theme {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.prompt-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.color-swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 2px solid var(--border);
  background: var(--surface);
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.prompt-medium {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.prompt-medium strong {
  color: var(--text);
}

.prompt-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.favorite-btn.saved {
  opacity: 1;
}

.favorite-btn:not(.saved) {
  opacity: 0.6;
}

.favorite-btn:hover,
.favorite-btn.saved {
  opacity: 1;
}

/* Favorites */
.favorites h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.favorites-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.favorites-list:empty::after {
  content: 'No favorites yet. Save prompts with the heart button.';
  color: var(--text-muted);
  font-size: 0.9rem;
}

.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.fav-item-text {
  flex: 1;
  min-width: 0;
}

.fav-item-actions {
  display: flex;
  gap: 0.25rem;
}

.fav-item-actions button {
  padding: 0.35rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.fav-item-actions button:hover {
  background: var(--accent-soft);
}

/* Footer */
.footer {
  margin-top: auto;
  padding-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer p {
  margin: 0;
}

/* Loading */
.loading .prompt-placeholder,
.loading .prompt-content {
  opacity: 0.6;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 480px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .theme-toggle {
    margin-left: 0;
  }

  .type-options {
    flex-direction: column;
  }

  .radio-wrap {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .prompt-words {
    font-size: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
