/* ═══════════════════════════════════════════════════════════════════
   PSX MARKET PORTAL — Desktop CSS (min-width: 1025px)
   Separate file — NO conflicts with styles.css, mobile.css, tablet.css
   All selectors scoped with .psx-portal or .psx- prefix
   ═══════════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --psx-green: #22c55e;
  --psx-red: #ef4444;
  --psx-blue: #3b82f6;
  --psx-accent: #d6a84f;
  --psx-gray: #94a3b8;
  --psx-bg: #f8fafc;
  --psx-surface: #ffffff;
  --psx-border: #e2e8f0;
  --psx-text: #0f172a;
  --psx-text2: #64748b;
  --psx-deep: #1a1a2e;
}

/* ── Portal Container ── */
.psx-portal {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 60px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ═══ HERO BANNER ═══ */
.psx-hero {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e8edf4 100%); border: 1px solid var(--psx-border);
  border-radius: 16px;
  padding: 40px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.psx-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(214,168,79,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.psx-hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.psx-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(214,168,79,0.1);
  padding: 6px 16px;
  border-radius: 20px;
  color: var(--psx-accent);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
}

.psx-hero-icon {
  font-size: 16px;
}

.psx-hero-title {
  font-size: 36px;
  font-weight: 800;
  color: var(--psx-text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.psx-hero-sub {
  font-size: 16px;
  color: var(--psx-text2);
}

.psx-hero-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* ── Market Status Badge ── */
.psx-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.psx-status-green {
  background: rgba(34,197,94,0.15);
  color: var(--psx-green);
  border: 1px solid rgba(34,197,94,0.3);
}

.psx-status-red {
  background: rgba(239,68,68,0.15);
  color: var(--psx-red);
  border: 1px solid rgba(239,68,68,0.3);
}

.psx-status-blue {
  background: rgba(59,130,246,0.15);
  color: var(--psx-blue);
  border: 1px solid rgba(59,130,246,0.3);
}

.psx-status-gray {
  background: rgba(148,163,184,0.15);
  color: var(--psx-gray);
  border: 1px solid rgba(148,163,184,0.3);
}

.psx-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: psx-pulse 2s infinite;
}

.psx-status-green .psx-status-dot { background: var(--psx-green); }
.psx-status-red .psx-status-dot { background: var(--psx-red); }
.psx-status-blue .psx-status-dot { background: var(--psx-blue); }
.psx-status-gray .psx-status-dot { background: var(--psx-gray); animation: none; }

@keyframes psx-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ── Timer ── */
.psx-timer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.psx-timer-label {
  font-size: 12px;
  color: var(--psx-text2);
}

.psx-timer-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--psx-text);
  font-variant-numeric: tabular-nums;
}

/* ═══ SUMMARY STRIP ═══ */
.psx-summary-strip {
  margin-bottom: 24px;
}

.psx-summary-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.psx-summary-card {
  background: var(--psx-surface);
  border: 1px solid var(--psx-border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.psx-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.psx-summary-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.psx-si-green { background: rgba(34,197,94,0.1); color: var(--psx-green); }
.psx-si-red { background: rgba(239,68,68,0.1); color: var(--psx-red); }
.psx-si-gray { background: rgba(148,163,184,0.1); color: var(--psx-gray); }
.psx-si-accent { background: rgba(214,168,79,0.1); color: var(--psx-accent); }

.psx-summary-data { flex: 1; min-width: 0; }

.psx-summary-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--psx-text);
  line-height: 1;
  margin-bottom: 4px;
}

