@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1025 50%, #0d1117 100%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 20% 20%, rgba(120, 0, 255, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0, 200, 255, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 40% 60%, rgba(255, 0, 128, 0.08) 0%, transparent 30%);
  animation: bgFloat 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, 2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

.exchange-rate {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.95rem;
  margin-bottom: 20px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.rate-label {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

#current-rate {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  font-size: 1.1rem;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 25px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.tabs {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 6px;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab {
  padding: 14px 36px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.info-bar p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-weight: 500;
}

.last-update, .last-update-etc {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
  font-weight: 500;
}

.price-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.price-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.price-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(8px) scale(1.01);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.coin-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.coin-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stock-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.us-stock-icon {
  background: linear-gradient(135deg, #0052cc, #0077b6, #00b4d8);
  box-shadow: 0 4px 15px rgba(0, 82, 204, 0.3);
}

.sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.sub-tab {
  padding: 10px 28px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.sub-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.sub-tab.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.metal-icon {
  background: linear-gradient(135deg, #ffd700, #ffb347, #f4a460);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
  font-size: 1.2rem;
}

.oil-icon {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  box-shadow: 0 4px 15px rgba(15, 52, 96, 0.4);
  font-size: 1.3rem;
}

.index-icon {
  background: linear-gradient(135deg, #00b894, #00cec9, #0984e3);
  box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
  font-size: 1.2rem;
}

.coin-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
}

.coin-symbol {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.price-info {
  text-align: right;
}

.price {
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.01em;
}

.price-usd {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
  margin-top: 2px;
}

.change {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-block;
}

.change.up {
  color: #00ff88;
  background: rgba(0, 255, 136, 0.1);
}

.change.down {
  color: #ff4757;
  background: rgba(255, 71, 87, 0.1);
}

.loading {
  text-align: center;
  padding: 60px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.loading::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.notice {
  text-align: center;
  padding: 50px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  color: rgba(255, 255, 255, 0.6);
}

.notice p {
  margin: 10px 0;
}

.notice a {
  color: #818cf8;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.notice a:hover {
  color: #a5b4fc;
}

footer {
  text-align: center;
  margin-top: 50px;
  padding: 25px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-main {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.footer-sub {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile */
@media (max-width: 600px) {
  .container {
    padding: 20px 15px;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.9rem;
  }

  .price-item {
    padding: 14px 16px;
    border-radius: 16px;
  }

  .coin-icon, .stock-icon {
    width: 38px;
    height: 38px;
  }

  .coin-info {
    gap: 12px;
  }

  .coin-name {
    font-size: 0.95rem;
  }

  .price {
    font-size: 1rem;
  }
}

/* Glow effects */
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.5); }
}

/* ============================================
   상세 페이지 (차트)
   ============================================ */

#detail-view {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 25px;
  text-align: left;
}

.back-btn {
  align-self: flex-start;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-4px);
}

.detail-coin-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px;
}

.detail-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.detail-symbol {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-price-info {
  display: flex;
  align-items: baseline;
  gap: 15px;
}

.detail-price {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.detail-change {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 10px;
}

.detail-change.up {
  color: #00ff88;
  background: rgba(0, 255, 136, 0.1);
}

.detail-change.down {
  color: #ff4757;
  background: rgba(255, 71, 87, 0.1);
}

.chart-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.chart-period {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-period:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.chart-period.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

#chart-container {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 15px;
  margin-bottom: 25px;
  min-height: 380px;
  width: 100%;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

/* Mobile - Detail */
@media (max-width: 600px) {
  .detail-name {
    font-size: 1.4rem;
  }

  .detail-price {
    font-size: 1.8rem;
  }

  .detail-icon {
    width: 48px;
    height: 48px;
  }

  .chart-controls {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart-period {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  #chart-container {
    padding: 10px;
    border-radius: 16px;
  }

  .detail-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-item {
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .stat-label {
    margin-bottom: 0;
  }
}
