/* ======================================================================
   Crypto Theme global CSS — Stage 5 cleanup
   Scope:
   - global page/body/layout
   - typography and links
   - Drupal fields / forms / messages
   - node page generic layout
   - safe legacy compatibility classes

   Rules:
   - specific widgets live in their own files:
     front.css, header.css, content-nodes.css, coin-page.css,
     ai-score.css, exchanges.css, crypto_top100.css,
     dashboard.css.
   - no random colors, only design-system variables
   - no JS/data selectors changed
   ====================================================================== */

/* ----------------------------------------------------------------------
   Global base
   ---------------------------------------------------------------------- */

html {
  background: var(--as-bg);
  color-scheme: dark;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(var(--as-accent-rgb), .055), transparent 34rem),
    radial-gradient(circle at top right, rgba(255, 255, 255, .028), transparent 30rem),
    var(--as-bg);
  color: var(--as-text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

* {
  box-sizing: border-box;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

a {
  color: var(--as-accent);
  text-decoration: none;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

a:hover {
  color: var(--as-accent-hover);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(var(--as-accent-rgb), .75);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--as-heading);
  line-height: 1.18;
}

h1 {
  margin: 0 0 18px;
  font-size: var(--as-h1-size);
  font-weight: 850;
}

h2 {
  margin: 0 0 14px;
  font-size: var(--as-h2-size);
  font-weight: 850;
}

h3 {
  margin: 0 0 12px;
  font-size: var(--as-h3-size);
  font-weight: 800;
}

p {
  margin: 0 0 1em;
}

small {
  color: var(--as-text-muted);
}

/* ----------------------------------------------------------------------
   Page layout
   ---------------------------------------------------------------------- */

.layout-container,
.dialog-off-canvas-main-canvas {
  min-height: 100vh;
}

main,
main[role="main"],
.region-content {
  max-width: var(--as-page-width, 1240px);
  margin: 0 auto;
  padding: 0 16px 46px;
}

.region-content > .block,
.node--view-mode-full,
.taxonomy-term-page,
.crypto-page-card {
  min-width: 0;
}

/* ----------------------------------------------------------------------
   Generic card / glass compatibility classes
   ---------------------------------------------------------------------- */

.card,
.glass-card,
.crypto-card,
.crypto-glass {
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius-lg);
  background: var(--as-surface-1);
  box-shadow: var(--as-shadow-soft);
}

.card,
.glass-card,
.crypto-card,
.crypto-glass {
  padding: var(--as-space-5);
}

.card-title,
.section-title,
.block-title {
  margin: 0 0 12px;
  color: var(--as-heading);
  font-size: var(--as-h2-size);
  font-weight: 900;
  line-height: 1.18;
}

.muted,
.text-muted,
.description,
.field--name-field-description,
.taxonomy-term-description {
  color: var(--as-text-muted);
}

/* ----------------------------------------------------------------------
   Drupal fields / node content
   ---------------------------------------------------------------------- */

.field {
  margin-bottom: 14px;
}

.field__label {
  margin-bottom: 6px;
  color: var(--as-text-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.field__item,
.field__items {
  color: var(--as-text);
}

.node__content {
  min-width: 0;
}

.node__content img {
  height: auto;
}

.taxonomy-term-header {
  margin-bottom: 18px;
}

.taxonomy-term-header h1 {
  margin-bottom: 8px;
}

.taxonomy-term-description {
  max-width: 980px;
  line-height: 1.65;
}

/* ----------------------------------------------------------------------
   Generic tables
   Specific Top100 tables are in crypto_top100.css.
   ---------------------------------------------------------------------- */

table {
  border-collapse: collapse;
}

table:not(.crypto-top100-table):not(.ai-taxonomy-table):not(.crypto-table) {
  width: 100%;
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius-md);
  background: var(--as-surface-1);
  overflow: hidden;
}

table:not(.crypto-top100-table):not(.ai-taxonomy-table):not(.crypto-table) th,
table:not(.crypto-top100-table):not(.ai-taxonomy-table):not(.crypto-table) td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--as-border-soft);
  color: var(--as-text);
}

