/**
 * MTG Keyword Lookup - Styles
 * Arcane Lexicon Theme
 */

/* ========================================
   Base Styles
   ======================================== */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0a12 0%, #1a1a2e 50%, #0f0f1a 100%);
  font-family: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', serif;
  overflow-x: hidden;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

/* ========================================
   Background Effects
   ======================================== */

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147,112,219,0.8) 0%, transparent 70%);
  box-shadow: 0 0 10px rgba(147,112,219,0.5);
  animation: float linear infinite;
}

@keyframes float {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

.glow-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150vmax;
  height: 150vmax;
  background: radial-gradient(circle, rgba(75,0,130,0.1) 0%, transparent 50%);
  pointer-events: none;
}

/* ========================================
   Header
   ======================================== */

header {
  text-align: center;
  margin-bottom: 32px;
}

.header-icon {
  font-size: 48px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(147,112,219,0.5));
}

h1 {
  font-size: clamp(24px, 6vw, 36px);
  font-weight: 700;
  color: #e8e4f0;
  margin: 0 0 8px 0;
  letter-spacing: 3px;
  text-shadow: 0 0 30px rgba(147,112,219,0.5), 0 2px 4px rgba(0,0,0,0.5);
}

.subtitle {
  font-size: 14px;
  color: rgba(200, 190, 220, 0.7);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin: 0;
}

/* ========================================
   Search Box
   ======================================== */

.search-container {
  position: relative;
  margin-bottom: 24px;
}

.search-wrapper {
  position: relative;
  background: linear-gradient(135deg, rgba(30,30,50,0.9) 0%, rgba(20,20,35,0.95) 100%);
  border-radius: 16px;
  padding: 4px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  border: 1px solid rgba(147,112,219,0.2);
}

.search-inner {
  display: flex;
  align-items: center;
  background: rgba(15,15,25,0.8);
  border-radius: 12px;
  padding: 0 16px;
}

.search-icon {
  font-size: 20px;
  margin-right: 12px;
  opacity: 0.6;
}

#search-input {
  flex: 1;
  padding: 18px 0;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: #e8e4f0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

#search-input::placeholder {
  color: rgba(200,190,220,0.4);
}

.clear-btn {
  background: rgba(147,112,219,0.2);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: #c8bef0;
  font-size: 14px;
  display: none;
  align-items: center;
  justify-content: center;
}

.clear-btn.visible {
  display: flex;
}

/* ========================================
   Loading Spinner
   ======================================== */

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(147,112,219,0.3);
  border-top-color: rgba(147,112,219,0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

.spinner.visible {
  display: block;
}

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

/* ========================================
   Dropdown Results
   ======================================== */

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: linear-gradient(135deg, rgba(30,30,50,0.98) 0%, rgba(20,20,35,0.99) 100%);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  border: 1px solid rgba(147,112,219,0.2);
  z-index: 100;
  display: none;
}

.dropdown.visible {
  display: block;
}

.dropdown-item {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(147,112,219,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
  text-align: left;
}

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

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(147,112,219,0.1);
  outline: none;
}

.dropdown-item:focus {
  background: rgba(147,112,219,0.2);
}

.dropdown-item-name {
  color: #e8e4f0;
  font-size: 16px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
}

