:root {
  --bg-primary: #0d0d14;
  --bg-secondary: #16161f;
  --bg-card: #1c1c28;
  --bg-card-hover: #232333;
  --border: #2a2a3d;
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #5c5c75;
  --accent-primary: #9b59b6;
  --accent-secondary: #e91e63;
  --accent-gradient: linear-gradient(135deg, #9b59b6 0%, #e91e63 100%);
  --success: #10b981;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 400px;
  background: radial-gradient(ellipse at 50% 0%, rgba(155, 89, 182, 0.1) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo .highlight {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.prompt-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 25px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(155, 89, 182, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(155, 89, 182, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.large {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.625rem 1.25rem;
  border-radius: 25px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.filters-section {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.search-container {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 0.75rem 1.25rem;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.search-container:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15);
}

.search-container svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-container input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

.search-container input::placeholder {
  color: var(--text-muted);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.filter-pill.favorites.active {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.category-select {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
}

.category-select:focus {
  border-color: var(--accent-primary);
}

.main-content {
  flex: 1;
  padding: 0 1.5rem 3rem;
}

.prompts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .prompts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .prompts-grid {
    grid-template-columns: 1fr;
  }
}

.prompt-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  animation: cardFadeIn 0.5s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.prompt-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(155, 89, 182, 0.3);
}

.card-image-container {
  position: relative;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.prompt-card:hover .card-image {
  transform: scale(1.05);
}

.card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.heart-btn {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.heart-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.heart-btn.filled {
  animation: heartPop 0.3s ease;
}

@keyframes heartPop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.category-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  border-radius: 12px;
  color: white;
}

.card-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
}

.prompt-card:hover .card-actions {
  opacity: 1;
  transform: translateY(0);
}

.action-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  color: white;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.action-btn.copied {
  background: var(--success);
}

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.6);
}

.card-content {
  padding: 1rem;
}

.prompt-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.empty-state, .no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.empty-state p, .no-results p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.no-results span {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.modal-body {
  padding: 1.5rem;
}

.prompt-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-field textarea,
.form-field input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  transition: all 0.2s ease;
}

.form-field textarea:focus,
.form-field input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15);
}

.form-field textarea {
  min-height: 120px;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.category-pill {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 0.875rem;
  border-radius: 16px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-pill:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.category-pill.active {
  color: white;
  border-color: transparent;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.footer {
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--accent-primary);
}

.copy-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-weight: 500;
  animation: toastPop 0.5s ease;
  z-index: 2000;
}

@keyframes toastPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
}

@media (max-width: 640px) {
  .header {
    padding: 1rem;
  }
  
  .logo h1 {
    font-size: 1.25rem;
  }
  
  .prompt-count {
    display: none;
  }
  
  .btn-primary span {
    display: none;
  }
  
  .btn-primary {
    padding: 0.625rem;
    border-radius: 50%;
  }
  
  .filters-section {
    padding: 1rem;
  }
  
  .main-content {
    padding: 0 1rem 2rem;
  }
  
  .modal-content {
    max-height: 100vh;
    border-radius: 20px 20px 0 0;
    position: absolute;
    bottom: 0;
    max-width: 100%;
  }
}