/* ===================== PRICE CATEGORIES ===================== */
.price-category {
  margin-bottom: var(--space-lg);
}

.price-category:last-child {
  margin-bottom: 0;
}

.price-category__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-sm);
  padding: 0 4px;
}

.price-category__icon {
  font-size: 16px;
  line-height: 1;
}

.price-category__label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
}

/* ===================== PRICE TABLE ===================== */
.price-table-wrapper {
  background: var(--color-bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(0,0,0,0.05);
  -webkit-overflow-scrolling: touch;
}

.price-table {
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.price-table thead {
  background: var(--color-bg);
}

.price-table th {
  padding: 12px var(--space-md);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.price-table th:nth-child(2),
.price-table th:nth-child(3),
.price-table th:nth-child(4) {
  text-align: right;
}

.price-table td {
  padding: 14px var(--space-md);
  font-size: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  vertical-align: middle;
}

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

.price-table tbody tr {
  transition: background-color var(--transition-fast);
}

.price-table tbody tr:hover {
  background: rgba(212, 160, 23, 0.04);
}

.price-table .col-name {
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.price-table .col-price {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  transition: color 0.2s ease;
  transform-origin: center right;
}

.price-table .col-change {
  text-align: right;
}

.price-table .col-chart {
  width: 80px;
  padding: var(--space-xs) var(--space-xs);
}

/* Flash animation — row */
.flash-up   { animation: flashRowGreen 3s ease-out; }
.flash-down { animation: flashRowRed   3s ease-out; }

@keyframes flashRowGreen {
  0%, 40% { background-color: rgba(16,185,129,0.18); }
  100%    { background-color: transparent; }
}
@keyframes flashRowRed {
  0%, 40% { background-color: rgba(239,68,68,0.15); }
  100%    { background-color: transparent; }
}


/* ===================== COMPARE TABLE ===================== */
.compare-header,
.compare-subheader,
.compare-row {
  display: grid;
  align-items: center;
}

.compare-header {
  background: var(--color-bg);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.compare-header__name {
  padding: 12px var(--space-md);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}

.compare-header__source {
  grid-column: span 2;
  text-align: center;
  padding: 10px var(--space-sm);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--source-color, var(--color-text));
  border-bottom: 3px solid var(--source-color, var(--color-gold));
  background: color-mix(in srgb, var(--source-color) 6%, var(--color-bg));
}

.compare-subheader {
  background: var(--color-bg);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.compare-subheader__cell {
  padding: 6px var(--space-md);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  text-align: right;
}

.compare-row {
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: background-color var(--transition-fast);
}

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

.compare-row:hover {
  background: rgba(212, 160, 23, 0.04);
}

.compare-row__name {
  padding: 14px var(--space-md);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-text);
}

.compare-row__price {
  padding: 14px var(--space-md);
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  min-width: 75px;
  white-space: nowrap;
}

.compare-row__price.best-price {
  font-weight: 700;
}


/* ===================== LOADING BAR ===================== */
.loading-bar {
  background: var(--color-bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(212,160,23,0.15);
  padding: 24px;
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.loading-bar.hidden { display: none; }

.loading-bar__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(212,160,23,0.2);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-bar__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.loading-bar__sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.loading-bar__progress {
  width: 100%;
  max-width: 300px;
  height: 6px;
  background: var(--color-bg);
  border-radius: 3px;
  overflow: hidden;
}

.loading-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.compare-row__slabel { display: none; }
.compare-row__sdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.source-tabs { display: none; }
.mob-hide { /* desktop: no effect */ }

/* ===================== SOURCE STATUS ===================== */
.source-status {
  display: flex;
  gap: 8px;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-bg-white);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow-sm);
}

.source-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.source-pill__dot--connected {
  background: var(--color-up);
  box-shadow: 0 0 6px rgba(16,185,129,0.4);
}

.source-pill__dot--error {
  background: var(--color-down);
}

.source-pill__dot--connecting {
  background: var(--color-gold);
  animation: pulse 2s infinite;
}

.source-pill__name {
  font-weight: 600;
}

.source-pill__status {
  color: var(--color-text-muted);
  font-size: 11px;
}

/* ===================== TICKER SOURCE ===================== */
.ticker__source {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===================== CHANGE BADGE ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

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

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

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

/* ===================== CALCULATOR ===================== */
.calculator {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(212,160,23,0.12);
  position: relative;
  overflow: hidden;
}

.calculator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light), var(--color-gold));
}

.calculator__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  letter-spacing: -0.02em;
}

.calculator__title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--color-gold) 0%, var(--color-gold-light) 100%);
  border-radius: 4px;
}

.calculator__form {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.calculator__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.calculator__field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calculator__field select,
.calculator__field input {
  height: 46px;
  padding: 0 var(--space-md);
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: 15px;
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.calculator__field select:focus,
.calculator__field input:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.12);
  background: var(--color-bg-white);
}

.calculator__results {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.calculator__result-card {
  flex: 1;
  min-width: 120px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  transition: all var(--transition-spring);
  border: 1px solid rgba(0,0,0,0.04);
}

.calculator__result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  background: var(--color-bg-white);
}

