/**
 * ComparePress component styles (cards, comparison tables, stars, CTAs,
 * ranking, buttons). Uses --cp-* custom properties with fallbacks so the
 * plugin renders reasonably even without the ComparePress theme, and inherits
 * the theme's palette when present.
 */

:root {
	--cp-accent: #16604f;
	--cp-accent-ink: #0e4a3d;
	--cp-accent-soft: #e4efec;
	--cp-ink: #1d2730;
	--cp-muted: #5b6772;
	--cp-surface: #ffffff;
	--cp-line: #dbe1e4;
	--cp-star: #e8a417;
	--cp-radius: 10px;
}

/* ---- Buttons ---- */
.cp-btn,
.cp-add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font: inherit;
	font-weight: 700;
	line-height: 1.2;
	padding: 10px 18px;
	border-radius: 8px;
	border: 1px solid var(--cp-accent);
	background: var(--cp-accent);
	color: #fff;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: filter .15s ease, background .15s ease;
}
/* Compact add-button inside the comparison table so the label never wraps
   vertically in the narrow 資料 column (the table scrolls horizontally instead). */
.cp-compare .cp-add {
	padding: 8px 14px;
	font-size: 0.85rem;
}
.cp-btn:hover,
.cp-add:hover { filter: brightness( 1.08 ); }
.cp-btn--ghost {
	background: transparent;
	color: var(--cp-accent);
}
.cp-btn--ghost:hover { background: var(--cp-accent-soft); filter: none; }
.cp-btn--lg { padding: 14px 28px; font-size: 1.05rem; }
.cp-add.is-incart {
	background: var(--cp-accent-soft);
	color: var(--cp-accent-ink);
}
.cp-add.is-incart::before { content: "\2713\00a0"; }

/* ---- Stars ---- */
.cp-stars {
	position: relative;
	display: inline-block;
	white-space: nowrap;
	line-height: 1;
	font-size: 1rem;
	vertical-align: middle;
}
.cp-stars__bg { color: var(--cp-line); }
.cp-stars__fg {
	position: absolute;
	inset: 0;
	overflow: hidden;
	color: var(--cp-star);
}
.cp-stars__meta {
	margin-left: 6px;
	font-size: .85em;
	color: var(--cp-muted);
	font-weight: 700;
	vertical-align: middle;
}

/* ---- Service card ---- */
.cp-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: var(--cp-surface);
	border: 1px solid var(--cp-line);
	border-radius: var(--cp-radius);
	padding: 20px;
}
.cp-card__shotlink { display: block; }
.cp-card__screenshot {
	display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover;
	border-radius: 8px; border: 1px solid var(--cp-line);
}
.cp-card__head { display: flex; gap: 14px; align-items: flex-start; }
.cp-card__logo,
.cp-card__logolink img { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; flex: 0 0 auto; }
.cp-card__logoph {
	display: flex; align-items: center; justify-content: center;
	width: 72px; height: 72px; border-radius: 8px;
	background: var(--cp-accent-soft); color: var(--cp-accent-ink);
	font-size: 11px; font-weight: 700; text-align: center; padding: 4px;
}
.cp-card__title { flex: 1 1 auto; min-width: 0; }
.cp-card__title h3 { margin: 0 0 4px; font-size: 1.1rem; line-height: 1.4; }
.cp-card__title a { color: var(--cp-ink); text-decoration: none; }
.cp-card__title a:hover { color: var(--cp-accent); }
.cp-card__specs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1px;
	margin: 0;
	background: var(--cp-line);
	border: 1px solid var(--cp-line);
	border-radius: 8px;
	overflow: hidden;
}
.cp-card__specs > div { background: var(--cp-surface); padding: 8px 12px; }
.cp-card__specs dt { font-size: 11px; color: var(--cp-muted); margin: 0; }
.cp-card__specs dd { margin: 2px 0 0; font-weight: 700; font-size: .95rem; }
.cp-card__features { margin: 0; padding-left: 1.1em; font-size: .9rem; color: var(--cp-muted); }
.cp-card__features li { margin: 2px 0; }
.cp-card__actions { display: flex; gap: 10px; margin-top: auto; }
.cp-card__actions .cp-add,
.cp-card__actions .cp-btn { flex: 1; }

/* ---- Comparison table ---- */
.cp-tablewrap { overflow-x: auto; border: 1px solid var(--cp-line); border-radius: var(--cp-radius); }
.cp-compare {
	width: 100%;
	border-collapse: collapse;
	background: var(--cp-surface);
	font-size: .92rem;
	min-width: 640px;
}
.cp-compare th,
.cp-compare td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--cp-line); vertical-align: middle; }
.cp-compare thead th { background: var(--cp-accent-soft); color: var(--cp-accent-ink); font-size: 12px; white-space: nowrap; }
.cp-compare tbody tr:last-child th,
.cp-compare tbody tr:last-child td { border-bottom: 0; }
.cp-compare__name a { display: flex; align-items: center; gap: 10px; color: var(--cp-ink); text-decoration: none; font-weight: 700; }
.cp-compare__name a:hover { color: var(--cp-accent); }
.cp-compare__logo { width: 72px; height: 40px; object-fit: contain; object-position: left center; border-radius: 4px; flex: 0 0 auto; }
.cp-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pin the CTA ("資料") column to the right edge of the scroll area so it
   never disappears off-screen on narrow viewports — without this, the
   request-document button is only reachable by discovering horizontal
   scroll, which many mobile visitors never do. */
.cp-compare th:last-child,
.cp-compare td:last-child {
	position: sticky;
	right: 0;
	z-index: 1;
	background: var(--cp-surface);
	box-shadow: -6px 0 8px -6px rgba(0, 0, 0, .15);
}
.cp-compare thead th:last-child { background: var(--cp-accent-soft); }

/* ---- Bulk CTA ---- */
.cp-bulkcta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	background: var(--cp-accent-soft);
	border: 1px solid var(--cp-accent);
	border-radius: var(--cp-radius);
	padding: 22px 26px;
}
.cp-bulkcta__lead { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--cp-accent-ink); }
.cp-bulkcta__sub { margin: 2px 0 0; font-size: .85rem; color: var(--cp-muted); }

/* ---- Ranking ---- */
.cp-ranking { list-style: none; margin: 0; padding: 0; counter-reset: cpr; }
.cp-ranking__item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--cp-line); }
.cp-ranking__item:last-child { border-bottom: 0; }
.cp-ranking__no {
	flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: var(--cp-ink); color: #fff; font-weight: 700; font-size: 14px;
}
.cp-ranking__item:nth-child(1) .cp-ranking__no { background: #d4af37; }
.cp-ranking__item:nth-child(2) .cp-ranking__no { background: #a8b0b8; }
.cp-ranking__item:nth-child(3) .cp-ranking__no { background: #c08457; }
.cp-ranking__logo { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; flex: 0 0 auto; background: #f4f5f4; padding: 4px; box-sizing: border-box; }
.cp-ranking__body { display: flex; flex-direction: column; gap: 2px; }
.cp-ranking__body a { color: var(--cp-ink); text-decoration: none; font-weight: 700; }
.cp-ranking__body a:hover { color: var(--cp-accent); }
.cp-ranking__price { font-size: .85rem; color: var(--cp-muted); }

.cp-empty { color: var(--cp-muted); font-style: italic; }

@media ( max-width: 560px ) {
	.cp-card__actions { flex-direction: column; }
	.cp-bulkcta { flex-direction: column; align-items: stretch; text-align: center; }
	.cp-bulkcta .cp-btn { width: 100%; }
}