.psx-summary-label {
  font-size: 12px;
  color: var(--psx-text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.psx-summary-bar {
  width: 60px;
  height: 6px;
  background: var(--psx-border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.psx-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.psx-bar-green { background: var(--psx-green); }
.psx-bar-red { background: var(--psx-red); }

/* ═══ TOP MOVERS ═══ */
.psx-top-movers {
  margin-bottom: 24px;
}

.psx-top-movers-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.psx-mover-card {
  background: var(--psx-surface);
  border: 1px solid var(--psx-border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.psx-mover-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.psx-mover-gainer::before { background: var(--psx-green); }
.psx-mover-loser::before { background: var(--psx-red); }
.psx-mover-active::before { background: var(--psx-accent); }

.psx-mover-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.psx-mover-gainer .psx-mover-label { color: var(--psx-green); }
.psx-mover-loser .psx-mover-label { color: var(--psx-red); }
.psx-mover-active .psx-mover-label { color: var(--psx-accent); }

.psx-mover-symbol {
  font-size: 22px;
  font-weight: 800;
  color: var(--psx-text);
  margin-bottom: 2px;
}

.psx-mover-name {
  font-size: 13px;
  color: var(--psx-text2);
  margin-bottom: 12px;
}

.psx-mover-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--psx-text);
  margin-bottom: 4px;
}

.psx-mover-change {
  font-size: 16px;
  font-weight: 700;
}

.psx-mc-green { color: var(--psx-green); }
.psx-mc-red { color: var(--psx-red); }
.psx-mc-accent { color: var(--psx-accent); }

/* ═══ CONTROLS BAR ═══ */
.psx-controls-bar {
  background: var(--psx-surface);
  border: 1px solid var(--psx-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}

.psx-controls-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.psx-search-wrap {
  position: relative;
}

.psx-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--psx-gray);
  font-size: 16px;
  pointer-events: none;
}

.psx-search-wrap input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--psx-border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--psx-text);
  background: var(--psx-bg);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.psx-search-wrap input:focus {
  border-color: var(--psx-accent);
  box-shadow: 0 0 0 3px rgba(214,168,79,0.1);
}

.psx-search-wrap input::placeholder {
  color: var(--psx-gray);
}

.psx-sector-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.psx-filter-btn {
  padding: 7px 14px;
  border: 1px solid var(--psx-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--psx-text2);
  background: var(--psx-bg);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.psx-filter-btn:hover {
  border-color: var(--psx-accent);
  color: var(--psx-accent);
}

.psx-filter-btn.active {
  background: var(--psx-deep);
  color: #fff;
  border-color: var(--psx-deep);
}

.psx-sort-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.psx-sort-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--psx-text2);
}

.psx-sort-select {
  padding: 8px 14px;
  border: 1px solid var(--psx-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--psx-text);
  background: var(--psx-bg);
  cursor: pointer;
  outline: none;
}

/* ═══ FETCH BAR ═══ */
.psx-fetch-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--psx-text2);
  margin-bottom: 12px;
}

.psx-fetch-badge { font-size: 14px; }

/* ═══ STOCK TABLE (Desktop) ═══ */
.psx-stock-table-wrap {
  background: var(--psx-surface);
  border: 1px solid var(--psx-border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
}

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

.psx-stock-table thead {
  background: var(--psx-bg);
  position: sticky;
  top: 0;
  z-index: 2;
}

.psx-stock-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--psx-text2);
  text-align: left;
  border-bottom: 1px solid var(--psx-border);
}

.psx-th-price, .psx-th-change, .psx-th-pct, .psx-th-vol {
  text-align: right;
}

.psx-stock-table tbody tr {
  transition: background 0.15s;
  border-bottom: 1px solid var(--psx-border);
}

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

.psx-stock-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--psx-text);
  vertical-align: middle;
}

.psx-td-symbol { width: 100px; }

.psx-sym-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--psx-bg);
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  color: var(--psx-deep);
  letter-spacing: 0.3px;
}

.psx-td-company { min-width: 200px; }

.psx-company-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--psx-text);
}

.psx-company-sector {
  display: block;
  font-size: 11px;
  color: var(--psx-text2);
  margin-top: 2px;
}

.psx-td-sector { width: 120px; }

.psx-sector-tag {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(214,168,79,0.08);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--psx-accent);
}

.psx-td-price, .psx-td-change, .psx-td-pct, .psx-td-vol {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.psx-price-up { color: var(--psx-green); }
.psx-price-down { color: var(--psx-red); }
.psx-price-flat { color: var(--psx-text2); }

.psx-cd-up { color: var(--psx-green); }
.psx-cd-down { color: var(--psx-red); }
.psx-cd-flat { color: var(--psx-text2); }

.psx-pct-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.psx-pb-up { background: rgba(34,197,94,0.1); color: var(--psx-green); }
.psx-pb-down { background: rgba(239,68,68,0.1); color: var(--psx-red); }
.psx-pb-flat { background: rgba(148,163,184,0.1); color: var(--psx-gray); }

/* ═══ SECTORS VIEW ═══ */
.psx-sectors-view {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.psx-sector-group {
  background: var(--psx-surface);
  border: 1px solid var(--psx-border);
  border-radius: 14px;
  overflow: hidden;
}

.psx-sector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--psx-bg);
  border-bottom: 1px solid var(--psx-border);
}

