/* Base Styles and Variables */
:root {
  --primary: #4f46e5;
  --primary-hover: #3c34c5;
  --primary-light: rgba(79, 70, 229, 0.1);
  
  --bg-color: #ffffff;
  --bg-card: #ffffff;
  --bg-muted: #f4f4f5;
  
  --text-color: #18181b;
  --text-muted: #71717a;
  --text-light: #f4f4f5;
  
  --border-color: #e4e4e7;
  --success-color: #22c55e;
  --danger-color: #ef4444;
  
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  
  --radius: 8px;
  --radius-lg: 12px;
  
  --transition: all 0.2s ease;
}
.logo {
  height: 4em; /* scales with the heading font size */
  width: auto;   /* keeps aspect ratio */
  vertical-align: middle;
  
}
.title-area {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* spacing between logo and text */
}
/* Dark Theme Colors */
.dark-theme {
  --bg-color: #18181b;
  --bg-card: #27272a;
  --bg-muted: #3f3f46;
  
  --text-color: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-light: #f4f4f5;
  
  --border-color: #3f3f46;
  
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Reset & Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  transition: var(--transition);
}

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

h1, h2, h3, h4, h5, h6 {
  color: var(--text-color);
  font-weight: 700;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-muted);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(79, 70, 229, 0.5);
  border-radius: 8px;
  border: 3px solid var(--bg-muted);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 70, 229, 0.7);
}

/* For Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(79, 70, 229, 0.5) var(--bg-muted);
}

/* Media Query for Touch Devices */
@media (pointer: coarse) {
  button, 
  .button,
  input,
  a,
  select {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Typography & Text */
.text-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.bold {
  font-weight: 700;
}

/* Responsive Utilities */
.desktop-only {
  display: inline;
}

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none;
  }
  
  .mobile-only {
    display: inline;
  }
}

/* Layout Components */
.meta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

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

.game-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .game-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.title-area h1 {
  font-size: 1.875rem;
  margin-bottom: 0.25rem;
}

.day-info {
  display: flex;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--primary-light);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  margin-right: 0.5rem;
  font-size: 0.875rem;
}

.badge i {
  font-size: 0.75rem;
  margin-right: 0.25rem;
}

.time-info {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.time-info i {
  font-size: 0.75rem;
  margin-right: 0.25rem;
}

.stats-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .stats-area {
    margin-top: 0;
  }
}

.stat-card {
  background-color: var(--bg-muted);
  padding: 0.75rem;
  border-radius: var(--radius);
}

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

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 0.875rem;
}

.button i {
  margin-right: 0.5rem;
}

.button.primary {
  background-color: var(--primary);
  color: white;
}

.button.primary:hover {
  background-color: var(--primary-hover);
}

.button.primary:disabled {
  background-color: var(--primary);
  opacity: 0.5;
  cursor: not-allowed;
}

.button.danger {
  background-color: var(--danger-color);
  color: white;
}

.button.danger:hover {
  background-color: #dc2626;
}

.button.danger:disabled {
  background-color: var(--danger-color);
  opacity: 0.5;
  cursor: not-allowed;
}

.button.outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.button.outline:hover {
  background-color: var(--bg-muted);
}

@media (max-width: 768px) {
  .button {
    width: 100%;
  }
}

/* Progress Bar */
.progress-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.progress-info {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
  .progress-info {
    flex-direction: row;
    justify-content: space-between;
  }
}

.progress-pill {
  background-color: var(--primary-light);
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  width: fit-content;
}

