/*
Theme Name:        بيتك - Baytak Home Services
Theme URI:         https://baytak.com
Author:            Baytak Team
Author URI:        https://baytak.com
Description:       قالب احترافي متكامل لمواقع الخدمات المنزلية - متوافق مع SEO وجميع الأجهزة
Version:           1.0.1
Requires at least: 6.0
Tested up to:      6.5
Requires PHP:      8.0
License:           GNU General Public License v2 or later
License URI:       http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       baytak
Tags:              rtl-language, arabic, home-services, business, responsive, full-width-template, custom-menu, featured-images, threaded-comments, custom-logo, custom-background, translation-ready

This theme, like WordPress, is licensed under the GPL.
*/

/* ─────────────────────────────────────────────
   CSS VARIABLES
───────────────────────────────────────────── */
:root {
  --brand:        #1a6b3c;
  --brand-dark:   #134d2c;
  --brand-light:  #e8f5ee;
  --accent:       #f5a623;
  --accent-dark:  #d4881a;
  --dark:         #0f1f15;
  --text:         #2d3a31;
  --muted:        #6b7c70;
  --light:        #f7faf8;
  --white:        #ffffff;
  --border:       #d8e8de;
  --radius:       16px;
  --radius-sm:    10px;
  --shadow:       0 8px 40px rgba(26,107,60,.12);
  --shadow-lg:    0 20px 60px rgba(26,107,60,.18);
  --transition:   .35s cubic-bezier(.4,0,.2,1);
  --container:    1280px;
  --font-base:   "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
}

/* ─────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-base);
  color: var(--text);
  background: var(--white);
  line-height: 1.7;
  overflow-x: hidden;
  direction: rtl;
}

body.rtl { direction: rtl; text-align: right; }

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ─────────────────────────────────────────────
   TYPOGRAPHY
───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-base);
  font-weight: 900;
  line-height: 1.3;
  color: var(--dark);
}

h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }

/* ─────────────────────────────────────────────
   LAYOUT UTILITIES
───────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section-padding { padding: 80px 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ─────────────────────────────────────────────
   SECTION HEADERS
───────────────────────────────────────────── */
.section-header { text-align: center; margin-bottom: 60px; }
.section-tag {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand);
  font-size: .85rem; font-weight: 700;
  border-radius: 50px;
  padding: 6px 18px;
  margin-bottom: 14px;
  letter-spacing: .05em;
}
.section-title {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  margin-bottom: 14px;
  color: var(--dark);
}
.section-sub {
  font-size: 1rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ─────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 50px;
  font-size: .95rem; font-weight: 700;
  border: none; cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-base);
  text-align: center;
}
.btn-sm  { padding: 7px 18px; font-size: .85rem; }
.btn-lg  { padding: 14px 32px; font-size: 1.05rem; }
.btn-xl  { padding: 16px 40px; font-size: 1.1rem; }

.btn-primary {
  background: var(--brand); color: white;
  box-shadow: 0 4px 16px rgba(26,107,60,.25);
}
.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,107,60,.35);
}

.btn-outline {
  background: transparent; color: var(--brand);
  border: 2px solid var(--brand);
}
.btn-outline:hover {
  background: var(--brand-light);
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--accent); color: var(--dark);
  box-shadow: 0 4px 16px rgba(245,166,35,.25);
}
.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245,166,35,.35);
}

.btn-white {
  background: white; color: var(--brand);
}
.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,.15);
}

.btn-ghost-white {
  background: transparent; color: white;
  border: 2px solid rgba(255,255,255,.5);
}
.btn-ghost-white:hover {
  background: rgba(255,255,255,.1);
  border-color: white;
}

.btn-block { width: 100%; justify-content: center; }

/* ─────────────────────────────────────────────
   CARDS
───────────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}
.card-featured {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

/* ─────────────────────────────────────────────
   BADGES & TAGS
───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 50px;
  font-size: .78rem; font-weight: 700;
}
.badge-primary { background: var(--brand-light); color: var(--brand); }
.badge-accent  { background: #fff3e0; color: var(--accent-dark); }
.badge-dark    { background: var(--dark); color: white; }

/* ─────────────────────────────────────────────
   STAR RATING
───────────────────────────────────────────── */
.stars { color: var(--accent); letter-spacing: 2px; }
.rating-count { font-size: .85rem; color: #4a5a50; }

.star-rating { display: flex; gap: 4px; direction: ltr; }
.star-rating input { display: none; }
.star-rating label {
  font-size: 1.8rem; color: #ddd; cursor: pointer;
  transition: color .2s;
}
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: var(--accent);
}

