/* Catppuccin Mocha Color Palette */
:root {
  --rosewater: #f5e0dc;
  --flamingo: #f2cdcd;
  --pink: #f5c2e7;
  --mauve: #cba6f7;
  --red: #f38ba8;
  --maroon: #eba0ac;
  --peach: #fab387;
  --yellow: #f9e2af;
  --green: #a6e3a1;
  --teal: #94e2d5;
  --sky: #89dceb;
  --sapphire: #74c7ec;
  --blue: #89b4fa;
  --lavender: #b4befe;
  --text: #cdd6f4;
  --subtext1: #bac2de;
  --subtext0: #a6adc8;
  --overlay2: #9399b2;
  --overlay1: #7f849c;
  --overlay0: #6c7086;
  --surface2: #585b70;
  --surface1: #45475a;
  --surface0: #313244;
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--base);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.header {
  padding: 2rem 0;
  border-bottom: 1px solid var(--surface1);
  background: linear-gradient(135deg, var(--mantle) 0%, var(--base) 100%);
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.header-content {
  text-align: center;
  margin-bottom: 2rem;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1.5rem;
}

.search-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.title {
  font-size: 3rem;
  font-weight: 600;
  color: var(--mauve);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.title-glyph {
  font-size: 2.5rem;
  animation: pulse 2s ease-in-out infinite;
}

.title-version {
  font-size: 1rem;
  background: var(--surface1);
  color: var(--subtext0);
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  font-weight: 400;
  margin-left: 0.5rem;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--subtext1);
  max-width: 600px;
  margin: 0 auto;
}

/* Search Styles */
.search-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.search-box {
  position: relative;
  margin-bottom: 1.5rem;
}

#search-input {
  width: 100%;
  padding: 1rem 3rem 1rem 1rem;
  font-size: 1.125rem;
  background: var(--surface0);
  border: 2px solid var(--surface1);
  border-radius: 1rem;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s ease;
}

#search-input:focus {
  outline: none;
  border-color: var(--mauve);
  box-shadow: 0 0 0 3px rgba(203, 166, 247, 0.2);
}

#search-input::placeholder {
  color: var(--overlay0);
}

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  color: var(--overlay1);
  pointer-events: none;
}

/* Filters */
.filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.875rem;
  color: var(--subtext1);
  font-weight: 500;
  white-space: nowrap;
}

.filter-select {
  padding: 0.5rem 0.75rem;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 150px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--mauve);
}

.clear-btn {
  padding: 0.5rem 1rem;
  background: var(--surface1);
  border: 1px solid var(--surface2);
  border-radius: 0.5rem;
  color: var(--subtext1);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--surface1);
  margin-bottom: 2rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--subtext1);
}

.stat-value {
  font-weight: 600;
  color: var(--green);
  font-family: 'JetBrains Mono', monospace;
}

/* Main Content */
.main {
  flex: 1;
  margin-bottom: 2rem;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  color: var(--subtext1);
}

.loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid var(--surface1);
  border-top: 3px solid var(--mauve);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

/* Character Grid */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  padding: 0.5rem 0;
}

.character-card {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.character-card:hover {
  background: var(--surface1);
  border-color: var(--mauve);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.character-char {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
  display: block;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-code {
  font-size: 0.75rem;
  color: var(--overlay1);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.25rem;
}

.character-name {
  font-size: 0.75rem;
  color: var(--subtext0);
  line-height: 1.3;
  max-height: 2.6rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 0.75rem;
}

.character-info-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--surface1);
  border: 1px solid var(--surface2);
  border-radius: 50%;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--overlay1);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  transform: scale(0.8);
}

.character-card:hover .character-info-btn {
  opacity: 1;
  transform: scale(1);
}

.character-info-btn:hover {
  background: var(--mauve);
  border-color: var(--mauve);
  color: var(--crust);
  transform: scale(1.1);
}

.character-card.copied {
  background: var(--green);
  color: var(--crust);
  transform: scale(1.05);
}

.character-card.copied .character-code,
.character-card.copied .character-name {
  color: var(--crust);
}

/* No Results */
.no-results {
  text-align: center;
  padding: 4rem 0;
  color: var(--subtext1);
}

.no-results-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.no-results h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--overlay1);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--surface1);
  color: var(--text);
}

.character-detail {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.character-large {
  font-size: 4rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--mauve);
  line-height: 1;
  flex-shrink: 0;
}

.character-info {
  flex: 1;
}

.character-info h2 {
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.character-meta {
  margin-bottom: 1.5rem;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--surface1);
}

.meta-item:last-child {
  border-bottom: none;
}

.meta-label {
  color: var(--subtext1);
  font-size: 0.875rem;
}

.meta-value {
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
}

.character-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-btn {
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface2);
  border-radius: 0.5rem;
  background: var(--surface1);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 120px;
}

.action-btn:hover {
  background: var(--surface2);
  transform: translateY(-1px);
}

.action-btn.primary {
  background: var(--mauve);
  color: var(--crust);
  border-color: var(--mauve);
}

.action-btn.primary:hover {
  background: var(--pink);
  border-color: var(--pink);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--green);
  color: var(--crust);
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 500;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  animation: toastSlide 0.3s ease-out;
  max-width: 300px;
}

.toast.error {
  background: var(--red);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--surface1);
  color: var(--subtext0);
  font-size: 0.875rem;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.footer-text {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.footer-links a {
  color: var(--subtext0);
  font-size: 1.25rem;
  transition: all 0.2s ease;
  padding: 0.5rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--mauve);
  background: var(--surface1);
  transform: translateY(-2px);
}

.footer-links a[aria-label*="Mastodon"]:hover {
  color: #6364ff;
}

.footer-links a[aria-label*="Bluesky"]:hover {
  color: #00bcd4;
}

.footer-links a[aria-label*="GitHub"]:hover {
  color: var(--text);
}

.footer-links a[aria-label*="Website"]:hover {
  color: var(--green);
}

.footer-links a[aria-label*="Podcast"]:hover {
  color: var(--peach);
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    padding: 0 1rem;
  }

  .search-container {
    padding: 0 1rem;
  }

  .main {
    padding: 0 1rem;
  }

  .stats-bar {
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .footer {
    padding: 2rem 1rem;
  }

  .footer-content {
    gap: 0.75rem;
  }

  .footer-links {
    gap: 1rem;
  }

  .footer-links a {
    font-size: 1.125rem;
    padding: 0.375rem;
  }

  .title {
    font-size: 2rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .title-version {
    margin-left: 0;
  }

  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
  }

  .character-card {
    padding: 0.75rem;
  }

  .character-char {
    font-size: 1.5rem;
    height: 2rem;
  }

  .character-name {
    margin-bottom: 0.5rem;
  }

  .character-info-btn {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.625rem;
    opacity: 1;
    transform: scale(1);
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }

  .filter-select {
    min-width: auto;
  }

  .stats-bar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .character-detail {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .character-actions {
    flex-direction: column;
  }

  .action-btn {
    min-width: auto;
  }

  .toast-container {
    top: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    max-width: none;
  }
}