.progress-bar {
  height: 0.75rem;
  background-color: var(--bg-muted);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

/* Tabs */
.tab-container {
  margin-bottom: 1.5rem;
}

.tabs {
  display: flex;
  width: 100%;
  justify-content: space-between;
  background-color: var(--bg-muted);
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 1rem;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0.5rem 1rem;
  background-color: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.tab i {
  margin-right: 0.5rem;
}

.tab.active {
  background-color: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.card-header h3 {
  margin: 0;
  font-size: 1.125rem;
}

.card-content {
  padding: 1rem;
}

/* Market Grid */
.market-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .market-grid {
    grid-template-columns: 1fr 2fr;
  }
}

/* Search Box */
.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.search-box input {
  padding: 0.5rem 0.5rem 0.5rem 2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 160px;
  background-color: var(--bg-card);
  color: var(--text-color);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Stock List */
.stocks-list {
  max-height: 400px;
  overflow-y: auto;
}

.stock-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.stock-item:hover {
  background-color: var(--bg-muted);
}

.stock-item.selected {
  background-color: var(--bg-muted);
}

.stock-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.stock-symbol {
  font-weight: 600;
}

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

.stock-price {
  font-weight: 500;
}

.stock-change {
  font-size: 0.75rem;
}

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

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

.stock-chart {
  height: 2rem;
  width: 100%;
}

/* Stock Detail */
.placeholder-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.placeholder-message i {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.placeholder-message h3 {
  margin-bottom: 0.25rem;
}

.stock-header {
  padding: 1rem;
}

.price-change {
  text-align: right;
}

.change {
  display: flex;
  align-items: center;
  font-size: 1.125rem;
  font-weight: 600;
  justify-content: flex-end;
}

.change i {
  margin-right: 0.25rem;
}

.change-description {
  font-size: 0.75rem;
}

.stock-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .stock-details {
    grid-template-columns: 1fr 1fr;
  }
}

/* Stock Info */
.stock-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.data-value {
  font-weight: 500;
}

.chart-container {
  margin-bottom: 1.5rem;
}

.mini-chart {
  height: 8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.5rem;
  margin-top: 0.5rem;
}

.stock-risk {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.stock-risk i {
  margin-right: 0.25rem;
}

/* Trading Panel */
.trading-panel {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
}

.trading-panel h3 {
  margin-bottom: 1rem;
}

.amount-selector {
  margin-bottom: 1rem;
}

.amount-input {
  display: flex;
  margin-top: 0.25rem;
}

.amount-input button {
  padding: 0.25rem 0.75rem;
}

.amount-input input {
  flex: 1;
  text-align: center;
  border: 1px solid var(--border-color);
  border-left: none;
  border-right: none;
  padding: 0.5rem;
}

.amount-input input:focus {
  outline: none;
}

.trade-info {
  margin-bottom: 1.5rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.trade-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.error-message {
  color: var(--danger-color);
  font-size: 0.75rem;
  text-align: center;
  margin-top: 0.5rem;
}

.hidden {
  display: none;
}

/* Portfolio */
.portfolio-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .portfolio-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

.summary-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
}

.value-large {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

/* Portfolio Table */
.portfolio-table {
  width: 100%;
  border-collapse: collapse;
}

.portfolio-table th,
.portfolio-table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.portfolio-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .portfolio-table {
    display: block;
    overflow-x: auto;
  }
}

/* News */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.news-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  transition: var(--transition);
}

.news-item:hover {
  background-color: var(--bg-muted);
}

.news-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.news-title {
  font-weight: 600;
  font-size: 1rem;
}

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

.news-content {
  margin-bottom: 0.75rem;
}

.news-impact {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.news-impact.positive {
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success-color);
}

.news-impact.negative {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.news-impact.neutral {
  background-color: var(--bg-muted);
  color: var(--text-muted);
}

/* Theme Toggle */
.theme-toggle {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-color);
  transition: var(--transition);
}

.theme-toggle:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.light-theme .dark-icon {
  display: none;
}

.dark-theme .light-icon {
  display: none;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  background-color: var(--bg-card);
  color: var(--text-color);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-lg);
  max-width: 350px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--primary);
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast.error {
  border-left-color: var(--danger-color);
}

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

.toast-title {
  font-weight: 600;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.toast-body {
  font-size: 0.875rem;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}