/**
 * Scoped under .atti-table-wrap so theme rules like
 * .content-area table td / .page-content table th (Gana theme) do not override.
 */

.atti-table-wrap {
  overflow-x: auto;
  margin: 1em 0;
  -webkit-overflow-scrolling: touch;
}

/* Inner vertical scroll */
.atti-table-wrap--scroll .atti-table-scroll {
  max-height: calc(2.5em + 2.75em * var(--atti-scroll-rows, 0));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.atti-table-wrap--scroll .atti-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f6f7f7;
  box-shadow: 0 1px 0 #ddd;
}

/* Double class + element chain beats .content-area table td (theme) */
.atti-table-wrap table.atti-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  border: 1px solid #ddd !important;
  margin-bottom: 0;
  /* Reset inherited section/Elementor accent (e.g. theme primary/magenta) for th/td; delta/num/link rules still override per-cell. */
  color: #1d2327;
}

/* Outer box from table border only; no vertical lines; horizontal row lines */
.atti-table-wrap table.atti-table th,
.atti-table-wrap table.atti-table td {
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: 1px solid #ddd !important;
  padding: 0.5em 0.75em !important;
  vertical-align: top;
}

.atti-table-wrap table.atti-table tbody tr:last-child td {
  border-bottom: none !important;
}

.atti-table-wrap table.atti-table th.atti-padding-tight,
.atti-table-wrap table.atti-table td.atti-padding-tight {
  padding-left: 0.2em !important;
  padding-right: 0.2em !important;
}

.atti-table-wrap table.atti-table > thead > tr > th {
  text-align: left;
}

.atti-table-wrap table.atti-table thead th.atti-align-left,
.atti-table-wrap table.atti-table tbody td.atti-align-left {
  text-align: left;
}

.atti-table-wrap table.atti-table thead th.atti-align-center,
.atti-table-wrap table.atti-table tbody td.atti-align-center {
  text-align: center;
}

.atti-table-wrap table.atti-table thead th.atti-align-right,
.atti-table-wrap table.atti-table tbody td.atti-align-right {
  text-align: right;
}

.atti-table-wrap table.atti-table thead th {
  background: #f6f7f7;
  font-weight: 600;
}

.atti-table-wrap table.atti-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.atti-table-wrap table.atti-table td.atti-num-positive {
  font-weight: 700;
  color: #0d7d0d;
}

.atti-table-wrap table.atti-table td.atti-num-negative {
  font-weight: 700;
  color: #c62828;
}

.atti-table-wrap table.atti-table td.atti-display-tags {
  line-height: 1.6;
}

.atti-table-wrap table.atti-table .atti-tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 0.2em 0.55em;
  font-size: 0.85em;
  font-weight: 600;
  color: #1d2327;
  background: #e8eef5;
  border: 1px solid #c5d0df;
  border-radius: 4px;
}

p.atti-error {
  color: #b32d2e;
}

p.atti-warning {
  color: #996800;
}

.atti-table-wrap .atti-table-last-update {
  margin: 0.65em 0 0;
  padding: 0.5em 0 0;
  font-size: 0.9em;
  color: #50575e;
  border-top: 1px solid #ddd;
}

.atti-table-wrap--scroll .atti-table-last-update {
  margin-top: 0.75em;
  padding-top: 0.65em;
}

.atti-table-wrap .atti-last-update-label {
  font-weight: 600;
  margin-right: 0.35em;
}

