/* App Container */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Header */
.header {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid rgba(184, 134, 11, 0.08);
  position: relative;
  z-index: 10;
  animation: fadeIn 0.8s ease-out;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(184, 134, 11, 0.1);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-700), var(--gold-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.last-update {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Header Info */
.header-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
}

/* Live Indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.65rem;
  color: var(--gold-700);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  background: rgba(184, 134, 11, 0.08);
  border-radius: var(--radius-full);
  border: 1px solid rgba(184, 134, 11, 0.12);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-success);
  border-radius: var(--radius-full);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 8px var(--accent-success);
  }

  50% {
    opacity: 0.6;
    box-shadow: 0 0 4px var(--accent-success);
  }
}

.live-indicator.paused .live-dot {
  animation: none;
  opacity: 0.4;
  background: var(--text-muted);
}

.live-indicator.paused .live-text {
  color: var(--text-muted);
}

/* Main Content */
.main {
  flex: 1;
  padding: var(--space-md) var(--space-lg) var(--space-xl);
  position: relative;
  z-index: 5;
}

/* Price Card */
.price-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(184, 134, 11, 0.12);
  box-shadow: var(--shadow-elevated);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.price-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
}

.price-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.price-value {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-700), var(--gold-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.price-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 1rem;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
}

.price-change.positive {
  color: var(--accent-success);
  background: rgba(45, 122, 62, 0.08);
}

.price-change.negative {
  color: var(--accent-danger);
  background: rgba(197, 48, 48, 0.08);
}

.price-change.neutral {
  color: var(--text-secondary);
  background: rgba(107, 99, 89, 0.08);
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg,
      var(--bg-tertiary) 0%,
      var(--bg-secondary) 50%,
      var(--bg-tertiary) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-sm);
}

.skeleton-price {
  height: 3.5rem;
  width: 70%;
  margin-bottom: var(--space-md);
}

/* Calculator Section */
.calculator-section {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(184, 134, 11, 0.08);
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--gold-700);
}

.input-group {
  margin-bottom: var(--space-lg);
}

.input-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.input-field {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid rgba(184, 134, 11, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.08);
  background: var(--bg-card);
}

.input-field:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-unit {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--bg-tertiary);
}

.result-row:first-child {
  border-top: none;
  padding-top: 0;
}

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

.result-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gold-600);
}

.result-value.small {
  font-size: 1.125rem;
  color: var(--text-primary);
}

.result-value.big {
  font-size: 1.7rem;
  color: var(--gold-600);
}

/* Time Period Selector */
.period-selector {
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.period-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.period-button {
  background: var(--bg-card);
  border: 1px solid rgba(184, 134, 11, 0.12);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.period-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.period-button:hover:not(:disabled) {
  border-color: var(--gold-500);
  color: var(--gold-600);
  background: var(--bg-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.15);
}

.period-button.active {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border-color: var(--gold-500);
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--gold-glow);
  transform: translateY(-1px);
}

.period-button.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-full);
}

.period-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Custom Period */
.custom-period {
  margin-top: var(--space-md);
  animation: fadeInUp 0.6s ease-out 0.35s both;
}

.custom-period-wrapper {
  display: flex;
  gap: var(--space-sm);
}

/* Chart Container */
.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(184, 134, 11, 0.08);
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.chart-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--text-primary);
}

.chart-canvas {
  width: 100%;
  height: auto;
  min-height: 200px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Simple Chart */
.simple-chart {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.stat {
  text-align: center;
  padding: var(--space-md);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-tertiary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gold-600);
}

.stat-value.positive {
  color: var(--accent-success);
}

.stat-value.negative {
  color: var(--accent-danger);
}

.chart-visual {
  width: 100%;
  height: 120px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--bg-tertiary);
}

.chart-line-svg {
  width: 100%;
  height: 100%;
}

.chart-price-display {
  text-align: center;
  padding: var(--space-md);
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.08), rgba(184, 134, 11, 0.04));
  border-radius: var(--radius-md);
  border: 1px solid rgba(184, 134, 11, 0.15);
}

.chart-price-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.chart-price-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-700), var(--gold-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Footer */
.footer {
  padding: var(--space-lg);
  text-align: center;
  border-top: 1px solid rgba(184, 134, 11, 0.08);
  background: var(--bg-secondary);
  position: relative;
  z-index: 10;
}

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

.footer-link {
  color: var(--gold-600);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Refresh Button */
.refresh-button {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border: none;
  border-radius: var(--radius-full);
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  transition: all 0.3s ease;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-button:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(184, 134, 11, 0.35);
}

.refresh-button:active {
  transform: scale(0.95);
}

.refresh-button.loading {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Error State */
.error-state {
  text-align: center;
  padding: var(--space-xl);
  animation: fadeIn 0.5s ease-out;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.error-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--accent-danger);
  margin-bottom: var(--space-sm);
}

.error-message {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: var(--space-lg);
}

.retry-button {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-xl);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.retry-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--gold-glow);
}

/* Responsive */
@media (max-width: 480px) {
  .price-value {
    font-size: 2.75rem;
  }

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

  .result-value {
    font-size: 1.25rem;
  }

  .chart-canvas {
    height: 160px;
  }
}

/* PWA Install Prompt */
.install-prompt {
  position: fixed;
  bottom: var(--space-xl);
  left: var(--space-lg);
  right: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid rgba(184, 134, 11, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-elevated);
  z-index: 99;
  animation: slideInRight 0.5s ease-out;
  display: none;
}

.install-prompt.show {
  display: block;
}

.install-prompt-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.install-prompt-text {
  flex: 1;
}

.install-prompt-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-700);
  margin-bottom: var(--space-xs);
}

.install-prompt-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.install-prompt-actions {
  display: flex;
  gap: var(--space-sm);
}

.install-button {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.dismiss-button {
  background: transparent;
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.dismiss-button:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}