.psx-sector-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.psx-sector-ico { font-size: 20px; }

.psx-sector-title h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--psx-text);
  margin: 0;
}

.psx-sector-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--psx-text2);
  background: var(--psx-surface);
  padding: 2px 8px;
  border-radius: 10px;
}

.psx-sector-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--psx-text2);
  font-size: 18px;
  padding: 4px;
  transition: transform 0.3s;
}

.psx-sector-toggle.open {
  transform: rotate(180deg);
}

.psx-sector-stocks {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.psx-stock-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--psx-border);
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.psx-stock-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.psx-card-up:hover { border-color: rgba(34,197,94,0.3); }
.psx-card-down:hover { border-color: rgba(239,68,68,0.3); }

.psx-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.psx-card-symbol {
  font-size: 14px;
  font-weight: 800;
  color: var(--psx-text);
}

.psx-card-pct {
  font-size: 13px;
  font-weight: 700;
}

.psx-ccp-up { color: var(--psx-green); }
.psx-ccp-down { color: var(--psx-red); }
.psx-ccp-flat { color: var(--psx-gray); }

.psx-card-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 8px;
}

.psx-card-name {
  font-size: 12px;
  color: var(--psx-text2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psx-card-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--psx-text);
  flex-shrink: 0;
  margin-left: 8px;
}

.psx-card-spark {
  height: 3px;
  background: var(--psx-border);
  border-radius: 2px;
  overflow: hidden;
}

.psx-spark-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.psx-spark-up { background: var(--psx-green); }
.psx-spark-down { background: var(--psx-red); }
.psx-spark-flat { background: var(--psx-gray); width: 10% !important; }

/* ═══ VIEW TOGGLE ═══ */
.psx-view-toggle {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.psx-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--psx-border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--psx-text2);
  background: var(--psx-surface);
  cursor: pointer;
  transition: all 0.2s;
}

.psx-view-btn:hover {
  border-color: var(--psx-accent);
}

.psx-view-btn.active {
  background: var(--psx-deep);
  color: #fff;
  border-color: var(--psx-deep);
}

/* ═══ INFO FOOTER ═══ */
.psx-info-footer {
  margin-top: 40px;
}

.psx-info-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.psx-info-card {
  background: var(--psx-surface);
  border: 1px solid var(--psx-border);
  border-radius: 14px;
  padding: 24px;
}

.psx-info-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--psx-text);
  margin-bottom: 12px;
}

.psx-info-card p {
  font-size: 13px;
  color: var(--psx-text2);
  line-height: 1.6;
}

.psx-hours-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.psx-hour {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--psx-bg);
  border-radius: 8px;
  font-size: 13px;
}

.psx-hour-label {
  font-weight: 600;
  color: var(--psx-text);
}

.psx-hour span:last-child {
  color: var(--psx-text2);
}

/* ═══ DATA STAMP ═══ */
.psx-data-stamp {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--psx-text2);
  border-top: 1px solid var(--psx-border);
  margin-top: 20px;
}

/* ═══ DARK MODE ═══ */
body.dark .psx-portal {
  --psx-bg: #0f172a;
  --psx-surface: #1e293b;
  --psx-border: rgba(255,255,255,0.08);
  --psx-text: #f1f5f9;
  --psx-text2: #94a3b8;
}

body.dark .psx-summary-card:hover,
body.dark .psx-stock-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

body.dark .psx-sym-badge {
  background: rgba(255,255,255,0.06);
  color: #f1f5f9;
}

body.dark .psx-stock-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

body.dark .psx-stock-table thead {
  background: rgba(255,255,255,0.03);
}

body.dark .psx-hour {
  background: rgba(255,255,255,0.04);
}

/* ═══ ELITE THEME ═══ */
body.elite .psx-hero {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #e8f5e9 100%); border: 1px solid rgba(34,197,94,0.15);
}


/* ═══ PSX MARKET CTA (on Business page) ═══ */
.psx-market-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9); border: 1px solid var(--psx-border);
  border-radius: 14px;
  text-decoration: none;
  margin-bottom: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.psx-market-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.psx-cta-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.psx-cta-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(214,168,79,0.15);
  color: var(--psx-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.psx-cta-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--psx-text);
  margin-bottom: 2px;
}

.psx-cta-sub {
  font-size: 13px;
  color: var(--psx-text2);
}

.psx-cta-arrow {
  color: var(--psx-text2);
  font-size: 20px;
}

/* Logo image inside CTA icon */
.psx-cta-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

