/* =============================================
   AffiliatePress Theme - Main Stylesheet
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; font-size: 16px; line-height: 1.7; color: #1a1a1a; background: #fff; }

/* --- Skip Link --- */
.skip-link { position: absolute; top: -1000px; left: 6px; z-index: 1000; padding: 8px 16px; background: #222; color: #fff; text-decoration: none; }
.skip-link:focus { top: 6px; color: #fff; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { line-height: 1.3; margin-bottom: 0.5em; color: #111; }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
p { margin-bottom: 1em; }
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* --- Screen Reader --- */
.screen-reader-text { border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal; }

/* --- Header --- */
.site-header { background: #fff; border-bottom: 1px solid #e5e5e5; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.site-title { font-size: 1.4rem; font-weight: 700; color: #111; text-decoration: none; }
.site-description { font-size: 0.85rem; color: #666; display: block; }

/* --- Navigation --- */
.main-navigation ul { list-style: none; display: flex; gap: 20px; margin: 0; }
.main-navigation a { color: #333; font-size: 0.95rem; font-weight: 500; padding: 4px 0; }
.main-navigation a:hover { color: #0066cc; text-decoration: none; }
.main-navigation .current-menu-item a { color: #0066cc; }
.menu-toggle { display: none; background: none; border: 1px solid #ddd; padding: 8px 14px; cursor: pointer; border-radius: 4px; }

/* --- Content Area --- */
.content-area { max-width: 1200px; margin: 0 auto; padding: 40px 20px; display: grid; grid-template-columns: 1fr 320px; gap: 40px; }
body:not(.has-sidebar) .content-area { grid-template-columns: 1fr; }

/* --- Posts Grid --- */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }

/* --- Post Card --- */
.post-card { background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; overflow: hidden; transition: box-shadow 0.2s; }
.post-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.post-card-image img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card-body { padding: 20px; }
.post-card-title { font-size: 1.2rem; margin-bottom: 8px; }
.post-card-title a { color: #111; }
.post-card-title a:hover { color: #0066cc; text-decoration: none; }
.post-card-meta { font-size: 0.85rem; color: #888; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; }
.post-card-excerpt { font-size: 0.95rem; color: #555; }
.ap-card-rating { background: #f5a623; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.post-card-badge { display: inline-block; padding: 2px 10px; background: #0066cc; color: #fff; font-size: 0.75rem; font-weight: 600; border-radius: 4px; text-transform: uppercase; margin-bottom: 8px; }

/* --- Single Post --- */
.single-post, .single-page { max-width: 800px; }
.post-header { margin-bottom: 32px; }
.post-title { font-size: 2.2rem; margin-bottom: 12px; }
.post-meta { font-size: 0.9rem; color: #888; display: flex; flex-wrap: wrap; gap: 8px; }
.post-meta a { color: #555; }
.post-content { font-size: 1.05rem; line-height: 1.8; }
.post-content h2 { margin-top: 2em; }
.post-content h3 { margin-top: 1.5em; }
.post-content p { margin-bottom: 1.2em; }
.post-content ul, .post-content ol { margin: 0 0 1.2em 1.5em; }
.post-content li { margin-bottom: 0.4em; }
.post-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid #e8e8e8; }

/* --- Breadcrumbs --- */
.breadcrumbs { margin-bottom: 16px; font-size: 0.85rem; color: #888; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs a { color: #555; }
.breadcrumbs a:hover { color: #0066cc; }
.breadcrumbs .separator { color: #ccc; }
.breadcrumbs [aria-current="page"] { color: #333; font-weight: 500; }

/* --- Product Review Hero --- */
.ap-review-hero { display: flex; gap: 32px; align-items: flex-start; margin-bottom: 40px; padding: 24px; background: #f8f9fa; border-radius: 12px; }
.ap-review-hero-image { flex: 0 0 280px; }
.ap-review-hero-image img { width: 100%; border-radius: 8px; }
.ap-review-hero-info { flex: 1; }
.ap-review-product-title { font-size: 1.4rem; margin-bottom: 12px; }
.ap-review-hero-price { font-size: 1.8rem; font-weight: 700; color: #111; margin-bottom: 12px; }

/* --- Stars --- */
.ap-stars { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.ap-star { font-size: 1.4rem; }
.ap-star-full, .ap-star-half { color: #f5a623; }
.ap-star-empty { color: #ddd; }
.ap-rating-text { font-size: 0.9rem; color: #666; margin-left: 6px; }

/* --- Buttons --- */
.ap-btn { display: inline-block; padding: 12px 24px; font-size: 1rem; font-weight: 600; border-radius: 6px; cursor: pointer; text-align: center; transition: background 0.2s, transform 0.1s; border: none; text-decoration: none; }
.ap-btn:hover { text-decoration: none; transform: translateY(-1px); }
.ap-btn-primary { background: #ff9900; color: #fff; }
.ap-btn-primary:hover { background: #e68a00; color: #fff; }
.ap-btn-large { padding: 16px 32px; font-size: 1.1rem; }
.ap-btn-sm { padding: 8px 16px; font-size: 0.9rem; }

/* --- Buy Box --- */
.ap-buy-box { background: #f8f9fa; border: 1px solid #e8e8e8; border-radius: 8px; padding: 24px; text-align: center; margin-bottom: 24px; }
.ap-buy-box h3 { margin-bottom: 16px; }
.ap-disclaimer { font-size: 0.8rem; color: #999; margin-top: 12px; }

/* --- Price Box (block) --- */
.ap-price-box { background: #f8f9fa; border: 2px solid #ff9900; border-radius: 8px; padding: 24px; text-align: center; margin: 20px 0; }
.ap-price-amount { font-size: 2rem; font-weight: 700; color: #111; margin-bottom: 16px; }
.ap-price-disclaimer { font-size: 0.8rem; color: #999; margin-top: 8px; }

/* --- Pros & Cons --- */
.ap-pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 20px 0; }
.ap-pros h4, .ap-cons h4 { margin-bottom: 8px; }
.ap-pros ul, .ap-cons ul { list-style: none; padding: 0; }
.ap-pros li, .ap-cons li { padding: 6px 0 6px 24px; position: relative; }
.ap-pros li::before { content: '+'; position: absolute; left: 0; color: #28a745; font-weight: 700; }
.ap-cons li::before { content: '-'; position: absolute; left: 0; color: #dc3545; font-weight: 700; }

/* --- Comparison Table (block) --- */
.ap-comparison-table { overflow-x: auto; margin: 20px 0; }
.ap-comparison-table table { width: 100%; border-collapse: collapse; }
.ap-comparison-table th, .ap-comparison-table td { padding: 12px 16px; text-align: center; border: 1px solid #e8e8e8; }
.ap-comparison-table th { background: #f8f9fa; font-weight: 600; }
.ap-comparison-table td:first-child { font-weight: 600; text-align: left; background: #f8f9fa; }
.ap-comparison-table img { max-width: 100px; margin: 0 auto; }

/* --- Sidebar --- */
.sidebar { min-width: 0; }
.widget { margin-bottom: 32px; }
.widget-title { font-size: 1.1rem; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid #0066cc; }
.widget ul { list-style: none; }
.widget li { padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.widget li:last-child { border-bottom: none; }
.widget a { color: #333; }
.widget a:hover { color: #0066cc; }

/* --- Top Products Widget --- */
.ap-top-products { list-style: none; }
.ap-top-products li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ap-widget-rating { background: #f5a623; color: #fff; padding: 1px 6px; border-radius: 3px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.ap-widget-price { color: #111; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }

/* --- Promo Box Widget --- */
.ap-promo-box { text-align: center; padding: 16px; background: #f8f9fa; border-radius: 8px; }
.ap-promo-box img { max-width: 150px; margin: 0 auto 12px; }
.ap-promo-price { font-size: 1.3rem; font-weight: 700; margin-bottom: 12px; }

/* --- Footer --- */
.site-footer { background: #1a1a1a; color: #ccc; padding: 40px 20px 24px; }
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; margin-bottom: 32px; }
.footer-widgets .widget-title { color: #fff; border-bottom-color: #444; }
.footer-widgets a { color: #aaa; }
.footer-widgets a:hover { color: #fff; }
.footer-credit { text-align: center; padding-top: 24px; border-top: 1px solid #333; font-size: 0.85rem; }
.footer-disclaimer { color: #888; font-size: 0.8rem; margin-top: 8px; }

/* --- Pagination --- */
.pagination { margin: 40px 0; text-align: center; }
.pagination .page-numbers { display: inline-block; padding: 8px 14px; margin: 0 2px; border: 1px solid #ddd; border-radius: 4px; font-size: 0.9rem; }
.pagination .current { background: #0066cc; color: #fff; border-color: #0066cc; }
.pagination a:hover { background: #f0f0f0; text-decoration: none; }

/* --- Search Form --- */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] { flex: 1; padding: 10px 14px; border: 1px solid #ddd; border-radius: 4px; font-size: 1rem; }
.search-form button { padding: 10px 18px; background: #0066cc; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; }

/* --- Comments --- */
.comment-list { list-style: none; margin-bottom: 32px; }
.comment { padding: 16px 0; border-bottom: 1px solid #f0f0f0; }
.comment-meta { font-size: 0.85rem; color: #888; margin-bottom: 8px; }
.comment-author .avatar { border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.comment-content { font-size: 0.95rem; }
.reply { font-size: 0.85rem; }
#respond { margin-top: 24px; }
#respond label { display: block; margin-bottom: 4px; font-weight: 500; }
#respond input[type="text"], #respond input[type="email"], #respond input[type="url"], #respond textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 1rem; font-family: inherit; }
#respond textarea { min-height: 120px; }
#submit { background: #0066cc; color: #fff; border: none; padding: 12px 24px; border-radius: 4px; cursor: pointer; font-size: 1rem; font-weight: 600; }
#submit:hover { background: #0052a3; }

/* --- Archive Header --- */
.archive-header { margin-bottom: 32px; }
.archive-title { font-size: 1.8rem; }
.archive-description { font-size: 1rem; color: #666; margin-top: 8px; }

/* --- Error 404 --- */
.error-404 { text-align: center; padding: 80px 20px; }
.error-404 h1 { font-size: 3rem; margin-bottom: 16px; }
.error-404 p { font-size: 1.1rem; color: #666; margin-bottom: 24px; }
.error-404 .search-form { max-width: 400px; margin: 0 auto; }

/* --- No Results --- */
.no-results { text-align: center; padding: 60px 20px; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .content-area { grid-template-columns: 1fr; }
    .ap-review-hero { flex-direction: column; align-items: center; text-align: center; }
    .ap-review-hero-image { flex: none; max-width: 250px; }
    .ap-stars { justify-content: center; }
    .ap-pros-cons { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .menu-toggle { display: block; }
    .main-navigation ul { display: none; flex-direction: column; gap: 0; width: 100%; }
    .main-navigation.toggled ul { display: flex; }
    .main-navigation li { padding: 10px 0; border-top: 1px solid #eee; }
    .posts-grid { grid-template-columns: 1fr; }
    .post-title { font-size: 1.6rem; }
    .footer-widgets { grid-template-columns: 1fr; }
}

/* --- Print --- */
@media print {
    .site-header, .site-footer, .sidebar, .breadcrumbs, .ap-btn, .ap-buy-box { display: none; }
    .content-area { display: block; }
    body { font-size: 12pt; color: #000; }
}
