/* ===== Markets Page Dashboard ===== */

.market-page {
  padding-top: 60px;
  padding-bottom: 60px;
  background-color: #f8fafb;
  min-height: 100vh;
}

.market-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Card base */
.card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e8ecf1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Dashboard grid layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  margin-bottom: 24px;
}

/* ===== Chart Panel ===== */
.chart-panel {
  padding: 32px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.stock-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stock-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.stock-price-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stock-price-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.stock-price-currency {
  font-size: 16px;
  font-weight: 500;
  color: rgba(32, 40, 59, 0.5);
}

.stock-change {
  font-size: 14px;
  font-weight: 500;
}

.stock-change.positive {
  color: #10b981;
}

.stock-change.negative {
  color: #ef4444;
}

/* Time filter buttons */
.time-filters {
  display: flex;
  gap: 4px;
  background: #f3f5f8;
  border-radius: 10px;
  padding: 4px;
}

.time-btn {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: rgba(32, 40, 59, 0.6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.time-btn:hover {
  color: var(--text-dark);
}

.time-btn.active {
  background: var(--primary-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(74, 119, 182, 0.25);
}

/* Chart area */
.chart-area {
  height: 280px;
  position: relative;
  margin-bottom: 24px;
}

.chart-area canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Chart stats */
.chart-stats {
  display: flex;
  gap: 40px;
  padding-top: 20px;
  border-top: 1px solid #e8ecf1;
}

.chart-stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-stat-item .stat-label {
  font-size: 12px;
  color: rgba(32, 40, 59, 0.5);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-stat-item .stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ===== Sidebar ===== */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Gainers / Losers Card */
.gainers-losers-card {
  padding: 0;
  overflow: hidden;
}

.gl-tabs {
  display: flex;
  border-bottom: 1px solid #e8ecf1;
}

.gl-tab {
  flex: 1;
  padding: 16px 12px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: rgba(32, 40, 59, 0.5);
  cursor: pointer;
  position: relative;
  font-family: 'Inter', sans-serif;
  transition: color 0.2s ease;
}

.gl-tab:hover {
  color: var(--text-dark);
}

.gl-tab.active {
  color: var(--text-dark);
}

.gl-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--primary-blue);
  border-radius: 1px;
}

/* Gainers/Losers List */
.gl-list {
  max-height: 380px;
  overflow-y: auto;
}

.gl-list::-webkit-scrollbar {
  width: 4px;
}

.gl-list::-webkit-scrollbar-thumb {
  background: #dde2e9;
  border-radius: 4px;
}

.gl-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f5f8;
  cursor: pointer;
  transition: background 0.15s ease;
}

.gl-item:hover {
  background: #f8fafb;
}

.gl-item:last-child {
  border-bottom: none;
}

.gl-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gl-symbol {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.gl-company {
  font-size: 12px;
  color: rgba(32, 40, 59, 0.45);
}

.gl-item-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gl-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.gl-change {
  font-size: 12px;
  font-weight: 500;
}

.gl-change.positive {
  color: #10b981;
}

.gl-change.negative {
  color: #ef4444;
}

/* Market Stats Card */
.market-stats-card {
  padding: 24px;
}

.market-stats-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 20px;
}

.market-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f5f8;
}

.market-stat-row:last-child {
  border-bottom: none;
}

.ms-label {
  font-size: 14px;
  color: rgba(32, 40, 59, 0.6);
}

.ms-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.ms-value.positive {
  color: #10b981;
}

.ms-value.negative {
  color: #ef4444;
}

.ms-value.bold {
  font-weight: 700;
}

/* ===== Stocks Table ===== */
.stocks-table-card {
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid #e8ecf1;
}

.table-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f3f5f8;
  border-radius: 10px;
  padding: 10px 16px;
  color: rgba(32, 40, 59, 0.4);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(74, 119, 182, 0.2);
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  width: 180px;
}

.search-box input::placeholder {
  color: rgba(32, 40, 59, 0.35);
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e8ecf1;
  background: #fff;
  cursor: pointer;
  color: rgba(32, 40, 59, 0.5);
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: #f3f5f8;
  color: var(--text-dark);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}

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

.stocks-table thead {
  background: #f8fafb;
}

.stocks-table th {
  text-align: left;
  padding: 14px 32px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(32, 40, 59, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.stocks-table td {
  padding: 16px 32px;
  font-size: 14px;
  color: var(--text-dark);
  border-bottom: 1px solid #f3f5f8;
  white-space: nowrap;
}

.stocks-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.stocks-table tbody tr:hover {
  background: #f8fafb;
}

.stocks-table tbody tr.selected {
  background: rgba(74, 119, 182, 0.06);
}

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

.td-change.positive {
  color: #10b981;
  font-weight: 500;
}

.td-change.negative {
  color: #ef4444;
  font-weight: 500;
}

/* Table footer */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-top: 1px solid #e8ecf1;
}

.last-updated {
  font-size: 13px;
  color: rgba(32, 40, 59, 0.4);
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e8ecf1;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: #f3f5f8;
}

/* Loading state */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f2f5 25%, #e8ecf1 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Nav active state */
.nav-active {
  color: var(--primary-blue) !important;
  font-weight: 600 !important;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart-stats {
    flex-wrap: wrap;
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .market-page {
    padding-top: 80px;
    padding-bottom: 40px;
  }

  .market-container {
    padding: 0 16px;
  }

  .chart-panel {
    padding: 20px;
  }

  .chart-header {
    flex-direction: column;
    gap: 16px;
  }

  .chart-stats {
    gap: 16px;
  }

  .chart-stat-item {
    flex: 1;
    min-width: 80px;
  }

  .table-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    padding: 20px;
  }

  .stocks-table th,
  .stocks-table td {
    padding: 12px 16px;
  }

  .table-footer {
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
  }

  .search-box input {
    width: 140px;
  }
}