.dropdown-item-type {
  color: rgba(200,190,220,0.6);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========================================
   Keyword Card
   ======================================== */

.keyword-card {
  animation: fadeIn 0.4s ease-out;
  display: none;
}

.keyword-card.visible {
  display: block;
}

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

.card-inner {
  background: linear-gradient(135deg, rgba(30,30,50,0.95) 0%, rgba(20,20,35,0.98) 100%);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 50px rgba(0,0,0,0.5);
  border: 1px solid rgba(147,112,219,0.3);
}

.card-header {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.card-header-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30z' fill='rgba(255,255,255,0.03)'/%3E%3C/svg%3E");
  opacity: 0.5;
}

.card-header-content {
  position: relative;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.card-title {
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card-type-icon {
  font-size: 28px;
}

.card-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  background: rgba(0,0,0,0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge.evergreen {
  background: rgba(0,115,62,0.4);
}

.card-body {
  padding: 24px;
}

.section {
  margin-bottom: 20px;
}

.section:last-child {
  margin-bottom: 0;
}

.section-label {
  font-size: 11px;
  color: rgba(200,190,220,0.6);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  font-weight: 600;
}

.section-text {
  font-size: 15px;
  line-height: 1.7;
  color: #e8e4f0;
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.reminder-box {
  background: rgba(147,112,219,0.1);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  border-left: 3px solid rgba(147,112,219,0.5);
}

.reminder-text {
  font-size: 14px;
  font-style: italic;
  color: rgba(200,190,220,0.8);
  margin: 0;
  line-height: 1.6;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.color-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-tag {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.example-text {
  font-size: 14px;
  color: rgba(220,210,240,0.9);
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.source-link {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(147,112,219,0.2);
  font-size: 12px;
  color: rgba(200,190,220,0.5);
}

.source-link a {
  color: rgba(147,112,219,0.7);
  text-decoration: none;
}

.source-link a:hover {
  color: rgba(147,112,219,1);
}

/* ========================================
   Search Results Page
   ======================================== */

.search-results {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.search-results.visible {
  display: block;
}

.results-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(147,112,219,0.2);
}

.results-title {
  font-size: 20px;
  color: #e8e4f0;
  margin: 0 0 8px 0;
  font-weight: 600;
}

.results-count {
  font-size: 14px;
  color: rgba(200,190,220,0.6);
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card {
  background: linear-gradient(135deg, rgba(30,30,50,0.9) 0%, rgba(20,20,35,0.95) 100%);
  border-radius: 16px;
  padding: 16px 20px;
  cursor: pointer;
  border: 1px solid rgba(147,112,219,0.2);
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.result-card:hover {
  background: linear-gradient(135deg, rgba(40,40,60,0.95) 0%, rgba(30,30,45,0.98) 100%);
  border-color: rgba(147,112,219,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.result-card-name {
  font-size: 18px;
  font-weight: 600;
  color: #e8e4f0;
  font-family: 'Cinzel', serif;
}

.result-card-type {
  font-size: 12px;
  color: rgba(200,190,220,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-card-preview {
  font-size: 14px;
  color: rgba(200,190,220,0.7);
  line-height: 1.5;
  font-family: 'Segoe UI', system-ui, sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-card-colors {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.result-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ========================================
   Back Button
   ======================================== */

.back-button {
  background: rgba(147,112,219,0.15);
  border: 1px solid rgba(147,112,219,0.3);
  border-radius: 12px;
  padding: 10px 16px;
  color: rgba(200,190,220,0.9);
  cursor: pointer;
  font-size: 14px;
  font-family: 'Cinzel', serif;
  transition: all 0.2s;
  margin-bottom: 16px;
  display: none;
}

.back-button.visible {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.back-button:hover {
  background: rgba(147,112,219,0.3);
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: rgba(200,190,220,0.5);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  filter: grayscale(50%);
  opacity: 0.5;
}

.empty-text {
  font-size: 16px;
  line-height: 1.6;
  max-width: 280px;
  margin: 0 auto;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.empty-text strong {
  color: rgba(147,112,219,0.8);
}

/* ========================================
   No Results
   ======================================== */

.no-results {
  text-align: center;
  padding: 48px 24px;
  color: rgba(200,190,220,0.5);
  display: none;
}

.no-results.visible {
  display: block;
}

.no-results-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-results-text {
  font-size: 16px;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.no-results-term {
  color: rgba(147,112,219,0.8);
}

/* ========================================
   Popular Keywords
   ======================================== */

.popular-section {
  margin-top: 32px;
}

.popular-title {
  font-size: 11px;
  color: rgba(200,190,220,0.5);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
  text-align: center;
}

.popular-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.popular-tag {
  background: rgba(147,112,219,0.15);
  border: 1px solid rgba(147,112,219,0.3);
  border-radius: 20px;
  padding: 10px 18px;
  color: rgba(200,190,220,0.9);
  cursor: pointer;
  font-size: 14px;
  font-family: 'Cinzel', serif;
  transition: all 0.2s;
  text-transform: capitalize;
}

.popular-tag:hover {
  background: rgba(147,112,219,0.3);
  transform: translateY(-2px);
}

/* ========================================
   Error Message
   ======================================== */

.error-message {
  background: rgba(211, 32, 42, 0.2);
  border: 1px solid rgba(211, 32, 42, 0.4);
  border-radius: 12px;
  padding: 16px;
  color: #ff8888;
  text-align: center;
  display: none;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.error-message.visible {
  display: block;
}

/* ========================================
   Footer
   ======================================== */

footer {
  text-align: center;
  padding: 32px 16px;
  color: rgba(200,190,220,0.4);
  font-size: 12px;
}

footer a {
  color: rgba(147,112,219,0.6);
  text-decoration: none;
}

footer a:hover {
  color: rgba(147,112,219,1);
}
