/* =============================================
   cableksa-blog — RTL & Visual Overrides
   Matches cableksa.com main site design
   Arabic RTL — Full styling
   ============================================= */

/* ---- Base Reset & Typography ---- */
*, *::before, *::after { box-sizing: border-box; }

html { 
  scroll-behavior: smooth; 
  direction: rtl;
}

body {
  font-family: 'Cairo', sans-serif;
  font-size: 16px;
  line-height: 1.85;
  color: #1F2937;
  background-color: #F9FAFB;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  line-height: 1.5;
  color: #111827;
}

h1 { font-size: 2.25rem; font-weight: 700; margin-bottom: 1.25rem; }
h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; }
h3 { font-size: 1.375rem; font-weight: 600; margin-bottom: 0.875rem; }
h4 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.75rem; }

p { 
  margin-bottom: 1.25rem; 
  font-size: 1rem; 
  line-height: 1.85; 
  font-family: 'Cairo', sans-serif;
}

a { color: #006C35; text-decoration: none; transition: color 0.2s; }
a:hover { color: #004d25; }

img { max-width: 100%; height: auto; display: block; }

/* ---- Container ---- */
.wp-block-group {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   HEADER / NAVBAR
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #E5E7EB;
  height: 72px;
  display: flex;
  align-items: center;
  transition: box-shadow 0.3s;
}

.site-header.scrolled,
.site-header:has(.nav-container) {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.nav-container {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 72px;
}

.nav-brand {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #006C35 !important;
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand .fa-shield-halved {
  font-size: 1.5rem;
  color: #006C35;
}

.nav-brand a,
.nav-brand .wp-block-site-title a {
  color: #006C35 !important;
  font-family: 'Cairo', sans-serif !important;
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}

/* Navigation Links */
.nav-links,
.wp-block-navigation {
  display: flex !important;
  align-items: center;
  gap: 4px;
}

.wp-block-navigation-item {
  list-style: none;
}

.wp-block-navigation-item a,
.nav-link a,
.wp-block-navigation-link a {
  display: block;
  padding: 8px 16px;
  color: #374151 !important;
  font-weight: 500;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9375rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
  text-decoration: none !important;
}

.wp-block-navigation-item a:hover,
.nav-link a:hover {
  color: #006C35 !important;
  background: #e6f4ea;
}

/* Nav Actions */
.nav-actions {
  display: flex !important;
  align-items: center;
  gap: 12px;
}

.btn-emergency {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #006C35;
  color: #fff !important;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 0.25rem;
  transition: all 0.3s;
  white-space: nowrap;
  border: 2px solid transparent;
  text-decoration: none !important;
}

.btn-emergency:hover {
  background: #004d25;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  color: #fff !important;
}

.btn-emergency .fa-phone {
  font-size: 0.9rem;
}

/* CTA inside article */
.btn-emergency-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #F59E0B;
  color: #1F2937 !important;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  border-radius: 0.5rem;
  text-decoration: none !important;
  transition: all 0.3s;
}

.btn-emergency-cta:hover {
  background: #D97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
  color: #1F2937 !important;
}

/* ========================================
   BLOG HERO
   ======================================== */
.blog-hero {
  background: linear-gradient(135deg, #006C35 0%, #004d25 50%, #003d1a 100%) !important;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.blog-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -25%;
  width: 80%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.blog-hero h1 {
  color: #fff !important;
  margin-bottom: 0.5rem;
}

.blog-hero p {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* ========================================
   POST CARDS (Blog Listing)
   ======================================== */
.post-card {
  background: #fff;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  margin-bottom: 2rem;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* Featured Image in Cards */
.post-card .wp-block-post-featured-image,
.post-card figure {
  margin: 0 !important;
  overflow: hidden;
}

.post-card .wp-block-post-featured-image img,
.post-card figure img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card:hover .wp-block-post-featured-image img,
.post-card:hover figure img {
  transform: scale(1.05);
}

/* Card Typography */
.post-card .wp-block-post-title a {
  color: #111827 !important;
  font-family: 'Cairo', sans-serif !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  transition: color 0.2s;
}

.post-card .wp-block-post-title a:hover {
  color: #006C35 !important;
}

.post-card .post-meta,
.post-card .post-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.post-card time {
  color: #9CA3AF;
  font-size: 0.8125rem;
}

/* Read more link */
.post-card .wp-block-post-excerpt__more-link {
  color: #006C35 !important;
  font-weight: 600;
  font-family: 'Cairo', sans-serif;
  text-decoration: none !important;
  transition: color 0.2s;
}

.post-card .wp-block-post-excerpt__more-link:hover {
  color: #004d25 !important;
}

/* Category badges */
.post-card .wp-block-post-terms a,
.post-meta-top .wp-block-post-terms a {
  display: inline-block;
  padding: 3px 10px;
  background: #e6f4ea;
  color: #006C35 !important;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none !important;
  transition: all 0.2s;
}

.post-card .wp-block-post-terms a:hover,
.post-meta-top .wp-block-post-terms a:hover {
  background: #006C35;
  color: #fff !important;
}

/* ========================================
   GRID LAYOUT FOR POSTS
   ======================================== */
.wp-block-post-template.is-layout-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

/* ========================================
   SINGLE POST — ENHANCED
   ======================================== */
.article-container {
  max-width: 800px !important;
  margin: 0 auto;
  padding: 2rem 2rem 4rem !important;
}

.single-post .wp-block-post-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: #111827;
  font-family: 'Cairo', sans-serif;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* Breadcrumb */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-size: 0.875rem;
  direction: rtl;
}

.breadcrumb-nav a:hover {
  color: #006C35;
}

/* Post Meta */
.post-meta-top {
  display: flex !important;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #E5E7EB;
  direction: rtl;
}

/* Featured Image (single) */
.single-post .wp-block-post-featured-image {
  margin-bottom: 2rem;
  border-radius: 0.75rem;
  overflow: hidden;
}

.single-post .wp-block-post-featured-image img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

/* ========================================
   ARTICLE CONTENT STYLING — ENHANCED
   ======================================== */
.entry-content,
.wp-block-post-content,
.wp-block-post-content > *,
article .entry-content {
  font-family: 'Cairo', sans-serif;
  font-size: 1.0625rem;
  line-height: 2;
  color: #1F2937;
  direction: rtl;
  text-align: right;
}

.entry-content h2,
.wp-block-post-content h2 {
  font-family: 'Cairo', sans-serif;
  font-size: 1.625rem;
  font-weight: 700;
  color: #006C35;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e6f4ea;
  direction: rtl;
}

.entry-content h3,
.wp-block-post-content h3 {
  font-family: 'Cairo', sans-serif;
  font-size: 1.375rem;
  font-weight: 600;
  color: #111827;
  margin-top: 2rem;
  margin-bottom: 0.875rem;
  direction: rtl;
}

.entry-content p,
.wp-block-post-content p {
  margin-bottom: 1.5rem;
  line-height: 2;
  font-size: 1.0625rem;
  font-family: 'Cairo', sans-serif;
}

.entry-content ul,
.entry-content ol,
.wp-block-post-content ul,
.wp-block-post-content ol {
  margin-bottom: 1.5rem;
  padding-right: 1.75rem;
  padding-left: 0;
  margin-left: 0;
  direction: rtl;
}

.entry-content li,
.wp-block-post-content li {
  margin-bottom: 0.625rem;
  line-height: 1.85;
  font-family: 'Cairo', sans-serif;
  font-size: 1.0625rem;
}

.entry-content strong,
.wp-block-post-content strong {
  color: #111827;
  font-weight: 700;
}

/* Blockquote */
.entry-content blockquote,
.wp-block-post-content blockquote {
  border-right: 4px solid #006C35;
  border-left: none;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  background: #e6f4ea;
  border-radius: 0 0.75rem 0.75rem 0;
  font-style: normal;
  direction: rtl;
}

.entry-content blockquote p,
.wp-block-post-content blockquote p {
  margin: 0;
  font-size: 1.0625rem;
  color: #004d25;
  font-family: 'Cairo', sans-serif;
}

/* Tables */
.entry-content table,
.wp-block-post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
  direction: rtl;
}

.entry-content th,
.entry-content td,
.wp-block-post-content th,
.wp-block-post-content td {
  padding: 0.875rem 1.125rem;
  text-align: right;
  border: 1px solid #E5E7EB;
  font-family: 'Cairo', sans-serif;
}

.entry-content th,
.wp-block-post-content th {
  background: #006C35;
  color: #fff;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
}

.entry-content tr:nth-child(even),
.wp-block-post-content tr:nth-child(even) {
  background: #F9FAFB;
}

/* Images in content */
.entry-content img,
.wp-block-post-content img {
  border-radius: 0.75rem;
  margin: 2rem 0;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* Links in content */
.entry-content a,
.wp-block-post-content a {
  color: #006C35;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
  font-weight: 500;
}

.entry-content a:hover,
.wp-block-post-content a:hover {
  color: #004d25;
}

/* ========================================
   FAQ Section Styling
   ======================================== */
.entry-content h3:has(+ p:only-child),
.wp-block-post-content h3:has(+ p:only-child) {
  background: #f0fdf4;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border-right: 3px solid #006C35;
}

/* ========================================
   CTA BOX (inside article) — ENHANCED
   ======================================== */
.cta-box {
  background: linear-gradient(135deg, #006C35, #004d25) !important;
  border-radius: 1rem !important;
  text-align: center;
  padding: 2.5rem !important;
  margin: 3rem 0 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 108, 53, 0.25);
}

.cta-box h3 {
  color: #fff !important;
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
}

.cta-box p {
  color: rgba(255, 255, 255, 0.9) !important;
  margin-bottom: 1.25rem !important;
}

/* ========================================
   RELATED POSTS — ENHANCED
   ======================================== */
.related-posts h2 {
  font-family: 'Cairo', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e6f4ea;
}

.related-posts .post-card {
  margin-bottom: 1.5rem;
}

/* ========================================
   PAGINATION
   ======================================== */
.wp-block-query-pagination {
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid #E5E7EB;
  direction: rtl;
}

.wp-block-query-pagination a,
.wp-block-query-pagination-numbers a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: #fff;
  color: #374151;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  border: 1px solid #E5E7EB;
  border-radius: 0.5rem;
  text-decoration: none !important;
  transition: all 0.2s;
}

.wp-block-query-pagination a:hover,
.wp-block-query-pagination-numbers a:hover {
  background: #006C35;
  color: #fff !important;
  border-color: #006C35;
}

.wp-block-query-pagination .current {
  background: #006C35;
  color: #fff !important;
  border-color: #006C35;
}

/* ========================================
   FOOTER
   ======================================== */
.site-footer {
  background-color: #1F2937 !important;
  color: #D1D5DB;
  direction: rtl;
}

.footer-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 1280px;
  margin: 0 auto;
}

.footer-col h4 {
  color: #fff !important;
  font-family: 'Cairo', sans-serif !important;
  margin-bottom: 1rem;
}

.footer-col p,
.footer-col li {
  font-size: 0.9375rem;
  color: #D1D5DB;
  margin-bottom: 0.5rem;
  font-family: 'Cairo', sans-serif;
}

.footer-col a {
  color: #D1D5DB !important;
  text-decoration: none !important;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: #34A853 !important;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col .fa-phone,
.footer-col .fa-envelope {
  margin-left: 0.5rem;
  margin-right: 0;
}

.footer-bottom {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  border-top: 1px solid #374151;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.footer-bottom p {
  font-size: 0.875rem;
  color: #9CA3AF;
  margin: 0;
}

.footer-bottom a {
  color: #9CA3AF !important;
  text-decoration: none !important;
  transition: color 0.2s;
}

.footer-bottom a:hover {
  color: #34A853 !important;
}

/* ========================================
   404 PAGE
   ======================================== */
.error-404 {
  text-align: center;
  padding: 6rem 2rem;
}

.error-404 h1 {
  font-size: 6rem;
  color: #006C35;
  opacity: 0.8;
}

.error-404 h2 {
  font-size: 1.75rem;
  color: #111827;
}

.error-404 p {
  color: #6B7280;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .nav-container {
    padding: 0 16px;
  }

  .nav-brand {
    font-size: 1rem;
  }

  .nav-brand a,
  .nav-brand .wp-block-site-title a {
    font-size: 1rem !important;
  }

  /* Hide nav links on mobile, show hamburger */
  .nav-links,
  .wp-block-navigation {
    display: none;
  }

  .btn-emergency {
    padding: 8px 14px;
    font-size: 0.8125rem;
  }

  .blog-hero {
    padding-top: 2.5rem;
    padding-bottom: 2rem;
  }

  .blog-hero h1 {
    font-size: 1.75rem;
  }

  .blog-hero p {
    font-size: 0.9375rem;
  }

  /* Single post */
  .single-post .wp-block-post-title,
  .article-container h1 {
    font-size: 1.5rem !important;
  }

  .article-container {
    padding-right: 1rem !important;
    padding-left: 1rem !important;
  }

  .entry-content h2,
  .wp-block-post-content h2 {
    font-size: 1.375rem;
  }

  .entry-content h3,
  .wp-block-post-content h3 {
    font-size: 1.125rem;
  }

  /* Cards grid to single column */
  .wp-block-post-template.is-layout-grid {
    grid-template-columns: 1fr !important;
  }

  .post-card figure img {
    height: 180px;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  /* CTA box */
  .cta-box {
    padding: 1.5rem !important;
  }

  .btn-emergency-cta {
    font-size: 1rem;
    padding: 0.625rem 1.25rem;
  }

  /* Pagination */
  .wp-block-query-pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .nav-brand .fa-shield-halved {
    display: none;
  }

  .btn-emergency {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .blog-hero h1 {
    font-size: 1.5rem;
  }
}

/* ========================================
   SEARCH FORM
   ======================================== */
.wp-block-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  direction: rtl;
}

.wp-block-search .wp-block-search__input {
  border: 1px solid #E5E7EB;
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9375rem;
  direction: rtl;
  transition: border-color 0.2s;
}

.wp-block-search .wp-block-search__input:focus {
  outline: none;
  border-color: #006C35;
  box-shadow: 0 0 0 3px rgba(0, 108, 53, 0.1);
}

.wp-block-search .wp-block-search__button {
  background: #006C35;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.wp-block-search .wp-block-search__button:hover {
  background: #004d25;
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #F3F4F6;
}

::-webkit-scrollbar-thumb {
  background: #006C35;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #004d25;
}

/* ========================================
   SELECTION
   ======================================== */
::selection {
  background: #e6f4ea;
  color: #006C35;
}

/* ========================================
   POST NAVIGATION (prev/next)
   ======================================== */
.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #E5E7EB;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.post-navigation a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9375rem;
  color: #374151;
  text-decoration: none;
  transition: color 0.2s;
}

.post-navigation a:hover {
  color: #006C35;
}

.post-navigation .post-nav-label {
  font-size: 0.8125rem;
  color: #9CA3AF;
}

/* ========================================
   WORDPRESS SPECIFIC OVERRIDES
   ======================================== */
/* Remove default WP padding */
.wp-site-blocks {
  padding: 0 !important;
}

/* Block editor link color fix */
.has-green-primary-color a {
  color: #006C35;
}

/* Ensure images don't overflow */
.wp-block-image img {
  border-radius: 0.5rem;
}

/* Ensure proper width for aligned elements */
.alignwide {
  max-width: 1280px;
}

.alignfull {
  max-width: 100vw;
  margin-right: calc(50% - 50vw);
  margin-left: calc(50% - 50vw);
}

/* Tag cloud */
.wp-block-tag-cloud a {
  display: inline-block;
  padding: 4px 12px;
  background: #F3F4F6;
  color: #374151;
  font-size: 0.875rem !important;
  border-radius: 999px;
  margin: 0.25rem;
  text-decoration: none !important;
  transition: all 0.2s;
  font-family: 'Cairo', sans-serif;
}

.wp-block-tag-cloud a:hover {
  background: #006C35;
  color: #fff !important;
}
