/* ============================================
   CKB Directory — Nervos Network Companion
   Theme: Emerald Forest (default)
   ============================================ */

/* CSS Variables */
:root {
  --bg: #080D0C;
  --surface: #101916;
  --surface-raised: #16221E;
  --primary: #00CC99;
  --primary-dim: rgba(0, 204, 153, 0.15);
  --primary-glow: rgba(0, 204, 153, 0.4);
  --secondary: #0F2027;
  --text: #E8F0EB;
  --text-muted: #8FA89A;
  --text-dim: #5A7568;
  --border: rgba(0, 204, 153, 0.12);
  --border-hover: rgba(0, 204, 153, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(0, 204, 153, 0.1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 960px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: #33E6B8;
}

img {
  max-width: 100%;
  display: block;
}

/* Layout */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  flex: 1;
  padding-top: 72px;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(8, 13, 12, 0.8);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.nav-brand:hover {
  color: var(--text);
}

.nav-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 12px var(--primary-glow);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 6px;
}

.nav-link {
  display: block;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--primary-dim);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Page Sections */
.page {
  animation: fadeIn 0.35s ease-out;
}

.page.hidden {
  display: none;
}

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

.page-header {
  text-align: center;
  padding: 48px 0 32px;
}

.page-title {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* Hero */
.hero {
  position: relative;
  padding: 64px 20px 48px;
  text-align: center;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.4;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
}

.hero-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  border-radius: 28px;
  box-shadow: 0 0 60px var(--primary-glow), var(--shadow);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  text-shadow: 0 0 40px var(--primary-glow);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.hero-subtitle strong {
  color: var(--primary);
  font-weight: 600;
}

/* Store Badges */
.store-badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  transition: all var(--transition);
}

.store-badge svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.store-badge div {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-align: left;
}

.store-badge small {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.store-badge span {
  font-size: 0.95rem;
}

.store-badge:hover {
  border-color: var(--border-hover);
  background: var(--surface-raised);
  color: var(--text);
}

.store-badge.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.coming-soon-note {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.action-card {
  display: block;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.action-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-raised);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  color: var(--text);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.action-icon svg {
  width: 22px;
  height: 22px;
}

.action-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.action-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Updates Section */
.updates-section {
  padding-bottom: 64px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  position: relative;
}

.title-glow {
  width: 4px;
  height: 24px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

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

.update-card {
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.update-card:hover {
  border-color: var(--border-hover);
}

.update-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.update-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.update-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Forms */
.form-card {
  max-width: 680px;
  margin: 0 auto 64px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.submit-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.form-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
}

.form-note {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #009E7A 100%);
  color: #000;
  box-shadow: 0 4px 16px rgba(0, 204, 153, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 204, 153, 0.35);
}

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

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Success State */
.form-success {
  text-align: center;
  padding: 32px 16px;
  animation: fadeIn 0.4s ease-out;
}

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.success-icon svg {
  width: 28px;
  height: 28px;
}

.form-success h3 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.form-success p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 600px;
  margin: 0 auto 32px;
}

.stat-item {
  text-align: center;
  padding: 18px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Voting Grid */
.voting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.panel-card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.panel-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.panel-card.leading {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-glow);
}

.panel-image-wrap {
  position: relative;
  width: 100%;
  padding-top: 40%; /* 800:320 = 2.5:1 aspect ratio */
  overflow: hidden;
  background: var(--bg);
}

.panel-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.panel-card:hover .panel-image {
  transform: scale(1.03);
}

.panel-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary);
  color: #000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.panel-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.panel-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.panel-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.panel-vote-bar {
  margin-bottom: 14px;
}

.vote-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 6px;
}

.vote-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), #00E6B0);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.vote-count {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.vote-count .count {
  font-weight: 600;
  color: var(--primary);
}

.vote-count .percent {
  color: var(--text-dim);
}

.panel-actions {
  margin-top: auto;
}

.btn-vote {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-vote:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

.btn-vote.voted {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
  cursor: default;
}

.btn-vote:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vote-info {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 48px;
}

.vote-info p {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.footer-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-dim);
}

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

/* Mobile */
@media (max-width: 640px) {
  .nav-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(8, 13, 12, 0.95);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 12px 20px 20px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
  }

  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-toggle {
    display: flex;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-logo {
    width: 90px;
    height: 90px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 20px 16px;
    margin: 0 -4px 48px;
    border-radius: var(--radius-sm);
  }

  .stats-bar {
    grid-template-columns: 1fr;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .voting-grid {
    gap: 14px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
