/*
Theme Name: Posts Only (Redirect + Main Header/Footer) - MP Folder
Author: ChatGPT
Description: Single posts only + allow sitemap. Redirect everything else to main domain. Loads main-site CSS/JS and injects main header/footer HTML for near-identical layout.
Version: 5.0
Text Domain: posts-only-redirect
*/

/* Small safety overrides */
body.por-style-match { direction: rtl; }
.por-post-wrap { margin-top: 20px; margin-bottom: 40px; }
.por-post-content img{ max-width:100%; height:auto; }
.por-post-content iframe{ max-width:100%; }


/* Sidebar latest posts */
.por-sidebar-title{
  font-weight: 700;
  margin-bottom: 12px;
}
.por-latest-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.por-latest-card{
  display: flex;
  gap: 10px;
  text-decoration: none !important;
}
.por-latest-thumb{
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 72px;
  background: #f3f3f3;
}
.por-latest-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.por-latest-meta{
  flex: 1 1 auto;
  min-width: 0;
}
.por-latest-title{
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 6px;
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.por-latest-date{
  font-size: 12px;
  opacity: .7;
  margin: 0;
}
@media (max-width: 991px){
  .por-sidebar{ margin-top: 14px; }
}


/* Icons row under sidebar items (match main style) */
.por-latest-icons{
  display:flex;
  gap:10px;
  align-items:center;
  font-size:12px;
  opacity:.8;
}
.por-latest-icons span{
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.por-latest-icons i{
  font-size:13px;
}


/* Fix text selection visibility */
::selection {
  background: #f19c09;
  color: #000;
}
::-moz-selection {
  background: #f19c09;
  color: #000;
}


/* Fix header CTA button color to match main site */
header .btn-primary,
header a.btn-primary,
header .btn-main,
header a.btn-main,
header a[href*="open"],
header .btn-primary:hover,
header a.btn-primary:hover,
header .btn-main:hover {
  background-color: #d88905 !important;
  border-color: #d88905 !important;
  color: #000 !important;
}


/* === Fix selection visibility (override any main CSS) === */
body.por-style-match ::selection { background: #f19c09; color: #000; }
body.por-style-match ::-moz-selection { background: #f19c09; color: #000; }

/* === CTA button class (added by JS) === */
.por-cta-btn{
  background-color:#f19c09 !important;
  border-color:#f19c09 !important;
  color:#000 !important;
  border-radius: 10px;
}
.por-cta-btn:hover{
  background-color:#d88905 !important;
  border-color:#d88905 !important;
  color:#000 !important;
}

/* === Share buttons under article === */
.por-share{
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,.08);
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap: wrap;
}
.por-share .por-share-label{
  font-weight:700;
  margin-left: 6px;
}
.por-share a, .por-share button{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
  color: inherit;
  text-decoration:none !important;
  cursor:pointer;
}
.por-share a:hover, .por-share button:hover{
  border-color: rgba(0,0,0,.22);
}
.por-share i{ font-size: 14px; }


/* Featured image inside post card */
.por-featured{
  margin-bottom: 14px;
  border-radius: 14px;
  overflow: hidden;
}
.por-featured img{
  width: 100%;
  height: auto;
  display: block;
}


/* Breadcrumbs like main site */
.por-breadcrumb{
  margin: 14px 0 12px;
  font-size: 13px;
}
.por-breadcrumb ol{
  list-style: none;
  padding: 0;
  margin: 0;
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
}
.por-breadcrumb li{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.por-breadcrumb li + li:before{
  content: "/";
  opacity: .55;
  margin: 0 2px;
}
.por-breadcrumb a{ text-decoration:none; }


/* === Product-like post layout === */
.por-product-top{
  margin-bottom: 14px;
}
.por-product-card{
  border-radius: 14px;
}
.por-product-media{
  border-radius: 14px;
  overflow: hidden;
}
.por-product-media img{
  width:100%;
  height:auto;
  display:block;
}
.por-product-meta{
  opacity:.8;
  font-size: 13px;
  margin-bottom: 10px;
}
.por-product-title{
  font-size: 20px;
  font-weight: 800;
  line-height: 1.5;
  margin-bottom: 12px;
}
.por-tabs{
  margin-top: 16px;
}
.por-tabs .nav-tabs .nav-link{
  border-radius: 10px 10px 0 0;
}
.por-tabs .tab-pane{
  padding-top: 14px;
}

/* === Header button named .button should match main brand color === */
header .button,
header a.button,
header button.button{
  background-color:#f19c09 !important;
  border-color:#f19c09 !important;
  color:#000 !important;
  border-radius: 10px !important;
}
header .button:hover,
header a.button:hover,
header button.button:hover{
  background-color:#d88905 !important;
  border-color:#d88905 !important;
  color:#000 !important;
}


/* === Header CTA button "افتح متجرك الآن" (exact markup from main) === */
header .btn-sell-now,
header button.btn-sell-now,
header .btn.btn-custom.btn-sell-now{
  background-color:#f19c09 !important;
  border-color:#f19c09 !important;
  color:#000 !important;
}
header .btn-sell-now:hover,
header button.btn-sell-now:hover,
header .btn.btn-custom.btn-sell-now:hover{
  background-color:#d88905 !important;
  border-color:#d88905 !important;
  color:#000 !important;
}

/* === "Contact seller" button beside image === */
.por-contact-seller{
  margin-top:10px;
  width:100%;
}


/* Share buttons - use main button look */
.por-share .btn{
  border-radius: 10px !important;
}
.por-share .btn i{
  margin-left:6px;
}


/* === Price badge like main (green) === */
.por-price{
  color:#28a745 !important;
  font-weight:800;
  font-size:18px;
  margin: 8px 0 14px;
}

/* === Related posts section under content === */
.por-related-wrap{
  margin-top: 18px;
}
.por-related-title{
  font-weight: 800;
  margin: 0 0 12px;
}
.por-related-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px){
  .por-related-grid{ grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px){
  .por-related-grid{ grid-template-columns: 1fr 1fr 1fr; }
}
.por-related-card{
  display:flex;
  gap:10px;
  padding: 10px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  background: #fff;
  text-decoration:none !important;
  color: inherit;
}
.por-related-card:hover{
  border-color: rgba(0,0,0,.20);
}
.por-related-thumb{
  width: 92px;
  height: 92px;
  border-radius: 12px;
  overflow:hidden;
  flex: 0 0 92px;
}
.por-related-thumb img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.por-related-meta{
  min-width:0;
}
.por-related-meta .title{
  font-weight:700;
  line-height:1.4;
  margin-bottom: 6px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}
.por-related-meta .date{
  font-size: 12px;
  opacity:.75;
  display:flex;
  align-items:center;
  gap:6px;
}


/* === Related posts section uses main product grid classes === */
.por-related-title{
  font-weight: 800;
  margin: 18px 0 12px;
}
/* Ensure product grid spacing similar to main */
.por-related-products .row-product{ margin-top: 0; }


/* Contact seller button - mimic main add-to-cart button block */
.por-contact-seller-btn{
  width: 100%;
  margin-top: 10px;
}


/* === HARD OVERRIDES to match main site buttons === */
header button.btn.btn-md.btn-custom.btn-sell-now,
header .btn.btn-md.btn-custom.btn-sell-now,
header .btn-sell-now{
  background-color: var(--mds-color-main, #f19c09) !important;
  border-color: var(--mds-color-main, #f19c09) !important;
  color:#000 !important;
  box-shadow: none !important;
}
header button.btn.btn-md.btn-custom.btn-sell-now:hover,
header .btn.btn-md.btn-custom.btn-sell-now:hover{
  filter: brightness(.92);
}

.por-contact-seller-btn.btn.btn-md.btn-custom.btn-product-cart{
  width:100% !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:8px !important;
  border-radius: 10px !important;
}

/* Share icon-only buttons */
.por-share .btn.btn-sm.btn-custom{
  width:40px;
  height:40px;
  padding:0 !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius: 10px !important;
}
.por-share .btn.btn-sm.btn-custom i{ margin:0 !important; }


/* === Register buttons text color (white) === */
header button.btn.btn-md.btn-custom.btn-sell-now,
header .btn.btn-md.btn-custom.btn-sell-now,
header .btn-sell-now{
  color:#fff !important;
}
header button.btn.btn-md.btn-custom.btn-sell-now:hover,
header .btn.btn-md.btn-custom.btn-sell-now:hover,
header .btn-sell-now:hover{
  color:#fff !important;
}

/* Contact seller button colors (match main CTA) */
.por-contact-seller-btn.btn.btn-md.btn-custom.btn-product-cart{
  color:#fff !important;
}
.por-contact-seller-btn.btn.btn-md.btn-custom.btn-product-cart:hover{
  color:#fff !important;
}

/* Ensure share block is visible */
.por-share{
  display:flex !important;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Share buttons: icon-only like main */
.por-share .btn.btn-sm.btn-custom{
  width:40px;
  height:40px;
  padding:0 !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius: 10px !important;
  color:#fff !important;
}
.por-share .btn.btn-sm.btn-custom:hover{ color:#fff !important; }

/* Extra scraped details box above contact button */
.por-extra{
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
}
.por-extra .por-extra-item{
  display:flex;
  gap:8px;
  align-items:center;
  font-size: 14px;
  margin-bottom: 8px;
}
.por-extra .por-extra-item:last-child{ margin-bottom: 0; }
.por-extra .por-extra-label{
  font-weight: 700;
  opacity: .85;
}
.por-extra .por-extra-value{
  font-weight: 600;
}


/* === Make CTA/share buttons clearly visible (no low opacity) === */
.por-contact-seller-btn,
.por-share .btn{
  opacity: 1 !important;
  visibility: visible !important;
}

/* Contact seller exactly like header CTA (main color + white text) */
.por-contact-seller-btn.btn.btn-md.btn-custom.btn-product-cart{
  background-color: var(--mds-color-main, #f19c09) !important;
  border-color: var(--mds-color-main, #f19c09) !important;
  color:#fff !important;
}
.por-contact-seller-btn.btn.btn-md.btn-custom.btn-product-cart:hover,
.por-contact-seller-btn.btn.btn-md.btn-custom.btn-product-cart:focus{
  background-color: var(--mds-color-main, #f19c09) !important;
  border-color: var(--mds-color-main, #f19c09) !important;
  color:#fff !important;
  filter: brightness(.92);
}

/* Share buttons: same main color + white icon, strong contrast */
.por-share .btn.btn-sm.btn-custom{
  background-color: var(--mds-color-main, #f19c09) !important;
  border-color: var(--mds-color-main, #f19c09) !important;
  color:#fff !important;
}
.por-share .btn.btn-sm.btn-custom:hover,
.por-share .btn.btn-sm.btn-custom:focus{
  background-color: var(--mds-color-main, #f19c09) !important;
  border-color: var(--mds-color-main, #f19c09) !important;
  color:#fff !important;
  filter: brightness(.92);
}

/* If icon-font is missing, SVG icons will show; make them visible */
.por-share svg{
  width:18px;
  height:18px;
  display:block;
  fill: currentColor;
}
.por-share i{
  font-size:18px !important;
  line-height:1 !important;
  color: currentColor !important;
}


/* Avoid double icons: if SVG fallback exists, hide icon-font <i> */
.por-share a svg,
.por-share button svg{ display:block; }
.por-share a i,
.por-share button i{ display:none; }


/* Breadcrumb: tighter + match wording */
.por-breadcrumb ol li a{ font-weight:600; }
.por-breadcrumb ol li{ opacity:.9; }

/* Share buttons: mimic main CTA look (same color + same hover) */
.share-buttons,
.por-share{
  display:flex !important;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.share-buttons .share-btn,
.por-share .share-btn{
  width:40px;
  height:40px;
  border-radius:10px;
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  background-color: var(--mds-color-main, #f19c09) !important;
  border:1px solid var(--mds-color-main, #f19c09) !important;
  color:#fff !important;
  text-decoration:none !important;
  opacity:1 !important;
}
.share-buttons .share-btn:hover,
.por-share .share-btn:hover{
  filter: brightness(.92);
  color:#fff !important;
}
.share-buttons .share-btn svg,
.por-share .share-btn svg{
  width:18px;height:18px;fill:currentColor;display:block;
}


/* Dedicated ad price slot (before contact button) */
#por-ad-price.por-ad-price{
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  font-size: 18px;
  font-weight: 800;
  color: #28a745;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#por-ad-price .label{
  color: #222;
  font-weight: 700;
  font-size: 14px;
  opacity: .8;
}
#por-ad-price .value{
  color: #28a745;
  font-weight: 900;
  font-size: 18px;
}

/* Base font fallback */
body{font-family: Arial, Tahoma, sans-serif;}


/* Ad info slots before contact button */
.por-ad-info{
  margin-top: 10px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  background: #fff;
  overflow:hidden;
}
.por-ad-info .row-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 14px;
  gap: 12px;
}
.por-ad-info .row-item + .row-item{
  border-top: 1px solid rgba(0,0,0,.06);
}
.por-ad-info .label{
  font-size: 13px;
  font-weight: 700;
  opacity: .75;
  color:#222;
  white-space:nowrap;
}
.por-ad-info .value{
  font-size: 14px;
  font-weight: 800;
  color:#111;
  text-align:left;
}
.por-ad-info .value.price{
  color:#28a745;
  font-size: 16px;
  font-weight: 900;
}
.por-ad-info .value.status{
  color:#28a745;
}


/* Ad meta section between title and contact button */
.por-meta-box{
  margin: 12px 0 14px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}
.por-meta-box .por-meta-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 14px;
  gap: 12px;
}
.por-meta-box .por-meta-item + .por-meta-item{
  border-top: 1px solid rgba(0,0,0,.06);
}
.por-meta-box .por-meta-label{
  font-size: 13px;
  font-weight: 700;
  opacity: .75;
  color: #222;
  white-space: nowrap;
}
.por-meta-box .por-meta-value{
  font-size: 14px;
  font-weight: 800;
  color:#111;
  text-align:left;
}
.por-meta-box .por-meta-value-price{
  font-size: 18px;
  font-weight: 900;
  color: #28a745;
}
.por-meta-box .por-meta-value-status{
  color:#28a745;
}
@media (max-width: 767px){
  .por-meta-box .por-meta-value-price{font-size: 17px;}
}


/* Details grid (between meta/buttons and description) */
.por-section-title{
  font-size: 1.05rem;
  font-weight: 900;
  margin: 0 0 12px;
}
.por-details-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.por-detail-item{
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.por-detail-label{
  font-size: 13px;
  font-weight: 800;
  opacity: .75;
  white-space: nowrap;
}
.por-detail-value{
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}
@media (max-width: 767px){
  .por-details-grid{grid-template-columns: 1fr;}
}


/* Fix main product image sizing */
.por-product-image img,
.por-main-image img,
.por-post-image img,
.por-product-media img{
  max-width: 100%;
  width: 100%;
  height: 420px;
  object-fit: cover;
  border-radius: 16px;
}
@media (max-width: 767px){
  .por-product-image img,
  .por-main-image img,
  .por-post-image img,
  .por-product-media img{
    height: 260px;
  }
}


/* Main featured image sizing */
.por-main-image{
  max-width: 100%;
  width: 100%;
  height: 420px;
  object-fit: cover;
  border-radius: 16px;
  display:block;
}
@media (max-width: 767px){
  .por-main-image{height:260px;}
}

/* Related ads cards (اعلانات قد تهمك) */
.por-related-products .por-related-card .card-body{
  padding: 10px 12px 10px;
}
.por-related-products .por-related-card .product-title{
  margin: 0;
  font-size: .95rem;
  line-height: 1.35;
  font-weight: 800;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* Related ads fallback image sizing */
.por-related-products .product-image-container img{
  width:100%;
  height:242px;
  object-fit:cover;
  border-radius:14px;
}
@media (max-width:767px){
  .por-related-products .product-image-container img{
    height:200px;
  }
}