.atti-table-wrap table.atti-table a.atti-link {
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.atti-table-wrap table.atti-table a.atti-link:hover,
.atti-table-wrap table.atti-table a.atti-link:focus {
  color: #1e3a8a;
}

/* Δ vs next row (same column): green / red / neutral */
.atti-table-wrap table.atti-table td.atti-delta-cell {
  font-weight: 600;
  white-space: nowrap;
}

.atti-table-wrap table.atti-table td.atti-delta-pos {
  color: #15803d;
}

.atti-table-wrap table.atti-table td.atti-delta-neg {
  color: #b91c1c;
}

.atti-table-wrap table.atti-table td.atti-delta-zero {
  color: #64748b;
  font-weight: 600;
}

.atti-table-wrap table.atti-table td.atti-delta-empty {
  color: #94a3b8;
  font-weight: 400;
}

.atti-table-wrap table.atti-table thead th.atti-th-delta {
  font-size: 0.92em;
}

/* 18k / 22k / 24k trend chart (Chart.js) above table */
.atti-table-wrap .atti-karat-chart-panel {
  margin: 0 0 1rem;
}

.atti-table-wrap .atti-karat-chart-title {
  margin: 0 0 0.65rem;
  padding: 0;
  font-size: 1.1em;
  font-weight: 600;
  line-height: 1.35;
  color: #1d2327;
}

.atti-table-wrap .atti-latest-snapshot {
  margin-top: 0;
  margin-bottom: 2.25rem;
  padding-top: 0;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}

.atti-table-wrap table.atti-latest-snapshot-table {
  width: 100%;
  border-collapse: collapse;
  border: 0 !important;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.atti-table-wrap table.atti-latest-snapshot-table th,
.atti-table-wrap table.atti-latest-snapshot-table td {
  padding: 0.45em 0.6em !important;
  border-bottom: 1px solid #e5e7eb !important;
  font-size: 0.92em;
  white-space: nowrap;
}

.atti-table-wrap table.atti-latest-snapshot-table thead th {
  background: #f6f7f7;
  font-weight: 700;
  color: #1d2327;
}

.atti-table-wrap table.atti-latest-snapshot-table tbody td {
  font-weight: 700;
}

.atti-table-wrap table.atti-latest-snapshot-table .atti-latest-col-date {
  font-weight: 600;
  color: #334155;
}

.atti-table-wrap table.atti-latest-snapshot-table .atti-latest-col-18 {
  color: #5c4a0f;
  text-align: center;
}
.atti-table-wrap table.atti-latest-snapshot-table .atti-latest-col-22 {
  color: #1e3a8a;
  text-align: center;
}
.atti-table-wrap table.atti-latest-snapshot-table .atti-latest-col-24 {
  color: #14532d;
  text-align: center;
}

.atti-table-wrap .atti-karat-chart-wrap {
  position: relative;
  width: 100%;
  height: clamp(320px, 52vh, 520px);
  min-height: 320px;
  max-width: 100%;
}

.atti-table-wrap .atti-karat-chart-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 639px) {
  .atti-table-wrap {
    margin: 0.85rem 0;
  }

  /* Force a horizontal scrollbar when columns overflow on mobile */
  .atti-table-wrap table.atti-table {
    width: max-content;
    min-width: 100%;
  }

  .atti-table-wrap table.atti-table {
    font-size: 0.9em;
  }

  .atti-table-wrap table.atti-table th,
  .atti-table-wrap table.atti-table td {
    padding: 0.45em 0.55em !important;
  }

  .atti-table-wrap .atti-table-last-update {
    font-size: 0.85em;
  }

  .atti-table-wrap .atti-latest-snapshot {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .atti-table-wrap table.atti-latest-snapshot-table {
    width: 100%;
    min-width: 0;
  }

  /* Mobile: transform "Latest" snapshot into 4 rows × 2 columns */
  .atti-table-wrap table.atti-latest-snapshot-table thead {
    display: none;
  }

  .atti-table-wrap table.atti-latest-snapshot-table,
  .atti-table-wrap table.atti-latest-snapshot-table tbody,
  .atti-table-wrap table.atti-latest-snapshot-table tr,
  .atti-table-wrap table.atti-latest-snapshot-table td {
    display: block;
    width: 100%;
  }

  .atti-table-wrap table.atti-latest-snapshot-table tbody td {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    column-gap: 12px;
    white-space: normal;
    border-bottom: 1px solid #e5e7eb !important;
  }

  .atti-table-wrap table.atti-latest-snapshot-table tbody td:last-child {
    border-bottom: none !important;
  }

  .atti-table-wrap table.atti-latest-snapshot-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #1d2327;
    grid-column: 1;
    justify-self: start;
  }

  .atti-table-wrap table.atti-latest-snapshot-table tbody td.atti-latest-col-date {
    font-weight: 700;
    color: #0f172a;
  }

  .atti-table-wrap table.atti-latest-snapshot-table tbody td .atti-latest-value {
    grid-column: 2;
    justify-self: center;
    text-align: center;
  }

  .atti-table-wrap .atti-karat-chart-wrap {
    height: min(460px, 58vh);
    min-height: 340px;
  }
}

/* City comparison bar chart (tabs 18k / 22k / 24k) */
.atti-table-wrap .atti-city-bar-chart-panel {
  margin: 0 0 1rem;
}

.atti-table-wrap .atti-city-bar-chart-title {
  margin: 0;
  padding: 0;
  font-size: 1.1em;
  font-weight: 600;
  line-height: 1.35;
  color: #1d2327;
}

/* Title + tabs on one row; tabs align right (matches full chart width) */
.atti-table-wrap .atti-city-bar-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  width: 100%;
  margin: 0 0 14px;
  box-sizing: border-box;
}

