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

:root {
  --bitcoin-orange: #F7931A;
  --bitcoin-orange-hover: #E07C0A;

  /* Light mode (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);

  --success-green: #22c55e;
  --danger-red: #ef4444;
  --border-radius: 8px;
}

[data-theme="dark"] {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-card: #1f1f1f;
  --text-primary: #f5f5f5;
  --text-secondary: #999999;
  --border-color: #333333;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 100;
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

/* Header */
.header {
  text-align: center;
  padding: 2rem 0 3rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.header-content {
  margin-bottom: 2rem;
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.btc-symbol {
  color: var(--bitcoin-orange);
  font-size: 2.5rem;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.btc-price-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  max-width: 350px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.price-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.price-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--bitcoin-orange);
  margin: 0.5rem 0;
}

.price-updated {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Description */
.description {
  background: var(--bg-secondary);
  border-left: 3px solid var(--bitcoin-orange);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

.description p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.description strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Countdown Section */
.countdown-section {
  background: linear-gradient(135deg, var(--bitcoin-orange) 0%, var(--bitcoin-orange-hover) 100%);
  border-radius: var(--border-radius);
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-hover);
}

.countdown-title {
  text-align: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.countdown-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .countdown-card {
  background: rgba(31, 31, 31, 0.95);
}

.countdown-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.countdown-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--bitcoin-orange);
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 2rem 0 1rem;
  border-bottom: 2px solid var(--border-color);
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  bottom: -2px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--bitcoin-orange);
  border-bottom-color: var(--bitcoin-orange);
}

/* Wallets Grid */
.wallets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.5rem;
  margin: 1rem 0 2rem;
}

.wallet-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  cursor: pointer;
}

.wallet-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--bitcoin-orange);
}

.wallet-card.depleted {
  opacity: 0.6;
  border-color: var(--danger-red);
}

.wallet-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.wallet-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.wallet-monthly {
  font-size: 1rem;
  color: var(--bitcoin-orange);
  font-weight: 500;
}

.wallet-body {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.circular-progress {
  flex-shrink: 0;
  position: relative;
  width: 120px;
  height: 120px;
}

.circular-progress svg {
  transform: rotate(-90deg);
}

.circular-progress .progress-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 8;
}

.circular-progress .progress-bar {
  fill: none;
  stroke-width: 8;
  transition: stroke-dashoffset 0.5s ease;
  stroke-linecap: round;
}

.circular-progress .progress-bar.active {
  stroke: var(--success-green);
}

.circular-progress .progress-bar.depleted {
  stroke: var(--danger-red);
}

.circular-progress .progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  pointer-events: none;
}

.wallet-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

.stat-value.highlight {
  color: var(--bitcoin-orange);
  font-size: 1.1rem;
}

.stat-value.depleted {
  color: var(--danger-red);
}

.stat-value.projection {
  color: var(--bitcoin-orange);
  font-weight: 700;
}

.info-icon {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: help;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.info-icon:hover {
  opacity: 1;
  color: var(--bitcoin-orange);
}

.wallet-status {
  margin-top: 1rem;
  padding: 0.6rem;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.wallet-status.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success-green);
  border: 1px solid var(--success-green);
}

.wallet-status.depleted {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-red);
  border: 1px solid var(--danger-red);
}

/* Chart Section */
.chart-section {
  margin: 3rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-size: 1.5rem;
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
}

.chart-filters {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--bg-card);
  border-color: var(--bitcoin-orange);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--bitcoin-orange);
  border-color: var(--bitcoin-orange);
  color: white;
}

.chart-container {
  position: relative;
  height: 400px;
  max-height: 70vh;
}

/* Admin Section */
.admin-section {
  text-align: center;
  margin: 3rem 0;
  padding: 2rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  border: 1px dashed var(--border-color);
}

.simulation-info {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.simulation-info strong {
  color: var(--bitcoin-orange);
  font-weight: 600;
}

#simulationStatus {
  color: var(--bitcoin-orange);
  font-weight: 600;
}

.trigger-btn {
  background: var(--bitcoin-orange);
  color: white;
  border: none;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.trigger-btn:hover {
  background: var(--bitcoin-orange-hover);
  transform: translateY(-1px);
}

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

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

.trigger-info {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}


/* Footer */
.footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.footer p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.donation-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.donation-text {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-weight: 500;
}

.donation-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bitcoin-orange);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  margin: 0 auto;
}

.donation-btn:hover {
  background: var(--bitcoin-orange-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(247, 147, 26, 0.3);
}

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

.donation-btn .btc-icon {
  font-size: 1.2rem;
  font-weight: 700;
}

.donation-address {
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.copy-feedback {
  display: inline-block;
  margin-left: 1rem;
  color: var(--success-green);
  font-weight: 600;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.copy-feedback.show {
  opacity: 1;
  transform: translateX(0);
}

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

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  color: var(--text-secondary);
  font-size: 1.75rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  background: none;
  border: none;
}

.close-btn:hover {
  color: var(--bitcoin-orange);
}

.modal-body {
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.transaction-table {
  width: 100%;
  border-collapse: collapse;
}

.transaction-table th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.875rem 1.5rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.transaction-table td {
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.transaction-table tr:hover {
  background: var(--bg-secondary);
}

.transaction-table .btc-value {
  color: var(--bitcoin-orange);
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.transaction-table .usd-value {
  color: var(--success-green);
  font-weight: 600;
}

.no-transactions {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Scrollbar */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--bitcoin-orange);
}

/* Responsive */
@media (max-width: 768px) {
  .theme-toggle {
    top: 1rem;
    right: 1rem;
  }

  .title {
    font-size: 2rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .btc-symbol {
    font-size: 2rem;
  }

  .wallets-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 1rem;
  }

  .chart-container {
    height: 300px;
  }

  .modal-content {
    width: 95%;
  }

  .donation-address {
    font-size: 0.7rem;
    letter-spacing: 0.3px;
  }

  .donation-btn {
    padding: 0.6rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .copy-feedback {
    display: block;
    margin-left: 0;
    margin-top: 0.5rem;
  }
}
