/* ============================================================
   styles.css — Custom styles for Menia trading platform
   Dark terminal theme: #131722 background
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --bg-primary:    #131722;
  --bg-secondary:  #1c2030;
  --bg-card:       #1e2337;
  --bg-hover:      #252a3d;
  --border-color:  #2a3050;
  --text-primary:  #d1d4dc;
  --text-muted:    #787b86;
  --text-heading:  #e0e3eb;

  --green:         #26a69a;
  --green-bright:  #4caf7d;
  --red:           #ef5350;
  --red-bright:    #f44336;
  --yellow:        #f0b90b;
  --blue:          #2196f3;
  --purple:        #9c27b0;

  --nav-height:    56px;
  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;
}

/* ---- Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

a {
  color: var(--text-primary);
  text-decoration: none;
}

a:hover {
  color: var(--text-heading);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Navigation ---- */
.nav-bar {
  height: var(--nav-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1.5rem;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-heading);
  background: var(--bg-hover);
}

.nav-search {
  margin-left: auto;
  position: relative;
}

.nav-search input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem 0.375rem 2rem;
  width: 220px;
  outline: none;
  transition: border-color 0.15s, width 0.2s;
}

.nav-search input:focus {
  border-color: var(--green);
  width: 280px;
}

.nav-search input::placeholder {
  color: var(--text-muted);
}

.nav-search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

/* ---- Search Dropdown ---- */
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
  overflow: hidden;
}

.search-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 0.1s;
}

.search-dropdown-item:hover {
  background: var(--bg-hover);
}

.search-symbol {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 0.875rem;
}

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

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ---- Market Overview Cards ---- */
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  min-width: 0;
}

.market-card-symbol {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.market-card-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  margin: 0.25rem 0;
}

.market-card-change {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--text-heading);
}

.data-table th .sort-arrow {
  margin-left: 4px;
  opacity: 0.5;
}

.data-table th.sort-asc .sort-arrow::after  { content: ' ▲'; opacity: 1; }
.data-table th.sort-desc .sort-arrow::after { content: ' ▼'; opacity: 1; }

.data-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 0.1s;
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .sym-cell {
  font-weight: 700;
  color: var(--text-heading);
  font-size: 0.875rem;
}

/* ---- Bias / Signal Classes ---- */
.text-bullish  { color: var(--green-bright); }
.text-bearish  { color: var(--red-bright); }
.text-neutral  { color: var(--text-muted); }

.bias-bullish {
  background: rgba(76, 175, 125, 0.15);
  color: var(--green-bright);
  border: 1px solid rgba(76, 175, 125, 0.3);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.bias-bearish {
  background: rgba(244, 67, 54, 0.15);
  color: var(--red-bright);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.bias-neutral {
  background: rgba(120, 123, 134, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(120, 123, 134, 0.3);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Weinstein Stage Badges ---- */
.stage-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---- Pattern Pills ---- */
.pattern-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pattern-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid;
}

.pattern-pill.detected {
  background: rgba(76, 175, 125, 0.15);
  color: var(--green-bright);
  border-color: rgba(76, 175, 125, 0.4);
}

.pattern-pill.not-detected {
  background: rgba(42, 48, 80, 0.4);
  color: var(--text-muted);
  border-color: var(--border-color);
}

/* ---- Signal Card ---- */
.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.signal-buy {
  border-left: 4px solid var(--green-bright);
}

.signal-sell {
  border-left: 4px solid var(--red-bright);
}

.signal-none {
  border-left: 4px solid var(--text-muted);
}

.signal-label {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

/* ---- Indicator Rows ---- */
.indicator-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.indicator-name {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.indicator-value {
  color: var(--text-heading);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ---- Sector List ---- */
.sector-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.sector-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  flex: 1;
  margin: 0 0.75rem;
  overflow: hidden;
}

.sector-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ---- Loader / Skeleton ---- */
.loader-text {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  font-size: 0.875rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  height: 1em;
}

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

/* ---- Filter Controls ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.filter-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.filter-select,
.filter-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  outline: none;
  cursor: pointer;
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--green);
}

.filter-select option {
  background: var(--bg-secondary);
}

/* ---- Rating Stars ---- */
.stars {
  color: var(--yellow);
  font-size: 0.875rem;
  letter-spacing: 1px;
}

/* ---- Footer ---- */
.page-footer {
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2rem;
}

/* ---- Page Layout ---- */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-search input { width: 160px; }
  .nav-search input:focus { width: 180px; }
  .page-container { padding: 1rem; }
  .market-grid { grid-template-columns: 1fr !important; }
}