/* ─────────────────────────────────────────────
   FORMS
───────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-weight: 600;
  font-size: .9rem; margin-bottom: 8px;
  color: var(--text);
}
.form-control {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem; font-family: var(--font-base);
  color: var(--text); background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: rtl;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,107,60,.12);
}
.form-control::placeholder { color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 140px; }

/* ─────────────────────────────────────────────
   ALERTS
───────────────────────────────────────────── */
.alert {
  padding: 14px 20px; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 500; margin-bottom: 16px;
}
.alert-success { background: #e8f5ee; color: var(--brand); border: 1px solid #a7d9bc; }
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-info    { background: #eff6ff; color: #2563eb; border: 1px solid #93c5fd; }

/* ─────────────────────────────────────────────
   LOADING SPINNER
───────────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────
   REVEAL ANIMATIONS
───────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes pulse-dot {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: .7; }
}

/* ─────────────────────────────────────────────
   PAGINATION
───────────────────────────────────────────── */
.pagination {
  display: flex; gap: 8px; justify-content: center;
  margin-top: 48px; flex-wrap: wrap;
}
.pagination a,
.pagination span {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; font-size: .9rem;
  transition: all var(--transition);
  border: 2px solid var(--border);
  color: var(--text);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current {
  background: var(--brand); border-color: var(--brand);
  color: white;
}

/* ─────────────────────────────────────────────
   BREADCRUMBS
───────────────────────────────────────────── */
.breadcrumbs {
  background: var(--light);
  padding: 14px 0;
  font-size: .88rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.breadcrumbs ol {
  display: flex; gap: 8px; align-items: center;
  list-style: none; flex-wrap: wrap;
}
.breadcrumbs li::after { content: '/'; margin-right: 8px; }
.breadcrumbs li:last-child::after { display: none; }
.breadcrumbs a { color: var(--brand); }
.breadcrumbs a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────
   PAGE HERO BANNER
───────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  padding: 80px 0 60px;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; top: -120px; right: -120px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 70%);
}
.page-hero h1 { color: white; margin-bottom: 12px; }
.page-hero p { color: rgba(255,255,255,.8); font-size: 1.05rem; max-width: 550px; margin: 0 auto; }

/* ─────────────────────────────────────────────
   SIDEBAR WIDGETS
───────────────────────────────────────────── */
.widget {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-bottom: 24px;
}
.widget-title {
  font-family: var(--font-base);
  font-size: 1rem; font-weight: 700;
  color: var(--dark);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-light);
  margin-bottom: 16px;
}
.widget ul { display: grid; gap: 10px; }
.widget ul li a {
  display: flex; align-items: center; gap: 8px;
  font-size: .9rem; color: var(--text);
  transition: color var(--transition);
}
.widget ul li a::before {
  content: '←'; color: var(--brand); font-size: .8rem;
}
.widget ul li a:hover { color: var(--brand); }

/* ─────────────────────────────────────────────
   POST / ARTICLE CARDS
───────────────────────────────────────────── */
.post-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: all var(--transition);
}
.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.post-card-thumb { overflow: hidden; aspect-ratio: 8/5; background: var(--light); }
.post-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.post-card:hover .post-card-thumb img { transform: scale(1.05); }
.post-card-body { padding: 24px; }
.post-card-top { margin-bottom: 10px; }
.post-card-title { margin-bottom: 10px; font-size: 1.1rem; line-height: 1.5; }
.post-card-title a { color: var(--dark); transition: color var(--transition); }
.post-card-title a:hover { color: var(--brand); }
.post-card-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: .82rem; color: var(--muted); margin-bottom: 12px;
}
.post-card-meta .meta-item { display: inline-flex; align-items: center; gap: 6px; }
.post-card-excerpt { font-size: .9rem; color: var(--muted); margin-bottom: 16px; }
.post-card-comments { font-size: .8rem; color: var(--muted); }
.post-card-thumb-fallback{
  height: 100%; min-height: 220px;
  background: var(--brand-light);
  display: grid; place-items: center;
  font-size: 3rem;
}

.post-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: .82rem; color: var(--muted); margin-bottom: 12px;
}
.post-meta span { display: flex; align-items: center; gap: 5px; }
.post-card h3 { margin-bottom: 10px; font-size: 1.1rem; line-height: 1.5; }
.post-card h3 a { color: var(--dark); transition: color var(--transition); }
.post-card h3 a:hover { color: var(--brand); }
.post-card p { font-size: .9rem; color: var(--muted); margin-bottom: 16px; }
.post-card-footer {
  display: flex; justify-content: space-between;
  align-items: center; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────
   COMMENTS
───────────────────────────────────────────── */
.comments-wrap,
.comments-area { max-width: 100%; }

/* Wrapper used in single.php (keeps spacing consistent without inline styles) */
.comments-wrap{ 
  margin-top: 48px;
  /* Establish containing block so #respond can never escape it */
  position: relative;
  overflow: visible;   /* allow content to show, but stablise the containing block */
}

.comments-area { 
  padding: 28px 0 8px;
  /* Contain any floats or absolutely-positioned children */
  display: flow-root;
}
.comments-area,
.comments-area * { box-sizing: border-box; }

.comments-title{
  margin: 40px 0 24px;
  font-size: 1.3rem;
}

/* "اترك تعليقاً" — reply form title must stay inside .comments-area / .comments-wrap */
.comment-reply-title{
  font-size: 1.2rem;
  font-weight: 900;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-light);
  color: var(--text);
  display: block;
}
.comment-reply-title small{
  display: block;
  font-size: .8rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}

