/*
  Theme Name:   Jannah (Customized for mnsaa.com)
  Version:      1.2
  Description:  Responsive homepage styles, mobile-friendly
*/

/* 0. Box sizing globally */
*, *::before, *::after { box-sizing: border-box; }

/* 1. Container */
.mnsaa-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 10px;
}

/* 2. Section Headings */
.section-heading {
  font-size: 28px;
  font-weight: 800;
  color: #333;
  margin-bottom: 16px;
  border-bottom: 3px solid #ddd;
}

/* 3. Layouts */
/* Latest grid: 4 cols desktop → 2 cols tablet → 1 col mobile */
.mnsaa-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 20px;
}
@media (max-width: 1024px) {
  .mnsaa-grid {
    grid-template-columns: repeat(2,1fr);
  }
}
@media (max-width: 600px) {
  .mnsaa-grid {
    grid-template-columns: 1fr;
  }
}

/* Sliders */
.mnsaa-slider {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 240px;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 10px;
}
.mnsaa-slider > .mnsaa-card {
  scroll-snap-align: start;
}
@media (max-width: 600px) {
  .mnsaa-slider {
    grid-auto-columns: 80%;
  }
}

/* 4. Card Base */
.mnsaa-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  background: #fff;
  border-radius: 12px;
  border: 3px solid #ccc;
  padding: 0;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.mnsaa-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

