:root {
  --bg-dark: #0a0e1a;
  --bg-card: #12172b;
  --text-cream: #f4e8d0;
  --text-dim: #a89979;
  --accent-gold: #d4af37;
  --accent-glow: #ffd700;
  --border: #2a3345;
}

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

body {
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1234 100%);
  color: var(--text-cream);
  min-height: 100vh;
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(100, 50, 200, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, rgba(18, 23, 43, 0.9) 0%, rgba(18, 23, 43, 0.5) 100%);
  border-radius: 20px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.title {
  font-family: 'Crimson Pro', serif;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}

.tagline {
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: var(--text-dim);
  font-weight: 200;
  letter-spacing: 1px;
}

.stats {
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--accent-gold);
  font-weight: 300;
}

.main-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 20px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 15px;
  border: 1px solid var(--border);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.sidebar-title {
  font-family: 'Crimson Pro', serif;
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--accent-gold);
  font-weight: 600;
}

.filter-section {
  margin-bottom: 20px;
}

.filter-section label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.filter-select {
  width: 100%;
  padding: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-cream);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
  outline: none;
}

.main-content {
  background: var(--bg-card);
  padding: 30px;
  border-radius: 15px;
  border: 1px solid var(--border);
  min-height: 600px;
}

.search-container {
  margin-bottom: 30px;
}

.search-modes {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.mode-btn {
  flex: 1;
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.mode-btn:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.search-form {
  display: flex;
  gap: 10px;
}

.search-input {
  flex: 1;
  padding: 15px 20px;
  background: var(--bg-dark);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-cream);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}

.search-input::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

.btn-search,
.btn-primary {
  padding: 15px 30px;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b8941f 100%);
  border: none;
  border-radius: 12px;
  color: var(--bg-dark);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-search:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(212, 175, 55, 0.5);
}

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

.email-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.email-card {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.5s ease;
}

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

.email-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.1), transparent);
  transition: left 0.5s ease;
}

.email-card:hover::before {
  left: 100%;
}

.email-card:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 5px 20px rgba(212, 175, 55, 0.2);
  transform: translateY(-2px);
}

.email-card.expanded {
  border-color: var(--accent-gold);
  box-shadow: 0 10px 40px rgba(212, 175, 55, 0.3);
}

.email-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.email-from {
  font-weight: 700;
  color: var(--accent-gold);
  font-size: 0.9rem;
}

.email-timestamp {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: 'Crimson Pro', serif;
}

.email-subject {
  font-family: 'Crimson Pro', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-cream);
}

.email-preview {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 10px;
}

.email-preview.loading {
  font-style: italic;
  opacity: 0.7;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.4; }
}

.email-coordinate {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.email-full {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--accent-gold);
  animation: expandDown 0.3s ease;
}

@keyframes expandDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

.email-detail-header {
  margin-bottom: 20px;
  font-size: 0.9rem;
  line-height: 1.8;
}

.email-detail-header strong {
  color: var(--accent-gold);
}

.email-body {
  line-height: 1.8;
  margin-bottom: 20px;
}

.email-body p {
  margin-bottom: 15px;
  color: var(--text-cream);
}

.email-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-secondary {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: 8px;
  color: var(--accent-gold);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.load-trigger {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-style: italic;
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
}

.footer {
  text-align: center;
  padding: 30px 20px;
  background: var(--bg-card);
  border-radius: 15px;
  border: 1px solid var(--border);
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.8;
}

.footer p {
  margin-bottom: 10px;
}

.footer-links {
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.footer-links a:hover {
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.disclaimer {
  font-style: italic;
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .sidebar {
    position: static;
  }
  
  .main-content {
    padding: 20px;
  }
  
  .search-form {
    flex-direction: column;
  }
  
  .btn-search {
    width: 100%;
  }
}