/* Bitcoin Real-Time Tracker - Main Styles */

/* CSS Variables */
:root {
  --primary-color: #f7931a;
  --primary-dark: #e6851a;
  --secondary-color: #2d3748;
  --background: #ffffff;
  --surface: #f8fafc;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #38a169;
  --danger: #e53e3e;
  --warning: #d69e2e;
  --info: #3182ce;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Transitions */
  --transition: all 0.2s ease-in-out;
  --transition-slow: all 0.3s ease-in-out;
}

/* Dark theme variables */
[data-theme="dark"] {
  --background: #1a202c;
  --surface: #2d3748;
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #a0aec0;
  --border: #4a5568;
  --border-light: #2d3748;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Navigation */
.nav {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bitcoin-icon {
  font-size: 2rem;
  color: var(--primary-color);
  font-weight: bold;
}

.nav-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: -0.5rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Main Content */
.main {
  min-height: calc(100vh - 4rem);
  padding: 2rem 0;
}

/* Price Header */
.price-header {
  margin-bottom: 3rem;
}

.price-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
}

.price-main {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.price-label {
  font-size: 1.125rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.price-value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 1rem;
}

.price-change {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.price-change.positive {
  color: #68d391;
}

.price-change.negative {
  color: #fc8181;
}

.last-updated {
  font-size: 0.875rem;
  opacity: 0.8;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--background);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

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

/* Chart Section */
.chart-section {
  margin-bottom: 3rem;
}

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

.chart-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.time-selector {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.25rem;
  border: 1px solid var(--border);
}

.time-btn {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  color: var(--text-secondary);
}

.time-btn.active {
  background: var(--primary-color);
  color: white;
}

.time-btn:not(.active):hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.chart-type-btn {
  background: var(--background);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  transition: var(--transition);
  color: var(--text-secondary);
}

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

.chart-container {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  height: 400px;
}

#priceChart {
  width: 100% !important;
  height: 100% !important;
}

.chart-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--background);
  border-radius: var(--radius-lg);
}

.chart-loading.hidden {
  display: none;
}

.loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Market Data */
.market-data {
  margin-bottom: 3rem;
}

.market-data h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

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

.market-card {
  background: var(--background);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.market-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.market-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.market-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

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

.fear-greed-bar {
  width: 100%;
  height: 0.5rem;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  overflow: hidden;
}

.fear-greed-fill {
  height: 100%;
  background: linear-gradient(90deg, #e53e3e 0%, #d69e2e 50%, #38a169 100%);
  border-radius: var(--radius-sm);
  transition: width 0.5s ease;
  width: 0%;
}

/* Alerts Section */
.alerts-section {
  margin-bottom: 3rem;
}

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

.alerts-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.alerts-list {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.no-alerts {
  text-align: center;
  color: var(--text-muted);
}

/* Live Indicator */
.live-indicator {
  position: fixed;
  top: 5rem;
  right: 1rem;
  background: var(--success);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: white;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

/* Connection Status */
.connection-status {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 50;
}

.status-online {
  background: var(--success);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

.status-offline {
  background: var(--danger);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: white;
  border-radius: 50%;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 101;
}

.mobile-menu-btn span {
  width: 1.5rem;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(0.25rem, 0.25rem);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(0.25rem, -0.25rem);
}

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

.positive {
  color: var(--success) !important;
}

.negative {
  color: var(--danger) !important;
}

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

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

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

.animate-slide-up {
  animation: slideUp 0.3s ease-out;
}

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

/* Number formatting */
.price-up {
  color: var(--success);
}

.price-down {
  color: var(--danger);
}

.price-neutral {
  color: var(--text-muted);
}