/* Section‑specific borders */
.mnsaa-section.latest  .mnsaa-card { border-color: #4e9af1; }
.mnsaa-section.popular .mnsaa-card { border-color: #ff9a9e; }
.mnsaa-section.games   .mnsaa-card { border-color: #a1c4fd; }
.mnsaa-section.apps    .mnsaa-card { border-color: #f6d365; }

/* 5. Latest image rectangle */
.latest-card .mnsaa-icon {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  margin: 0;
}
.latest-card .mnsaa-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}
/* Remove gradient circles on latest */
.latest-card .mnsaa-icon::before,
.latest-card .mnsaa-icon::after {
  display: none;
}
/* Hide the meta‑bar (date and “الأحدث”) in latest section */
.latest-card .meta-bar {
  display: none;
}

/* 6. Floating Icon for other sections */
.mnsaa-icon {
  width: 120px;
  height: 120px;
  margin-top: 20px;
  margin-bottom: 12px;
  position: relative;
  background: conic-gradient(
    #ffe29f 0deg 120deg,
    #fde29f 120deg 240deg,
    #ffecb3 240deg 360deg
  );
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
@media (max-width: 600px) {
  .mnsaa-icon {
    width: 100px;
    height: 100px;
    margin-top: 16px;
    margin-bottom: 8px;
  }
}
.mnsaa-icon::before {
  content: "";
  position: absolute;
  width: 80%;
  height: 80%;
  background: #fff;
  border-radius: 50%;
  z-index: 1;
}
.mnsaa-icon img {
  position: relative;
  width: 75%;
  height: 75%;
  object-fit: cover;
  border-radius: 8px;
  z-index: 2;
}

/* 7. Title below image */
.card-title {
  margin: 0 12px 20px;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  color: #111;
  line-height: 1.2;
  width: 100%;
}
@media (max-width: 600px) {
  .card-title {
    font-size: 18px;
    margin-bottom: 16px;
  }
}

/* 8. Corner decorations */
.mnsaa-card::before,
.mnsaa-card::after {
  content: "";
  position: absolute;
  width: 50px;
  height: 50px;
  opacity: .8;
  z-index: 1;
}
.mnsaa-card::before {
  top: 0; left: 0;
  background: var(--circle1,#4e9af1);
  border-bottom-right-radius: 50px;
}
.mnsaa-card::after {
  top: 0; right: 0;
  background: var(--circle2,#ffe29f);
  border-bottom-left-radius: 50px;
}
.mnsaa-section.latest .mnsaa-card::before,
.mnsaa-section.latest .mnsaa-card::after {
  display: none;
}

/* 9. Meta bar (Latest) */
.latest-card .meta-bar {
  position: absolute;
  top: 12px; left: 12px; right: 12px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #555;
}
@media (max-width: 600px) {
  .latest-card .meta-bar { font-size: 11px; }
}

/* 10. Section variables */
.mnsaa-section.popular .mnsaa-card { --circle1:rgba(59,130,246,1); --circle2:rgba(253,224,71,1); }
.mnsaa-section.games   .mnsaa-card { --circle1:rgba(129,199,132,1); --circle2:rgba(66,165,245,1); }
.mnsaa-section.apps    .mnsaa-card { --circle1:rgba(186,104,200,1); --circle2:rgba(255,202,128,1); }

/* 11. SEO & performance */
.mnsaa-icon img,
.mnsaa-card img {
  loading: lazy;
  max-width: 100%;
  height: auto;
}

/* === 1) الصور دائرية داخل الكارد === */
.mnsaa-card .mnsaa-icon img {
  border-radius: 50%;
  display: block;
  width: 100%;
  height: auto;
}

/* === 2) إعدادات الكارد للرسوميات === */
.mnsaa-card {
  position: relative;
  overflow: visible;
  background-color: #fff;
}

/* === 3) إطار بثلاثة ألوان للتطبيقات والألعاب === */
.apps .mnsaa-card,
.games .mnsaa-card {
  border: 3px solid transparent;
  border-image: linear-gradient(
    135deg,
    #28a745 0%,
    #ffc107 33%,
    #dc3545 66%
  ) 1;
  border-radius: 8px;
}

/* === 4) شارة “جديد” خضراء مائلة === */
.mnsaa-card.new-post::before {
  content: "جديد";
  position: absolute;
  top: 8px;
  right: -6px;
  background-color: #28a745;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 2px;
  transform: rotate(10deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 5;
}

/* === 5) شارة “تحديث” حمراء مائلة === */
.mnsaa-card.updated-post::before {
  content: "تحديث";
  position: absolute;
  top: 8px;
  right: -6px;
  background-color: #dc3545;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 2px;
  transform: rotate(10deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 5;
}

/* === 6) استثناء قسم “الأحدث” لمنع ظهور الشارات فيه === */
.latest .mnsaa-card.new-post::before,
.latest .mnsaa-card.updated-post::before {
  display: none;
}


/* === Container & Section Frame === */
.mnsaa-container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 20px;
  background: #fafafa;
  border: 5px solid;
  border-image: linear-gradient(135deg, #4e9af1, #28a745, #ffc107, #dc3545) 1;
  border-radius: 12px;
}

/* Archive Header */
.archive-header .page-title {
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  color: #222;
  margin-bottom: 30px;
}

/* === Grid 5×5 === */
.category-grid {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: 20px;
  margin-bottom: 40px;
}
@media (max-width:1200px){ .category-grid{grid-template-columns:repeat(4,1fr);} }
@media (max-width:900px){ .category-grid{grid-template-columns:repeat(3,1fr);} }
@media (max-width:600px){ .category-grid{grid-template-columns:repeat(2,1fr);} }
@media (max-width:400px){ .category-grid{grid-template-columns:1fr;} }

/* === Card Frame & Base === */
.category-card {
  position: relative;
  background: #fff;
  border: 4px solid transparent;
  border-image: linear-gradient(135deg, #4e9af1, #28a745, #ffc107, #dc3545) 1;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}

/* === Card Header: Android Icon & Badge === */
.card-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0,0,0,0.05);
}
.android-icon {
  font-size: 20px;
  color: #28a745;
}
.badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  color: #fff;
}
.badge-new { background: #28a745; }
.badge-upd { background: #dc3545; }

/* === Thumbnail with Circular Img === */
.card-thumb {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: none;
}
.thumb-img {
  position: absolute;
  top:50%; left:50%;
  width:70%; height:70%;
  transform:translate(-50%,-50%);
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #fff;
}
.no-thumb {
  position: absolute;
  top:50%; left:50%;
  width:70%; height:70%;
  transform:translate(-50%,-50%);
  background: #ccc;
  border-radius: 50%;
}

/* === Download Count === */
.view-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  padding:4px 6px;
  border-radius:4px;
}

/* === Title === */
.card-title {
  margin: 16px 12px 24px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: #333;
  line-height:1.3;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* === Pagination === */
.pagination-wrapper {
  text-align: center;
  margin-top: 30px;
}
.pagination-wrapper .page-numbers {
  display: inline-block;
  margin: 0 6px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: #333;
  background: #fff;
  text-decoration: none;
}
.pagination-wrapper .page-numbers.current,
.pagination-wrapper .page-numbers:hover {
  background: #4e9af1;
  color: #fff;
  border-color: #4e9af1;
}

/* === No Posts Message === */
.no-posts {
  font-size: 18px;
  color: #666;
  text-align: center;
  padding: 40px 0;
}

/* === Disable hover transforms entirely === */
.category-card:hover {
  transform: none !important;
}

/* صندوق الروابط فوق المقالات */
.category-nav {
  width: 100%;
  background: #fff;
  border: 3px solid;
  border-image: linear-gradient(135deg, #4e9af1, #28a745, #ffc107, #dc3545) 1;
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* روابط الأقسام */
.category-nav-link {
  display: inline-block;
  background: #4e9af1;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: background .2s;
}
.category-nav-link:hover {
  background: #28a745;
}

/* Wrapper عام */
.mnsaa-post-wrapper {
  max-width: 800px;
  margin: 40px auto;
  padding: 20px;
  background: #fff;
  border: 4px solid;
  border-image: linear-gradient(135deg,#28a745,#ffc107,#dc3545) 1;
  border-radius: 12px;
}

/* Header */
.mnsaa-post-header {
  text-align: center;
  margin-bottom: 24px;
  position: relative;
}
.mnsaa-post-header .badge-new,
.mnsaa-post-header .badge-upd {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%,-50%);
  padding: 6px 12px;
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
}
.badge-new { background: #28a745; }
.badge-upd { background: #dc3545; }
.mnsaa-post-title {
  font-size: 28px;
  font-weight: 900;
  margin: 16px 0 8px;
}
.mnsaa-post-meta {
  font-size: 14px;
  color: #555;
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.mnsaa-post-meta .dashicons {
  vertical-align: middle;
}

/* Featured Image */
.mnsaa-featured-image {
  text-align: center;
  margin-bottom: 24px;
}
.mnsaa-featured-image img {
  max-width: 100%;
  border-radius: 8px;
}

/* Content */
.mnsaa-post-content {
  line-height: 1.8;
  color: #333;
}
.mnsaa-post-content h2,
.mnsaa-post-content h3 {
  margin-top: 24px;
  color: #28a745;
}
.mnsaa-post-content p {
  margin-bottom: 16px;
}

/* CTA Button */
.mnsaa-cta {
  text-align: center;
  margin: 32px 0;
}
.mnsaa-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #28a745;
  color: #fff;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}
.mnsaa-download-btn .dashicons {
  font-size: 20px;
}

/* Footer: تصنيفات وتنقل */
.mnsaa-post-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  font-size: 14px;
  color: #555;
}
.mnsaa-post-cats a {
  color: #28a745;
}
.mnsaa-post-nav .prev-link,
.mnsaa-post-nav .next-link {
  color: #28a745;
}




