/* ========================================
   ZakatCalc — Elegant & Modern Design
   ======================================== */

:root {
  /* Color Palette */
  --bg-primary: #0a0f0d;
  --bg-secondary: #0d1512;
  --bg-tertiary: #111a17;
  --bg-card: #141e1a;
  --bg-card-hover: #1a2622;
  
  /* Surface Colors */
  --surface-1: rgba(255, 255, 255, 0.02);
  --surface-2: rgba(255, 255, 255, 0.04);
  --surface-3: rgba(255, 255, 255, 0.06);
  --surface-border: rgba(255, 255, 255, 0.06);
  
  /* Accent Colors */
  --accent-gold: #c9a227;
  --accent-gold-light: #e3be4f;
  --accent-gold-muted: rgba(201, 162, 39, 0.15);
  --accent-emerald: #2dd4a7;
  --accent-emerald-muted: rgba(45, 212, 167, 0.12);
  
  /* Text Colors */
  --text-primary: #f0f5f3;
  --text-secondary: #9aa8a2;
  --text-muted: #5e6d67;
  
  /* Semantic Colors */
  --success: #34d399;
  --success-muted: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --danger: #f87171;
  
  /* Gradients */
  --gradient-gold: linear-gradient(135deg, #c9a227 0%, #a88621 100%);
  --gradient-card: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
  
  /* Typography */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Spacing & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 40px rgba(201, 162, 39, 0.1);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(45, 212, 167, 0.05), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(201, 162, 39, 0.03), transparent);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--surface-border);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: var(--accent-gold);
  font-size: 1.5rem;
  line-height: 1;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-normal);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}

.nav-link.primary {
  background: var(--gradient-gold);
  color: #0a0f0d;
  font-weight: 600;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(201, 162, 39, 0.15);
}

.nav-link.primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(201, 162, 39, 0.25);
}

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

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

/* ========================================
   Hero Section
   ======================================== */

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 48px 0 64px;
}

.hero-content {
  max-width: 480px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent-emerald-muted);
  color: var(--accent-emerald);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 100px;
  margin-bottom: 24px;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.hero-title {
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero-title .highlight {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

/* Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--gradient-gold);
  color: #0a0f0d;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm), 0 0 20px rgba(201, 162, 39, 0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(201, 162, 39, 0.25);
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.05rem;
}

/* Nisab Hero Card */
.nisab-hero-card {
  background: var(--gradient-card);
  background-color: var(--bg-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.nisab-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.3), transparent);
}

.nisab-hero-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.nisab-hero-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold-muted);
  color: var(--accent-gold);
  border-radius: var(--radius-md);
}

.nisab-hero-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.nisab-hero-basis {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.live-indicator {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--success-muted);
  color: var(--success);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 100px;
}

.live-indicator.offline {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.nisab-hero-value {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  min-height: 52px;
}

.nisab-hero-value:not(.loaded) {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 500;
}

.nisab-hero-value.loaded {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nisab-hero-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--surface-border);
}

.nisab-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.meta-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ========================================
   Market Section
   ======================================== */

.market-section {
  padding: 48px 0;
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-icon {
  color: var(--accent-gold);
}

.section-badge {
  padding: 6px 12px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.section-badge.success {
  background: var(--success-muted);
  color: var(--success);
}

.market-group {
  margin-bottom: 32px;
}

.market-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.market-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-style: italic;
}

/* Price Grid */
.price-grid {
  display: grid;
  gap: 12px;
}

.price-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.price-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.price-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Price Card */
.price-card {
  background: var(--bg-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all var(--transition-normal);
}

.price-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.price-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.price-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
}

.price-icon.gold {
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.2), rgba(201, 162, 39, 0.1));
  color: var(--accent-gold);
}

.price-icon.silver {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
  color: #c0c0c0;
}

.price-icon.crypto {
  background: var(--surface-2);
  color: var(--text-secondary);
}

.price-icon.stock {
  background: var(--accent-emerald-muted);
  color: var(--accent-emerald);
  font-size: 0.7rem;
}

.price-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.price-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.price-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.price-value.loading {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
}

.price-value.error {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Skeleton */
.price-card.skeleton .price-value,
.price-card.skeleton .price-name {
  background: var(--surface-2);
  border-radius: 4px;
  color: transparent;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* ========================================
   CTA Section
   ======================================== */

.cta-section {
  padding: 48px 0;
}

.cta-card {
  background: var(--gradient-card);
  background-color: var(--bg-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.cta-content {
  max-width: 480px;
  margin: 0 auto 28px;
}

.cta-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.cta-desc {
  color: var(--text-secondary);
  font-size: 1rem;
}

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

.footer {
  padding: 32px 0;
  border-top: 1px solid var(--surface-border);
  margin-top: 32px;
}

.footer-content {
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.footer-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 20px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 20px;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

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

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-divider {
  opacity: 0.3;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .hero-content {
    text-align: center;
    max-width: 100%;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }

  .btn-primary {
    justify-content: center;
  }
  
  .price-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .price-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  .header {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--surface-border);
  }
  
  .nav.active {
    display: flex;
  }
  
  .nav-link {
    width: 100%;
    justify-content: center;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .hero {
    padding: 32px 0 48px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .nisab-hero-value {
    font-size: 2rem;
  }
  
  .price-grid-2,
  .price-grid-4,
  .price-grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .cta-card {
    padding: 32px 24px;
  }
}

@media (max-width: 480px) {
  .hero-badge {
    font-size: 0.7rem;
    padding: 6px 12px;
  }

  .price-grid-2,
  .price-grid-4,
  .price-grid-5 {
    grid-template-columns: 1fr;
  }
  
  .nisab-hero-footer {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 12px;
  }
  
  .footer-meta {
    flex-direction: column;
    gap: 4px;
  }
  
  .footer-divider {
    display: none;
  }
}
/* ========================================
   Additional: Loading & Error States
   ======================================== */

.price-value.loading {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.price-value.error {
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 500;
}

.price-card.error {
  opacity: 0.7;
}

.error-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.error-card p {
  color: var(--text-muted);
  margin: 0;
}

.retry-btn {
  padding: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.retry-btn:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

/* Market Status Badges */
.section-badge.success {
  background: var(--success-muted);
  color: var(--success);
}

.section-badge.warning {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

.section-badge.error {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}

/* Live Indicator States */
.live-indicator.offline {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

.live-indicator.offline .live-dot {
  animation: none;
}

/* Loading Text in Nisab Card */
.nisab-hero-value .loading-text {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 500;
}

/* Market Note */
.market-note {
  display: none; /* Sembunyikan karena sudah pakai edge function */
}