.comment-notes{
  color: var(--muted);
  font-size: .88rem;
  margin: 0 0 6px;
}

.comment-list { display: grid; gap: 16px; }

.comment-body {
  background: var(--light);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border);
  max-width: 100%;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}
.comment-author-name { font-weight: 700; font-size: .95rem; }
.comment-date { font-size: .8rem; color: var(--muted); }
.comment-text {
  font-size: .93rem;
  line-height: 1.85;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.comment-text * { max-width: 100%; }
.comment-text p:last-child { margin-bottom: 0; }
.comment-text a { word-break: break-word; text-underline-offset: 2px; }
.comment-text img,
.comment-text video,
.comment-text iframe {
  max-width: 100%;
  height: auto;
}
.comment-text pre,
.comment-text code {
  max-width: 100%;
}
.comment-text pre {
  overflow-x: auto;
  padding: 14px;
  background: rgba(0,0,0,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.comment-text table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.comment-item { max-width: 100%; }
.comment-item .children {
  margin-top: 12px;
  margin-right: 28px;
  padding-right: 14px;
  border-right: 2px solid var(--border);
  max-width: 100%;
}

.comment-navigation {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}
.comment-navigation a { font-weight: 600; }

.comment-respond { 
  margin-top: 28px;
  /* Ensure the form never breaks outside the article card on any browser */
  position: relative;
  z-index: 1;
  clear: both;
}

/* Robust grid layout for the form (doesn't break if URL field is removed) */
.comment-respond form{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.comment-respond form > p{ margin: 0; }
.comment-notes,
.comment-form-comment,
.form-submit,
.comment-form-cookies-consent{ grid-column: 1 / -1; }

.comment-respond .form-control { width: 100%; max-width: 100%; }
.comment-respond textarea { min-height: 140px; resize: vertical; }
.comment-respond .btn { max-width: 100%; white-space: normal; }

.comment-pending{ margin-inline-start: auto; }

@media (max-width: 768px) {
  .comment-item .children { margin-right: 14px; padding-right: 12px; }
}
@media (max-width: 576px) {
  .comment-respond .btn { width: 100%; }
}
.reply-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem; color: var(--brand); font-weight: 600;
  margin-top: 10px; transition: gap var(--transition);
}
.reply-link:hover { gap: 10px; }

/* ─────────────────────────────────────────────
   SEARCH RESULTS
───────────────────────────────────────────── */
.search-header { padding: 60px 0 40px; background: var(--light); }
.search-header h1 { font-size: 1.8rem; }
.search-header strong { color: var(--brand); }
.search-results-count {
  font-size: .9rem; color: var(--muted); margin-top: 8px;
}

/* AJAX Search Dropdown */
.search-wrapper { position: relative; }
.search-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; left: 0;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  z-index: 9999; max-height: 380px; overflow-y: auto;
  display: none;
}
.search-dropdown.active { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--light); }
.search-result-thumb {
  width: 48px; height: 48px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
  background: var(--light);
}
.search-result-info h4 {
  font-size: .9rem; font-weight: 700; margin-bottom: 3px;
  color: var(--dark); font-family: var(--font-base);
}
.search-result-info span { font-size: .78rem; color: var(--muted); }
.search-no-results {
  padding: 20px; text-align: center;
  color: var(--muted); font-size: .9rem;
}

/* ─────────────────────────────────────────────
   404 PAGE
───────────────────────────────────────────── */
.error-404 {
  min-height: 70vh; display: flex; align-items: center;
  justify-content: center; text-align: center;
  padding: 60px 20px;
}
.error-404-inner { max-width: 560px; }
.error-code {
  font-family: var(--font-base);
  font-size: 9rem; font-weight: 900;
  color: var(--brand); line-height: 1;
  opacity: .12;
  margin-bottom: -60px;
  position: relative; z-index: 0;
}
.error-icon { font-size: 5rem; position: relative; z-index: 1; margin-bottom: 16px; }
.error-404 h1 {
  font-size: 2rem; margin-bottom: 12px;
  position: relative; z-index: 1;
}
.error-404 p {
  color: var(--muted); margin-bottom: 32px;
  position: relative; z-index: 1;
}

/* ─────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --radius: 12px; }
  .section-padding { padding: 60px 0; }
  .section-header { margin-bottom: 40px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .btn-lg { padding: 12px 24px; font-size: .95rem; }
}
@media (max-width: 480px) {
  .container { padding: 0 16px; }
}
