*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0a;
  --bg-card: #181818;
  --bg-hover: #222;
  --text: #e2e2e2;
  --text-muted: #6b6b78;
  --border: #333;
  --accent: #e01a4f;
  --accent-hover: #a4172f;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --accent-badge: #e01a4f;
  --accent-badge-bg: rgba(224, 26, 79, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.12);
  --gray: #64748b;
  --gray-bg: rgba(100, 116, 139, 0.12);
  --red: #ef4444;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
}

header {
  margin-bottom: 24px;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-global {
  background: var(--purple-bg);
  color: var(--purple);
}

.badge-india {
  background: var(--accent-badge-bg);
  color: var(--accent-badge);
}

.subtitle {
  color: var(--text-light, var(--text-muted));
  font-size: 14px;
  margin-bottom: 8px;
}

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

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

.search-wrapper {
  flex: 1;
  max-width: 400px;
}

#searchInput {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#searchInput:focus {
  border-color: var(--accent);
}

#searchInput::placeholder {
  color: var(--text-muted);
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

thead th.sortable {
  cursor: pointer;
}

thead th.sortable:hover {
  color: var(--text);
}

.sort-icon {
  display: inline-block;
  width: 12px;
  margin-left: 4px;
  opacity: 0.4;
}

th.sort-asc .sort-icon::after {
  content: "\25B2";
  opacity: 1;
}

th.sort-desc .sort-icon::after {
  content: "\25BC";
  opacity: 1;
}

th.sortable:not(.sort-asc):not(.sort-desc) .sort-icon::after {
  content: "\25B4\25BE";
  font-size: 8px;
  letter-spacing: -2px;
  opacity: 0.3;
}

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

tbody tr:last-child {
  border-bottom: none;
}

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

tbody td {
  padding: 10px 14px;
  white-space: nowrap;
}

.symbol-cell {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
}

.company-name {
  font-weight: 600;
  color: var(--text);
}

.exchange-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.03em;
  background: var(--gray-bg);
  color: var(--gray);
}

.country-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.country-india {
  background: rgba(255, 153, 51, 0.15);
  color: #ff9933;
}

.country-usa {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.country-global {
  background: var(--purple-bg);
  color: var(--purple);
}

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: capitalize;
}

.status-upcoming {
  background: var(--accent-badge-bg);
  color: var(--accent-badge);
}

.status-open {
  background: var(--green-bg);
  color: var(--green);
}

.status-subscribed {
  background: var(--amber-bg);
  color: var(--amber);
}

.status-listed {
  background: var(--gray-bg);
  color: var(--gray);
}

.status-closed {
  background: var(--gray-bg);
  color: var(--gray);
}

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

.status-bar {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  h1 {
    font-size: 22px;
  }
  thead th,
  tbody td {
    padding: 8px 10px;
    font-size: 12px;
  }
  .table-wrapper {
    border-radius: 8px;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 16px 8px;
  }
  thead th:nth-child(6),
  tbody td:nth-child(6) {
    display: none;
  }
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}
.modal-wrap {
  position: relative;
  width: 92%;
  max-width: 680px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}
.modal-symbol {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text);
}
.modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detail-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.detail-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-hover);
}
.detail-card-head h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.card-toggle {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.detail-card.collapsed .card-toggle::after {
  content: "+";
}
.detail-card:not(.collapsed) .card-toggle::after {
  content: "\2212";
}
.detail-card-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-light, var(--text-muted));
}
.detail-card.collapsed .detail-card-body {
  display: none;
}
.detail-card-body ul {
  list-style: none;
  padding: 0;
}
.detail-card-body li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
}
.detail-card-body li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.modal-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.modal-loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

tbody tr {
  cursor: pointer;
}
