/* ==========================================================================
   Affiliate Product Manager - Front-end Styles
   Mobile-first, lightweight, AdSense-friendly
   ========================================================================== */

:root {
	--apm-primary: #ff6b35;
	--apm-secondary: #2b6cb0;
	--apm-text: #1a202c;
	--apm-muted: #718096;
	--apm-border: #e2e8f0;
	--apm-bg-light: #f7fafc;
	--apm-success: #38a169;
	--apm-radius: 8px;
}

/* ---------------- Breadcrumbs ---------------- */
.apm-breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	list-style: none;
	padding: 0;
	margin: 0 0 16px;
	font-size: 0.85rem;
	color: var(--apm-muted);
}
.apm-breadcrumbs li:not(:last-child)::after {
	content: "›";
	margin: 0 6px;
}
.apm-breadcrumbs a {
	color: var(--apm-secondary);
	text-decoration: none;
}

/* ---------------- Product Grid ---------------- */
.apm-product-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin: 20px 0;
}
@media (min-width: 600px) {
	.apm-product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 992px) {
	.apm-product-grid { grid-template-columns: repeat(4, 1fr); }
}
.apm-carousel {
	grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 992px) {
	.apm-carousel { grid-template-columns: repeat(4, 1fr); }
}

/* ---------------- Product Card ---------------- */
.apm-product-card {
	background: #fff;
	border: 1px solid var(--apm-border);
	border-radius: var(--apm-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.apm-product-card:hover {
	box-shadow: 0 6px 18px rgba(0,0,0,0.08);
	transform: translateY(-2px);
}
.apm-card-image-link {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--apm-bg-light);
}
.apm-card-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.apm-discount-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: var(--apm-primary);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 4px;
}
.apm-card-body {
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}
.apm-card-title {
	font-size: 0.95rem;
	margin: 0;
	line-height: 1.3;
}
.apm-card-title a {
	color: var(--apm-text);
	text-decoration: none;
}
.apm-card-desc {
	font-size: 0.8rem;
	color: var(--apm-muted);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---------------- Marketplace Badges ---------------- */
.apm-badge {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 3px 8px;
	border-radius: 4px;
	color: #fff;
	width: fit-content;
}
.apm-badge-amazon { background: #ff9900; }
.apm-badge-aliexpress { background: #e62e04; }
.apm-badge-alibaba { background: #ff6a00; }
.apm-badge-temu { background: #fb6f3a; }
.apm-badge-etsy { background: #f1641e; }
.apm-badge-ebay { background: #e53238; }
.apm-badge-daraz { background: #f85606; }

/* ---------------- Star Rating ---------------- */
.apm-stars {
	display: inline-flex;
	align-items: center;
	gap: 1px;
	font-size: 0.95rem;
	color: #f6ad55;
}
.apm-star-empty { color: var(--apm-border); }
.apm-rating-number {
	margin-left: 4px;
	font-size: 0.8rem;
	color: var(--apm-muted);
}

/* ---------------- Price ---------------- */
.apm-card-price, .apm-product-price-block {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}
.apm-price-current {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--apm-success);
}
.apm-price-old {
	font-size: 0.85rem;
	color: var(--apm-muted);
	text-decoration: line-through;
}
.apm-card-updated {
	font-size: 0.7rem;
	color: var(--apm-muted);
	margin: 0;
}

/* ---------------- Buttons ---------------- */
.apm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	border-radius: var(--apm-radius);
	font-weight: 600;
	font-size: 0.9rem;
	text-decoration: none;
	border: 2px solid transparent;
	cursor: pointer;
	transition: opacity 0.15s ease;
	min-height: 44px; /* touch target */
}
.apm-btn:hover { opacity: 0.9; }
.apm-btn-primary {
	background: var(--apm-primary);
	color: #fff;
}
.apm-btn-secondary {
	background: var(--apm-secondary);
	color: #fff;
}
.apm-btn-outline {
	background: transparent;
	border-color: var(--apm-border);
	color: var(--apm-text);
}
.apm-btn-large {
	padding: 14px 24px;
	font-size: 1rem;
	width: 100%;
}
.apm-btn-small {
	padding: 6px 12px;
	font-size: 0.8rem;
	min-height: auto;
}
.apm-cta-buttons {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 16px 0;
}
@media (min-width: 600px) {
	.apm-cta-buttons { flex-direction: row; }
	.apm-btn-large { width: auto; flex: 1; }
}
.apm-extra-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}

/* ---------------- Single Product Page ---------------- */
.apm-single-product {
	max-width: 1100px;
	margin: 0 auto;
	padding: 16px;
}
.apm-product-top {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
	margin-bottom: 24px;
}
@media (min-width: 768px) {
	.apm-product-top { grid-template-columns: 1fr 1fr; }
}

/* Gallery */
.apm-gallery-main {
	border: 1px solid var(--apm-border);
	border-radius: var(--apm-radius);
	overflow: hidden;
	background: var(--apm-bg-light);
	aspect-ratio: 1 / 1;
}
#apm-main-image {
	width: 100%;
	height: 100%;
	object-fit: contain;
	cursor: zoom-in;
	transition: transform 0.3s ease;
}
.apm-gallery-thumbs {
	display: flex;
	gap: 8px;
	margin-top: 8px;
	overflow-x: auto;
}
.apm-gallery-thumb {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 4px;
	border: 2px solid transparent;
	cursor: pointer;
	flex-shrink: 0;
}
.apm-gallery-thumb.active,
.apm-gallery-thumb:hover {
	border-color: var(--apm-primary);
}

/* Product Summary */
.apm-product-title {
	font-size: 1.6rem;
	margin: 8px 0;
	line-height: 1.25;
}
.apm-last-updated {
	font-size: 0.8rem;
	color: var(--apm-muted);
}
.apm-affiliate-disclosure {
	background: var(--apm-bg-light);
	border: 1px solid var(--apm-border);
	border-radius: var(--apm-radius);
	padding: 10px 14px;
	font-size: 0.78rem;
	color: var(--apm-muted);
	margin-top: 12px;
}

/* Sections */
.apm-section {
	margin: 32px 0;
}
.apm-section h2 {
	font-size: 1.3rem;
	margin-bottom: 12px;
	border-bottom: 2px solid var(--apm-border);
	padding-bottom: 6px;
}
.apm-feature-list,
.apm-benefit-list,
.apm-usecase-list {
	padding-left: 20px;
	line-height: 1.7;
}

/* Specs Table */
.apm-table-wrap { overflow-x: auto; }
.apm-specs-table,
.apm-comparison-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}
.apm-specs-table th, .apm-specs-table td,
.apm-comparison-table th, .apm-comparison-table td {
	border: 1px solid var(--apm-border);
	padding: 10px 12px;
	text-align: left;
}
.apm-specs-table th {
	width: 35%;
	background: var(--apm-bg-light);
	font-weight: 600;
}
.apm-comparison-table th {
	background: var(--apm-bg-light);
}
.apm-comparison-current {
	background: #fff8f0;
}
.apm-tag {
	font-size: 0.7rem;
	background: var(--apm-primary);
	color: #fff;
	padding: 2px 6px;
	border-radius: 4px;
	margin-left: 6px;
}

/* Pros & Cons */
.apm-proscons-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}
@media (min-width: 600px) {
	.apm-proscons-grid { grid-template-columns: 1fr 1fr; }
}
.apm-pros, .apm-cons {
	border-radius: var(--apm-radius);
	padding: 16px;
}
.apm-pros { background: #f0fff4; border: 1px solid #c6f6d5; }
.apm-cons { background: #fff5f5; border: 1px solid #fed7d7; }
.apm-pros h3 { color: var(--apm-success); margin-top: 0; }
.apm-cons h3 { color: #e53e3e; margin-top: 0; }
.apm-pros ul, .apm-cons ul { padding-left: 20px; margin: 0; line-height: 1.7; }

/* FAQ Accordion */
.apm-faq-item {
	border: 1px solid var(--apm-border);
	border-radius: var(--apm-radius);
	margin-bottom: 8px;
	padding: 0;
}
.apm-faq-question {
	padding: 14px;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}
.apm-faq-question::-webkit-details-marker { display: none; }
.apm-faq-answer {
	padding: 0 14px 14px;
	color: var(--apm-muted);
}

/* Related items */
.apm-related-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}
@media (min-width: 768px) {
	.apm-related-grid { grid-template-columns: repeat(3, 1fr); }
}
.apm-related-item {
	display: block;
	text-decoration: none;
	color: var(--apm-text);
	border: 1px solid var(--apm-border);
	border-radius: var(--apm-radius);
	overflow: hidden;
}
.apm-related-item img {
	width: 100%;
	aspect-ratio: 16/9;
	object-fit: cover;
	display: block;
}
.apm-related-title {
	display: block;
	padding: 8px;
	font-size: 0.85rem;
	font-weight: 600;
}

/* Author Box */
.apm-author-box {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	background: var(--apm-bg-light);
	border-radius: var(--apm-radius);
	padding: 16px;
}
.apm-author-avatar img { border-radius: 50%; }
.apm-author-name { font-weight: 700; margin: 0 0 4px; }
.apm-author-bio { font-size: 0.85rem; color: var(--apm-muted); margin: 0; }

/* Social Sharing */
.apm-share-buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 20px 0;
}
.apm-share-label { font-weight: 600; }
.apm-share {
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 0.8rem;
	text-decoration: none;
	color: #fff;
}
.apm-share-facebook { background: #1877f2; }
.apm-share-twitter { background: #000; }
.apm-share-pinterest { background: #e60023; }
.apm-share-whatsapp { background: #25d366; }

/* Table of Contents */
.apm-toc {
	background: var(--apm-bg-light);
	border: 1px solid var(--apm-border);
	border-radius: var(--apm-radius);
	padding: 16px;
	margin-bottom: 24px;
}
.apm-toc-title { font-weight: 700; margin: 0 0 8px; }
.apm-toc ul { margin: 0; padding-left: 18px; }
.apm-toc-sub { margin-left: 16px; list-style-type: circle; }
.apm-toc a { color: var(--apm-secondary); text-decoration: none; }

/* ---------------- Sticky Mobile CTA ---------------- */
.apm-sticky-mobile-cta {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: #fff;
	border-top: 1px solid var(--apm-border);
	box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
	z-index: 999;
}
.apm-sticky-mobile-cta .apm-btn {
	width: auto;
	flex-shrink: 0;
}
.apm-sticky-mobile-info {
	display: flex;
	flex-direction: column;
	font-size: 0.85rem;
}
@media (min-width: 992px) {
	.apm-sticky-mobile-cta { display: none; }
}

/* Add bottom padding on mobile so sticky bar doesn't overlap content */
@media (max-width: 991px) {
	.apm-single-product { padding-bottom: 80px; }
}
