/*
Theme Name: M3ak Lm3allam
Theme URI: https://m3aklm3allam.com/
Author: M3ak Lm3allam Team
Description: قالب مخصص لربط الحرفيين بالزبناء فالمغرب
Version: 1.2.0
Text Domain: m3aklm3allam
*/

:root {
  --primary: #024ca1;
  --primary-hover: #013775;
  --primary-light: #eff6ff;
  --btn-blue: #0277bd;
  --btn-blue-hover: #01579b;
  --whatsapp: #16a34a;
  --whatsapp-hover: #15803d;
  --dark: #0f172a;
  --muted: #64748b;
  --light: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--light);
  color: var(--dark);
  margin: 0;
  padding: 0;
  padding-top: 80px;
  direction: rtl;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   1. الهيدر العصري المثبت (Sticky Header)
   ========================================================================== */
.m3ak-main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: 75px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  z-index: 9999;
  display: flex;
  align-items: center;
}

body.admin-bar .m3ak-main-header {
  top: 32px;
}
@media screen and (max-width: 782px) {
  body.admin-bar .m3ak-main-header {
    top: 46px;
  }
}

.m3ak-header-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-right-side {
  display: flex;
  align-items: center;
  gap: 25px;
}

.header-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--primary);
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 1.2rem;
}

.header-navigation {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-navigation a {
  text-decoration: none;
  color: #334155;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 6px 0;
  transition: color 0.2s ease;
}

.header-navigation a:hover,
.header-navigation a.active {
  color: var(--primary);
}

.header-left-side {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-search-icon {
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 1.1rem;
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background-color 0.2s;
}

.header-search-icon:hover {
  background-color: #f1f5f9;
}

.lang-switcher-capsule {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.lang-item {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  color: var(--muted);
  border-radius: 16px;
  cursor: pointer;
}

.lang-item.active {
  background: #ffffff;
  color: var(--dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header-user-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-login-header {
  text-decoration: none;
  background: var(--btn-blue);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.btn-login-header:hover {
  background-color: var(--btn-blue-hover);
}

.btn-post-ad {
  text-decoration: none;
  background: #0077c2;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.btn-post-ad:hover {
  background-color: #005b94;
}

.plus-icon {
  font-size: 1.15rem;
}

.header-search-box-popup {
  display: none;
  position: absolute;
  top: 75px;
  left: 0;
  right: 0;
  background: #ffffff;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.header-search-box-popup.active {
  display: block;
}

.header-search-box-popup form {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}

.header-search-box-popup input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
}

.header-search-box-popup button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 25px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   2. قسم الفئات (Categories Grid With Floating Icon)
   ========================================================================== */
.view-all-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  padding: 7px 18px;
  border-radius: 6px;
  color: #334155;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.view-all-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.prof-feature-card {
  display: block;
  text-decoration: none;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.prof-feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.prof-img-box {
  width: 100%;
  height: 145px;
  overflow: hidden;
  background: #f1f5f9;
}

.prof-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.prof-feature-card:hover .prof-img-box img {
  transform: scale(1.06);
}

.prof-floating-badge {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -22px auto 0;
  position: relative;
  z-index: 5;
  font-size: 1.25rem;
  border: 2px solid #ffffff;
}

.prof-title-box {
  padding: 14px 10px 18px;
  text-align: center;
  background: #ffffff;
}

.prof-title-box h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--dark);
  font-weight: 700;
}

/* ==========================================================================
   3. قسم المدونة الجديد (Blog Cards & 3-Columns Grid)
   ========================================================================== */
.blogs-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}

.blog-preview-card {
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.blog-preview-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.07);
}

.blog-thumb-box {
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: #f1f5f9;
}

.blog-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.blog-preview-card:hover .blog-thumb-box img {
  transform: scale(1.05);
}

.blog-info-box {
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  text-align: center;
}

.blog-title {
  margin: 0 0 16px 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
}

.blog-title a {
  color: var(--dark);
  text-decoration: none;
  transition: color 0.2s;
}

.blog-title a:hover {
  color: var(--primary);
}

.blog-meta-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

.meta-sep {
  color: #cbd5e1;
}

/* ==========================================================================
   4. التجاوب مع شاشات الهواتف والأجهزة اللوحية
   ========================================================================== */
@media (max-width: 991px) {
  .header-navigation,
  .lang-switcher-capsule,
  .btn-login-header {
    display: none;
  }

  .btn-post-ad {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .blogs-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .blogs-grid-3 {
    grid-template-columns: 1fr;
  }
}
/* تنسيق كارت الخدمة في الصفحة الرئيسية */
.service-ad-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.service-ad-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.service-ad-thumb {
    position: relative;
    width: 100%;
    height: 180px;
    background: #f1f5f9;
    overflow: hidden;
}

.service-ad-thumb img {
    display: block;
}

.service-ad-card:hover .service-ad-thumb img {
    transform: scale(1.05);
}

.service-badge-prof {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(2, 76, 161, 0.9);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.service-ad-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.service-ad-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 8px;
}

.service-ad-title {
    margin: 0 0 16px 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
}

.service-ad-title a {
    color: #0f172a;
    text-decoration: none;
    transition: color 0.2s;
}

.service-ad-title a:hover {
    color: #024ca1;
}

.btn-view-service {
    display: block;
    text-align: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #024ca1;
    padding: 9px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.2s;
}

.btn-view-service:hover {
    background: #024ca1;
    color: #ffffff;
    border-color: #024ca1;
}
/* ضبط حاوية صفحة الأرشيف والتصنيف */
.tax-profession,
.archive.tax-profession main,
.archive .site-main {
    max-width: 1200px !important;
    margin: 30px auto !important;
    padding: 0 15px !important;
    box-sizing: border-box !important;
}

/* تحويل القائمة العمودية إلى شبكة (Grid) متناسقة */
.tax-profession .site-main,
.tax-profession .posts-loop,
.tax-profession .artisan-list,
.tax-profession ul.products,
.tax-profession .archive-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 25px !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

/* تنسيق بطاقة الحرفي (Card) لتكون أنيقة وموحدة */
.tax-profession article,
.tax-profession .artisan-card,
.tax-profession .type-artisan {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
    display: flex !important;
    flex-direction: column !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    margin: 0 !important;
    width: 100% !important;
}

.tax-profession article:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
}
/* ضبط حاوية صفحة الأرشيف والتصنيف */
.tax-profession,
.archive.tax-profession main,
.archive .site-main {
    max-width: 1200px !important;
    margin: 30px auto !important;
    padding: 0 15px !important;
    box-sizing: border-box !important;
}

/* تحويل القائمة العمودية إلى شبكة (Grid) متناسقة */
.tax-profession .site-main,
.tax-profession .posts-loop,
.tax-profession .artisan-list,
.tax-profession ul.products,
.tax-profession .archive-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 25px !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

/* تنسيق بطاقة الحرفي (Card) لتكون أنيقة وموحدة */
.tax-profession article,
.tax-profession .artisan-card,
.tax-profession .type-artisan {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
    display: flex !important;
    flex-direction: column !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    margin: 0 !important;
    width: 100% !important;
}

.tax-profession article:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
}