.calculator__result-label {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.calculator__result-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

/* ===================== CHART ===================== */
.chart-section {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  border: 1px solid rgba(0,0,0,0.05);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.chart-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.chart-tabs {
  display: flex;
  gap: 2px;
  background: var(--color-bg);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.chart-tab {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  transition: all var(--transition-fast);
  color: var(--color-text-muted);
}

.chart-tab:hover {
  color: var(--color-text);
  background: rgba(0,0,0,0.04);
}

.chart-tab.active {
  background: var(--color-text);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}

.chart-canvas-wrapper {
  width: 100%;
  height: 280px;
  position: relative;
}

.chart-canvas-wrapper canvas {
  width: 100%;
  height: 100%;
}

/* ===================== MOBILE CARD VIEW ===================== */
@media (max-width: 640px) {
  .price-category {
    margin-bottom: var(--space-md);
  }

  .price-category__header {
    padding: 0 var(--space-xs);
    margin-bottom: 8px;
  }

  .price-category__icon {
    font-size: 14px;
  }

  .price-category__label {
    font-size: 11px;
    letter-spacing: 1.2px;
  }

  .price-table-wrapper {
    background: transparent;
    box-shadow: none;
    border: none;
  }

  .price-table thead { display: none; }

  .price-table,
  .price-table tbody {
    display: block;
  }

  .price-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px var(--space-sm);
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin-bottom: 8px;
    padding: 16px;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.04);
    transition: all var(--transition-fast);
  }

  .price-table tr:active {
    transform: scale(0.985);
    box-shadow: var(--shadow-sm);
  }

  .price-table td {
    display: block;
    border: none;
    padding: 0;
    font-size: 15px;
  }

  /* Row 1: Name (left) + Badge (right) */
  .price-table .col-name {
    grid-column: 1;
    grid-row: 1;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
  }

  .price-table .col-change {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  /* Row 2: Alis (left) + Satis (right) */
  .price-table .col-price {
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
  }

  .price-table .col-price:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .price-table .col-price:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
  }

  .price-table .col-price::before {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
  }

  .price-table td:nth-child(2)::before {
    content: "Alis ";
    color: var(--color-up);
  }
  .price-table td:nth-child(3)::before {
    content: "Satis ";
    color: var(--color-down);
  }

  /* Hide sparkline on mobile */
  .price-table .col-chart { display: none; }

  /* Zebra disable on mobile */
  .price-table tbody tr:nth-child(even) {
    background: var(--color-bg-white);
  }

  /* Badge mobile */
  .badge {
    font-size: 12px;
    padding: 4px 10px;
  }

  /* Calculator mobile */
  .calculator {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }

  .calculator__title {
    font-size: 15px;
    margin-bottom: var(--space-md);
  }

  .calculator__field {
    min-width: 100%;
  }

  .calculator__field select,
  .calculator__field input {
    height: 50px;
    font-size: 16px;
  }

  .calculator__results {
    gap: var(--space-sm);
  }

  .calculator__result-card {
    min-width: calc(50% - 4px);
    padding: var(--space-md) var(--space-sm);
  }

  .calculator__result-value {
    font-size: 18px;
  }

  /* Chart mobile */
  .chart-section {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .chart-canvas-wrapper {
    height: 220px;
  }

  .section-title {
    font-size: 16px;
    margin-bottom: var(--space-sm);
  }

  .section-title::before {
    height: 18px;
    width: 3px;
  }

  /* Chart tab mobile */
  .chart-tab {
    font-size: 13px;
    padding: 8px 18px;
  }
}

@media (max-width: 640px) {
  /* Kaynak tab'lari */
  .source-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .source-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-bg);
    color: var(--color-text-muted);
    transition: all 0.2s;
  }

  .source-tab.active {
    background: var(--sc, var(--color-gold));
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }

  .compare-header,
  .compare-subheader {
    display: none !important;
  }

  /* Mobil: source label gizle (tab var), sadece alis/satis goster */
  .compare-row__slabel { display: none; }
  .mob-hide { display: none !important; }

  .price-table-wrapper {
    overflow: visible;
  }

  .compare-row {
    display: grid;
    grid-template-columns: 2fr 1.3fr 1.3fr !important;
    gap: 0;
    padding: 0;
    min-width: 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }

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

  .compare-row__name {
    padding: 12px 10px;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .compare-row__price {
    padding: 12px 4px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    background: none !important;
    min-width: 0;
    white-space: nowrap;
  }

  .source-status {
    gap: 6px;
    flex-wrap: wrap;
  }

  .source-pill {
    font-size: 10px;
    padding: 3px 8px;
  }
}

/* Small mobile */
@media (max-width: 360px) {
  .price-table tr {
    padding: 14px 12px;
  }

  .price-table .col-name {
    font-size: 14px;
  }

  .price-table .col-price {
    font-size: 14px;
  }

  .badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  .calculator__result-value {
    font-size: 17px;
  }
}
