/*
Theme Name: وظائف - Wazaif Jobs
Theme URI: https://example.com/wazaif
Author: Wazaif Theme
Description: Arabic RTL Jobs Portal Theme - Mobile First, Lightweight, SEO Friendly
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wazaif
Tags: rtl-language, blog, news, custom-logo, featured-images, threaded-comments, translation-ready
*/

/* =========================================
   CSS CUSTOM PROPERTIES
   ========================================= */
:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --primary-light: #DBEAFE;
  --accent:        #F59E0B;
  --text:          #111827;
  --text-muted:    #6B7280;
  --border:        #E5E7EB;
  --bg:            #F3F4F6;
  --white:         #FFFFFF;
  --card-shadow:   0 2px 8px rgba(0,0,0,.08);
  --card-shadow-hover: 0 8px 24px rgba(37,99,235,.15);
  --radius:        12px;
  --radius-sm:     8px;
  --font-ar:       'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --transition:    .22s ease;
  --max-width:     1200px;
  --header-h:      70px;
}

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

html {
  direction: rtl;
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ar);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-dark); }

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

ul, ol { list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.35rem); }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* =========================================
   LAYOUT UTILITIES
   ========================================= */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1rem;
}

.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 !important;
}
.screen-reader-text:focus {
  background: var(--white); border-radius: 4px; clip: auto; clip-path: none;
  color: var(--text); display: block; font-size: .875rem; font-weight: 700;
  height: auto; left: 1rem; padding: .75rem 1.25rem; top: 1rem;
  width: auto; z-index: 100000;
}

/* =========================================
   HEADER
   ========================================= */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

/* Logo on right (RTL = start) */
.site-branding {
  display: flex;
  align-items: center;
  gap: .75rem;
  order: 1;
}

.site-logo img {
  width: 100px;
  height: 50px;
  object-fit: contain;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.site-title a { color: inherit; }
.site-title a:hover { color: var(--primary-dark); }

.site-description {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

/* Date on left (RTL = end) */
.header-date {
  order: 2;
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .1rem;
}
.header-date .date-hijri {
  font-size: .75rem;
  color: var(--primary);
}

/* =========================================
   NAVIGATION
   ========================================= */
.main-navigation {
  background: var(--primary);
}

.main-navigation .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  padding: .75rem;
  cursor: pointer;
  color: var(--white);
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-menu {
  display: none;
  flex-direction: column;
  background: var(--primary-dark);
  width: 100%;
  position: absolute;
  right: 0; left: 0;
  top: calc(var(--header-h) + 44px);
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.nav-menu.is-open { display: flex; }

.nav-menu li a {
  display: block;
  color: var(--white);
  padding: .85rem 1.25rem;
  font-weight: 600;
  font-size: .95rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  transition: background var(--transition);
}
.nav-menu li a:hover,
.nav-menu li.current-menu-item > a {
  background: rgba(255,255,255,.12);
  color: var(--white);
}

/* Desktop nav */
@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .nav-menu {
    display: flex;
    flex-direction: row;
    position: static;
    background: transparent;
    width: auto;
    box-shadow: none;
  }
  .nav-menu li a {
    border-bottom: none;
    padding: .9rem 1.1rem;
    font-size: .9rem;
    border-bottom: 3px solid transparent;
  }
  .nav-menu li a:hover,
  .nav-menu li.current-menu-item > a {
    background: rgba(255,255,255,.1);
    border-bottom-color: var(--accent);
  }
}

/* =========================================
   SEARCH BAR
   ========================================= */
.header-search {
  background: var(--primary-light);
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}

.search-form {
  display: flex;
  gap: .5rem;
  max-width: 680px;
  margin-inline: auto;
}

.search-field {
  flex: 1;
  padding: .65rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--white);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: rtl;
  text-align: right;
}
.search-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.search-field::placeholder { color: var(--text-muted); }

.search-submit {
  padding: .65rem 1.25rem;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}
.search-submit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* =========================================
   MAIN LAYOUT
   ========================================= */
.site-content {
  padding: 1.5rem 0 3rem;
}

.content-area {
  width: 100%;
}

@media (min-width: 1024px) {
  .with-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
  }
}

/* =========================================
   SECTION TITLES
   ========================================= */
.section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 3px solid var(--primary);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.1rem;
  background: var(--primary);
  border-radius: 2px;
}

/* =========================================
   JOB CARDS GRID
   ========================================= */
.jobs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .jobs-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .jobs-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================
   JOB CARD
   ========================================= */
.job-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.job-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--primary-light);
}

/* Category badge */
.job-card-category {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: var(--primary);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 20px;
  letter-spacing: .01em;
  z-index: 1;
}

.job-card-body {
  padding: 1rem 1rem .75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.job-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: .5rem;
  padding-top: 1.4rem; /* space for badge */
}
.job-card-title a {
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.job-card-title a:hover { color: var(--primary); }

.job-card-excerpt {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: .75rem;
}

.job-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
}

/* Date bottom left (RTL = end) */
.job-card-date {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .3rem;
  order: 2;
}
.job-card-date svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Logo/image bottom right (RTL = start) */
.job-card-logo {
  order: 1;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.job-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.job-card-logo .logo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 800;
}

/* =========================================
   FEATURED CARD (first card)
   ========================================= */
.job-card.is-featured {
  grid-column: 1 / -1;
  flex-direction: row;
  min-height: 160px;
}

@media (max-width: 599px) {
  .job-card.is-featured { flex-direction: column; }
}

.job-card.is-featured .job-card-featured-img {
  width: 220px;
  min-height: 160px;
  flex-shrink: 0;
  overflow: hidden;
}
.job-card.is-featured .job-card-featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-card.is-featured .job-card-title { font-size: 1.25rem; }