/* ضبط حجم الصور داخل البطاقات لتكون متساوية */
.tax-profession article img {
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

/* ترتيب النصوص والبيانات داخل الكارت */
.tax-profession article .entry-content,
.tax-profession article .artisan-info,
.tax-profession article .card-body {
    padding: 15px !important;
    text-align: right !important;
}
/* فرض ظهور قائمة لوحة التحكم وأدوات التعديل في الهاتف والتابلت */
@media (max-width: 991px) {
    /* استهداف كلاسات القائمة الجانبية الأكثر شيوعاً في القالب */
    .dashboard-sidebar,
    .dashboard-nav,
    .user-dashboard-menu,
    .artisan-dashboard-sidebar,
    .dashboard-tabs-nav,
    aside.dashboard-sidebar,
    div[class*="dashboard-sidebar"],
    ul[class*="dashboard-menu"],
    div[class*="dashboard-nav"] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        margin: 15px auto 25px auto !important;
        background: #ffffff !important;
        border-radius: 12px !important;
        padding: 10px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    }

    /* تحسين شكل العناصر لتناسب اللمس في الهاتف */
    .dashboard-sidebar a,
    .dashboard-nav a,
    .user-dashboard-menu a {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 12px 15px !important;
        font-size: 0.95rem !important;
        border-radius: 8px !important;
        margin-bottom: 6px !important;
    }
}