table:not(.crypto-top100-table):not(.ai-taxonomy-table):not(.crypto-table) th {
  color: var(--as-text-muted);
  text-align: left;
}

table:not(.crypto-top100-table):not(.ai-taxonomy-table):not(.crypto-table) tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, .018);
}

table:not(.crypto-top100-table):not(.ai-taxonomy-table):not(.crypto-table) tr:hover td {
  background: var(--as-surface-2);
}

/* The networks View has many columns; keep its table inside the page on mobile. */
.view-red .views-entity-form {
  max-width: 100%;
  overflow-x: auto;
}

/* ----------------------------------------------------------------------
   Forms
   ---------------------------------------------------------------------- */

input,
select,
textarea {
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius-xs);
  background: var(--as-surface-1);
  color: var(--as-text-strong);
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
}

input::placeholder,
textarea::placeholder {
  color: var(--as-text-faint);
}

button,
.button,
input[type="submit"] {
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius-pill);
  background: var(--as-surface-2);
  color: var(--as-text-strong);
  cursor: pointer;
  font-weight: 800;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--as-accent-rgb), .35);
  background: rgba(var(--as-accent-rgb), .10);
  text-decoration: none;
}

/* ----------------------------------------------------------------------
   Messages / status
   ---------------------------------------------------------------------- */

.messages {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius-md);
  background: var(--as-surface-1);
  color: var(--as-text);
}

.messages--status {
  border-color: rgba(var(--as-positive-rgb), .28);
  background: rgba(var(--as-positive-rgb), .08);
}

.messages--warning {
  border-color: rgba(var(--as-accent-rgb), .28);
  background: rgba(var(--as-accent-rgb), .08);
}

.messages--error {
  border-color: rgba(var(--as-negative-rgb), .28);
  background: rgba(var(--as-negative-rgb), .08);
}

/* ----------------------------------------------------------------------
   Generic pager
   Module pager specifics are in crypto_top100_pager.css.
   ---------------------------------------------------------------------- */

.pager {
  margin: 20px 0;
}

.pager__items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pager__item a,
.pager__item.is-active a,
.pager__item--current {
  display: inline-flex;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius-xs);
  background: var(--as-surface-1);
  color: var(--as-text);
  text-decoration: none;
}

.pager__item a:hover {
  border-color: rgba(var(--as-accent-rgb), .35);
  color: var(--as-accent-hover);
}

.pager__item.is-active a,
.pager__item--current {
  background: var(--as-accent-active);
  color: #151515;
  border-color: transparent;
}

/* ----------------------------------------------------------------------
   Generic lists / chips
   ---------------------------------------------------------------------- */

.tags,
.tag-list,
.term-list,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag,
.chip,
.term-chip,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(var(--as-accent-rgb), .22);
  border-radius: var(--as-radius-pill);
  background: rgba(var(--as-accent-rgb), .08);
  color: var(--as-accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

/* ----------------------------------------------------------------------
   Utility
   ---------------------------------------------------------------------- */

.is-positive,
.positive,
.val-pos {
  color: var(--as-positive) !important;
}

.is-negative,
.negative,
.val-neg {
  color: var(--as-negative) !important;
}

.visually-muted {
  color: var(--as-text-muted);
}

.nowrap {
  white-space: nowrap;
}

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

.text-center {
  text-align: center;
}

/* ----------------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------------- */

@media (max-width: 760px) {
  main,
  main[role="main"],
  .region-content {
    padding: 0 12px 38px;
  }

  h1 {
    font-size: var(--as-h1-size);
  }

  h2 {
    font-size: var(--as-h2-size);
  }

  h3 {
    font-size: var(--as-h3-size);
  }

  .card,
  .glass-card,
  .crypto-card,
  .crypto-glass {
    padding: var(--as-space-4);
  }
}