.atti-table-wrap .atti-city-bar-chart-header--tabs-only {
  justify-content: flex-end;
}

.atti-table-wrap .atti-city-bar-chart-header .atti-city-bar-chart-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* Segmented karat tabs: explicit button reset so theme/Elementor does not merge into one “pill” */
.atti-table-wrap .atti-city-bar-chart-tabs {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: nowrap;
  max-width: 100%;
  flex: 0 0 auto;
  margin: 0;
  margin-left: auto;
  padding: 5px;
  gap: 4px;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  background: linear-gradient(180deg, #e4e8ef 0%, #d5dbe4 100%);
  border: 1px solid #b8c0cd;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.atti-table-wrap .atti-city-bar-chart-tabs button.atti-city-bar-tab {
  cursor: pointer;
  position: relative;
  flex: 1 1 auto;
  min-width: 4.75rem;
  margin: 0 !important;
  padding: 0.55em 1.1em 0.5em !important;
  font: inherit !important;
  font-size: 0.9375rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  line-height: 1.25 !important;
  text-align: center;
  border: none !important;
  border-radius: 9px !important;
  border-bottom: 3px solid transparent !important;
  background: transparent !important;
  background-color: transparent !important;
  color: #4a5568 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  text-transform: none;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  -webkit-appearance: none !important;
  appearance: none !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.atti-table-wrap .atti-city-bar-chart-tabs button.atti-city-bar-tab:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.55) !important;
  color: #1d2327 !important;
}

.atti-table-wrap .atti-city-bar-chart-tabs button.atti-city-bar-tab:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
  z-index: 1;
}

.atti-table-wrap .atti-city-bar-chart-tabs button.atti-city-bar-tab.is-active {
  background: #fff !important;
  color: #1d2327 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14), 0 1px 2px rgba(15, 23, 42, 0.06) !important;
}

.atti-table-wrap .atti-city-bar-chart-tabs button.atti-city-bar-tab.is-active[data-karat="18"] {
  border-bottom-color: #b8941f !important;
  color: #5c4a0f !important;
}

.atti-table-wrap .atti-city-bar-chart-tabs button.atti-city-bar-tab.is-active[data-karat="22"] {
  border-bottom-color: #1d4ed8 !important;
  color: #1e3a8a !important;
}

.atti-table-wrap .atti-city-bar-chart-tabs button.atti-city-bar-tab.is-active[data-karat="24"] {
  border-bottom-color: #15803d !important;
  color: #14532d !important;
}

.atti-table-wrap .atti-city-bar-chart-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 639px) {
  .atti-table-wrap .atti-karat-chart-title {
    text-align: center;
  }

  .atti-table-wrap .atti-city-bar-chart-header {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .atti-table-wrap .atti-city-bar-chart-header .atti-city-bar-chart-title {
    text-align: center;
    width: 100%;
  }

  .atti-table-wrap .atti-city-bar-chart-tabs {
    margin-left: 0;
  }

  .atti-table-wrap .atti-city-bar-chart-wrap {
    height: auto;
  }
}

.atti-table-wrap .atti-city-bar-chart-canvas {
  display: block;
  width: 100% !important;
  height: clamp(320px, 52vh, 520px) !important;
  min-height: 320px;
}

@media (max-width: 639px) {
  .atti-table-wrap .atti-city-bar-chart-canvas {
    height: min(460px, 58vh) !important;
    min-height: 340px;
  }
}