/* =========================================
   SINGLE POST
   ========================================= */
.single-post-header {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}

.single-post-category {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 700;
  padding: .25rem .75rem;
  border-radius: 20px;
  margin-bottom: .75rem;
}

.single-post-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  margin-bottom: .75rem;
  line-height: 1.3;
}

.single-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .83rem;
  color: var(--text-muted);
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.single-post-meta span {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.single-featured-image {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
  max-height: 420px;
}
.single-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.single-post-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  font-size: 1rem;
  line-height: 1.85;
}

.single-post-content h2,
.single-post-content h3,
.single-post-content h4 {
  margin: 1.5rem 0 .75rem;
  color: var(--primary);
}

.single-post-content ul,
.single-post-content ol {
  list-style: disc;
  padding-right: 1.5rem;
  margin-bottom: 1rem;
}
.single-post-content ol { list-style: decimal; }

.single-post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.single-post-content th,
.single-post-content td {
  border: 1px solid var(--border);
  padding: .6rem .85rem;
  text-align: right;
}
.single-post-content th { background: var(--primary-light); font-weight: 700; }
.single-post-content tr:nth-child(even) td { background: #F9FAFB; }

.apply-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--primary);
  color: var(--white);
  padding: .85rem 2rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  margin-top: 1.5rem;
  transition: background var(--transition), transform var(--transition);
  border: none;
  cursor: pointer;
}
.apply-btn:hover {
  background: var(--primary-dark);
  color: var(--white);
  transform: translateY(-2px);
}

/* Share / nav */
.post-navigation {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.post-nav-link {
  flex: 1;
  min-width: 140px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-size: .85rem;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}
.post-nav-link:hover { border-color: var(--primary); color: var(--primary); }
.post-nav-link strong { display: block; color: var(--text); font-size: .95rem; }

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar { margin-top: 2rem; }
@media (min-width: 1024px) { .sidebar { margin-top: 0; } }

.widget {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}
.widget-title {
  font-size: .95rem;
  font-weight: 800;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--primary);
  color: var(--text);
}

.widget ul li {
  border-bottom: 1px solid var(--border);
  padding: .5rem 0;
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a {
  font-size: .88rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.widget ul li a:hover { color: var(--primary); }
.widget ul li a::before {
  content: '◂';
  color: var(--primary);
  font-size: .7rem;
}

/* =========================================
   PAGINATION
   ========================================= */
.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 2.5rem;
}
.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  transition: all var(--transition);
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination span.current { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* =========================================
   ARCHIVE / CATEGORY HEADER
   ========================================= */
.archive-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 2rem 0;
  margin-bottom: 1.5rem;
}
.archive-header .archive-title {
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  font-weight: 800;
  color: var(--white);
  margin-bottom: .3rem;
}
.archive-header .archive-description {
  font-size: .9rem;
  opacity: .85;
  margin: 0;
}

/* =========================================
   SEARCH RESULTS
   ========================================= */
.search-header {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}
.search-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .4rem;
}
.search-header p { font-size: .88rem; color: var(--text-muted); margin: 0; }
.search-header strong { color: var(--primary); }

.no-results {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.no-results-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}
.no-results h2 { font-size: 1.3rem; margin-bottom: .5rem; }
.no-results p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* =========================================
   404 PAGE
   ========================================= */
.error-404 {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
}
.error-404-inner {
  max-width: 480px;
}
.error-404-code {
  font-size: clamp(5rem, 18vw, 9rem);
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: .5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.error-404 h2 { font-size: 1.4rem; margin-bottom: .75rem; }
.error-404 p { color: var(--text-muted); margin-bottom: 1.75rem; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary);
  color: var(--white);
  padding: .75rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .95rem;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--primary-dark); color: var(--white); transform: translateY(-2px); }

/* =========================================
   FOOTER
   ========================================= */
.site-footer {
  background: #111827;
  color: #D1D5DB;
  padding: 3rem 0 0;
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
@media (min-width: 640px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
}

.footer-brand .site-title { color: var(--white); font-size: 1.35rem; }
.footer-brand p {
  font-size: .85rem;
  color: #9CA3AF;
  margin-top: .75rem;
  line-height: 1.7;
}

.footer-widget h4 {
  color: var(--white);
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}
.footer-widget ul li { margin-bottom: .5rem; }
.footer-widget ul li a {
  color: #9CA3AF;
  font-size: .88rem;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.footer-widget ul li a:hover { color: var(--white); }
.footer-widget ul li a::before {
  content: '◂';
  color: var(--primary);
  font-size: .65rem;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem 0;
  font-size: .8rem;
  color: #6B7280;
  text-align: center;
}
@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: right;
  }
}
.footer-bottom a { color: #9CA3AF; }
.footer-bottom a:hover { color: var(--white); }

/* =========================================
   BREADCRUMBS
   ========================================= */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding: .6rem 0;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs .current { color: var(--text); font-weight: 600; }

/* =========================================
   BACK TO TOP
   ========================================= */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem; /* LTR left = RTL left visually */
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 900;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--primary-dark); }

/* =========================================
   LOADING / SKELETON
   ========================================= */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

/* =========================================
   RESPONSIVE UTILITIES
   ========================================= */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
}

/* =========================================
   PRINT
   ========================================= */
@media print {
  .site-header, .main-navigation, .header-search,
  .sidebar, .site-footer, .back-to-top,
  .post-navigation { display: none !important; }
  body { background: white; color: black; }
  .single-post-content { box-shadow: none; border: none; }
}
