/* ── page header ── */
.page-header {
  margin-bottom: 2rem;
}
.page-header h1 {
  font-size: 1.75rem;
  margin: 0;
}
.page-header p {
  color: var(--foreground-light);
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
}

/* ── search ── */
.search-section {
  margin-bottom: 2rem;
}
.search-box {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
}
.search-box input {
  flex: 1;
}
.search-results {
  position: absolute;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  max-height: 360px;
  overflow-y: auto;
  display: none;
  width: 500px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.search-results.open { display: block; }
.search-result-item {
  padding: 0.625rem 0.75rem;
  cursor: pointer;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--border); }

/* ── card grid ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 1024px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .card-grid { grid-template-columns: 1fr; } }

.card-item {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
}
.card-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.card-item .bank-name {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--foreground-light);
}
.card-item .card-name {
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.3;
}
.card-item .card-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--foreground-light);
}
.card-item .card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.card-item .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
}
.tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--background-alt);
  color: var(--foreground-light);
}
.tag.primary { background: var(--primary); color: #fff; }

/* ── detail page ── */
.detail-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.detail-header .card-image {
  width: 140px;
  height: 88px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  flex-shrink: 0;
  background: #fafafa;
}
.detail-header .card-info { flex: 1; min-width: 200px; }
.detail-header .card-info h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
.detail-header .card-info .subtitle { color: var(--foreground-light); font-size: 0.875rem; }

.stats-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.stat-box {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  text-align: center;
  min-width: 100px;
}
.stat-box .stat-value { font-size: 1.125rem; font-weight: 600; }
.stat-box .stat-label { font-size: 0.6875rem; color: var(--foreground-light); text-transform: uppercase; letter-spacing: 0.05em; }

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.benefit-list, .pros-list, .cons-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.benefit-list li, .pros-list li, .cons-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.5;
}
.benefit-list li:last-child, .pros-list li:last-child, .cons-list li:last-child { border-bottom: none; }
.pros-list li::before { content: "✓ "; color: #16a34a; font-weight: 700; }
.cons-list li::before { content: "✗ "; color: #dc2626; font-weight: 700; }

.fee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.fee-table th, .fee-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.fee-table th { font-weight: 600; background: var(--background-alt); }

/* ── compare page ── */
.compare-wrapper { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  min-width: 600px;
}
.compare-table th, .compare-table td {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  text-align: center;
  vertical-align: top;
}
.compare-table th {
  background: var(--background-alt);
  font-weight: 600;
  min-width: 140px;
}
.compare-table td:first-child {
  text-align: left;
  font-weight: 500;
  background: var(--background-alt);
  white-space: nowrap;
  position: sticky;
  left: 0;
}
.compare-table .card-col { min-width: 200px; }
.compare-table .card-col img {
  width: 100px;
  height: 63px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
}
.compare-table .card-col .card-name { font-weight: 600; font-size: 0.875rem; display: block; }
.compare-table .card-col .bank-name { font-size: 0.6875rem; color: var(--foreground-light); }
.compare-table .yes { color: #16a34a; font-weight: 600; }
.compare-table .no  { color: #dc2626; }
.compare-table .check { color: #16a34a; }
.compare-table .cross { color: #dc2626; }

/* ── filter bar ── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}
.filter-bar select, .filter-bar input {
  max-width: 200px;
}

/* ── loading ── */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--foreground-light);
  font-size: 0.875rem;
}

/* ── pagination ── */
.pagination {
  margin-top: 2rem;
}
.pagination-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}
.page-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.page-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--primary);
}
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.page-ellipsis {
  padding: 0.375rem 0.25rem;
  color: var(--foreground-light);
  font-size: 0.8125rem;
}
.page-info {
  margin-left: 0.75rem;
  font-size: 0.75rem;
  color: var(--foreground-light);
}

/* ── compare buttons on cards ── */
.card-item .card-footer {
  gap: 0.5rem;
}
.compare-btn {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  color: var(--foreground-light);
  transition: all 0.12s;
  flex-shrink: 0;
}
.compare-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.compare-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── compare bar ── */
.compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  z-index: 1000;
  padding: 0.625rem 1rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.compare-bar.visible { display: flex; }
.compare-bar .cb-label {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.compare-bar .cb-cards {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 0.125rem 0;
}
.compare-bar .cb-card {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  background: var(--background-alt);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
}
.compare-bar .cb-card .cb-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--foreground-light);
}
.compare-bar .cb-card .cb-remove:hover { color: var(--danger); }
.compare-bar .cb-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.compare-bar .cb-clear {
  background: none;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--foreground-light);
}
.compare-bar .cb-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.compare-bar .cb-compare {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border: none;
  border-radius: 0.25rem;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.compare-bar .cb-compare:disabled {
  opacity: 0.5;
  cursor: default;
}
@media (max-width: 768px) {
  .compare-bar { padding: 0.5rem; gap: 0.5rem; }
  .compare-bar .cb-label { font-size: 0.75rem; }
  .compare-bar .cb-card { font-size: 0.6875rem; }
}
@media (max-width: 480px) {
  .compare-bar .cb-label { display: none; }
  .compare-bar .cb-cards { flex: 1 1 100%; order: -1; }
}

/* ── Bottom padding for compare bar ── */
main { padding-bottom: 60px; }

@media (max-width: 768px) {
  .detail-header .card-image { width: 100px; height: 63px; }
  .stats-row { gap: 0.75rem; }
  .stat-box { min-width: 80px; padding: 0.5rem 0.75rem; }
  .filter-bar select, .filter-bar input { max-width: 100%; }
}
