/* ========== BODY & BASE ========== */
body, html {
  font-family: 'Almarai', sans-serif;
  background: #f8f8fc;
  margin: 0;
  color: #232343;
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ========== ACCORDION MAIN WRAPPER ========== */
.custom-accordion {
  background: #fff;
  border-radius: 10px;
  max-width: 700px;
  width: 100%;
  margin: 38px auto 32px auto;
  overflow: hidden;
  transition: box-shadow 0.14s;
  box-sizing: border-box;
  min-height: 50px;   /* <-- عدل الرقم حسب الارتفاع اللي تريده */

}

/* ========== ACCORDION HEADER ========== */
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 10px 10px 10px;
  background: #fff;
  font-size: 26px;
  font-weight: bold;
  color: #232343;
  user-select: none;
  box-sizing: border-box;
  width: 100%;
}

.accordion-title {
  font-size: 25px;       
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-right: 15px;  
  color: #9970e1; /* ← غيّر الكود اللوني حسب المطلوب */
}


.unit-types-title {
  text-align: right;
  padding-right: 10px;
  font-size: 0.90em;  
  color: #232343;
  margin: 2px 0 12px 0;
  opacity: 0.85;
  width: 100%;
  box-sizing: border-box;
}

.unit-types-title span {
  font-size: 1em;  
  font-weight: 400;
}

/* ========== ACCORDION ARROW ========== */
.accordion-arrow {
  width: 10px;
  height: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(.48,1.4,.31,.93);
   margin-left: 20px;
}
.accordion-arrow:before {
  content: '';
  display: inline-block;
  border: solid #7260a5;
  border-width: 0 3px 3px 0;
  padding: 4px;
  transform: rotate(45deg); /* سهم للأعلى */
  transition: inherit;
  background: none;
  border-radius: 2px;
}
.custom-accordion.open .accordion-arrow:before {
  transform: rotate(-135deg); /* سهم للأسفل */
}

/* ========== ACCORDION CONTENT ========== */
.accordion-content {
  background: #fff;
  padding: 15px 18px 26px 18px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  max-height: 900px;  /* لازم يكون أكبر من أكبر محتوى تتوقعه */
  transition: max-height 0.45s cubic-bezier(.4,1.1,.62,.98), padding 0.32s cubic-bezier(.6,0,.4,1);
}

.custom-accordion:not(.open) .accordion-content {
  padding-top: 0;
  padding-bottom: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(.4,1.1,.62,.98), padding 0.32s cubic-bezier(.6,0,.4,1);
}



/* ========== FILTER FORM INSIDE ACCORDION ========== */
.custom-filter-form {
  background: #fff;
  border-radius: 14px;
  max-width: 650px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
  direction: rtl;
  font-family: 'Almarai', sans-serif;
  box-shadow: none;
  border: none;
  box-sizing: border-box;
}

.filter-row {
  display: flex;
  gap: 11px;
  margin-bottom: 0;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.filter-input {
  border: 1.2px solid #ece5fc;
  border-radius: 8px;
  padding: 11px 9px;
  font-size: 15.5px;
  background: #fafaff;
  color: #3f287d;
  transition: border 0.14s;
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 100%;
  box-sizing: border-box;
  direction: rtl;
  font-family: inherit;
  width: 100%;
}
.filter-input:focus { border-color: #a390ea; outline: none; }

.filter-search-btn {
  background: #a777fb;
  border: none;
  border-radius: 9px;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  padding: 12px 0;
  cursor: pointer;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  transition: background 0.13s, box-shadow 0.13s;
  box-shadow: 0 2px 16px #7e54ed22;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
}

.filter-search-btn:hover { background: #8857e7; }

input, select, textarea, button {
  font-family: inherit;
  box-sizing: border-box;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 800px) {
  .custom-accordion { 
    max-width: 75vw;   /* العرض 70% فقط */
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .accordion-header { 
    padding: 12px 14px 7px 14px; /* السهم والكلام بعيد عن الحافة */
    font-size: 18px;
  }
  .accordion-content { 
    padding: 7px 14px 12px 14px; 
  }
}
@media (max-width: 700px) {
  .custom-accordion {
    max-width: 90vw;
    width: 100%;
  }
  .main-title { font-size: 18px;}
  .unit-types-title { font-size: 12.5px;}
  .accordion-header, .accordion-content { 
    padding-left: 9px !important;
    padding-right: 9px !important;
  }
}
@media (max-width: 480px) {

  .custom-accordion {
    max-width: 90vw;
    padding-left: 2vw !important;
    padding-right: 2vw !important;
  }
  .accordion-header, .accordion-content, .custom-filter-form {
    padding-left: 1vw !important;
    padding-right: 1vw !important;
  }
  .accordion-title {
  font-size: 22px;       
  margin-right: 10px;      
}
.accordion-arrow {
   margin-left: 10px;
}
.accordion-arrow:before {
  border-width: 0 3px 3px 0;
  padding: 4px;
}
 }


/* ========== CARDS GRID ========== */
.cards-container-unite {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  padding: 40px 12px 10px 12px;
  max-width: 1440px;
  margin: 0 auto 20px auto;
  justify-items: center;
} 
@media (max-width: 1100px) { .cards-container-unite { grid-template-columns: repeat(3, 1fr); } } 
@media (max-width: 900px) { .cards-container-unite { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cards-container-unite { grid-template-columns: 1fr; gap: 14px; padding: 20px 4px 5px 4px; } }

/* ========== CARD MODERN STYLE ========== */
.custom-card {
  background: #fff;
  border-radius: 28px;
  width: 100%;
  max-width: 400px;
  min-width: 300px;
  min-height: 260px;
  overflow: hidden;
  position: relative;
  margin: auto;
  border: none;
  display: flex;
  flex-direction: column;
}
.custom-card:hover {
  box-shadow: 0 13px 42px 0 #b6a6ea36, 0 2px 15px #ede1ff42;
}
@media (max-width: 700px) {
  .custom-card {
    min-width: 0;
    max-width: 80vw;
    margin: 0 auto 14px auto;
    box-sizing: border-box;
  }
  .custom-card-img { height: 160px; }
  .custom-card-body { padding: 10px 5px 38px 5px; gap: 7px;}
}
.custom-card-img {
  width: 100%;
  height: 200px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg,#faf8fc 70%,#f5efff 100%);
  border-bottom: 1px solid #f1ebff;
}
.custom-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .28s cubic-bezier(.6,.09,.91,.57);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
}
.custom-card:hover .custom-card-img img { transform: scale(1.04); }

/* حالة العرض - شريط عرضي */
.custom-status-row {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 11;
  display: flex;
  justify-content: flex-end;
}
.custom-badge {
  background: #5c999c;
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  padding: 7px 30px 7px 30px;
  border-radius: 15px 0 15px 0;
  margin: 0;
}
.custom-badge.sold { background: #b42f2f!important; }
.custom-badge.reserved { background: #ae8fe4!important; }

/* زر المفضلة دائري فوق الصورة */
.custom-fav-btn {
  position: absolute;
  right: 15px;
  top: 15px;
  background: #fff;
  color: #daa620;
  border-radius: 50%;
  padding: 7px;
  font-size: 22px;
  border: 1.5px solid #ede8f7;
  cursor: pointer;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 8px #f7efe242;
  transition: background 0.13s, color 0.13s;
}
.custom-fav-btn.active, .custom-fav-btn:hover { background: #fff8da; color: #e5b700; }

/* المدينة */
.custom-city {
  position: absolute;
  left: 50%;
  top: 185px;
  transform: translateX(-50%);
  color: #8658e0e9;
  background: #fff;
  font-size: 18px;
  font-weight: bold;
  border-radius: 11px;
  padding: 6px 25px;
  z-index: 9;
  white-space: nowrap;
  text-align: center;
}

/* جسم البطاقة */
.custom-card-body {
  flex: 1;
  padding: 30px 15px 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
  justify-content: flex-start;
  text-align: right;
  position: relative;
}

/* الصف العلوي: نوع العقار يمين، السعر يسار */
.custom-card-row.card-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  direction: rtl;
  margin-bottom: 8px;
}
.custom-card-row.card-row-top .custom-unit-type {
  order: 1;
}
.custom-card-row.card-row-top .custom-price {
  order: 2;
}
.custom-unit-type {
  font-size: 15px;
  color: #232343;
  background: #f5f3fa;
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 700;
}
.custom-price {
  font-size: 24px;
  color: #5c999c;
  font-weight: bold;
  display: flex;
  align-items: center;
  letter-spacing: 0.5px;
}
.sar-sign-img {
  height: 20px;
  width: auto;
  margin-right: 4px;
  margin-left: 0;
  display: inline-block;
  vertical-align: middle;
}

/* معلومات الوحدة */
.custom-card-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 5px 0;
  width: 100%;
}
.custom-card-icon-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12.5px;
  color: #978cbd;
  background: #f7f4fa;
  border-radius: 10px;
  padding: 4px 7px 2px 7px;
  min-width: 48px;
}
.custom-card-icon-info .material-symbols-rounded {
  font-size: 20px;
  color: #8658e0;
}

/* تفاصيل مختصرة */
.custom-card-details {
  font-size: 14px;
  color: #555;
  text-align: right;
  margin: 7px 0 0 0;
  min-height: 28px;
  max-height: 55px;
  overflow: hidden;
  line-height: 1.7;
  width: 100%;
  white-space: pre-line;
}

/* العمليات في الأسفل: باقي المواصفات يمين، باقي الأزرار يسار */
.custom-card-actions-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: auto;
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  padding: 0 1px;
  direction: rtl;
}
.custom-card-actions-right {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
}
.custom-card-actions-left {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.custom-card-specs {
  background: linear-gradient(90deg,#aa84ed 60%,#6e3de9 100%);
  color: #fff !important;
  border-radius: 11px;
  font-weight: bold;
  font-size: 15px;
  padding: 8px 22px;
  text-decoration: none !important;
  border: none;
  transition: background 0.14s, color 0.14s;
  margin-right: 12px;
}
.custom-card-specs:hover { background: #8f6aec; color: #fff !important; }
.custom-copy {
  background: #faf7ff;
  color: #8658e0;
  border-radius: 9px;
  padding: 7px 10px 5px 10px;
  cursor: pointer;
  border: 1.5px solid #ede8f7;
  transition: background 0.13s, color 0.13s;
  font-size: 17px;
  display: flex;
  align-items: center;
    margin-right: 6px;
  margin-left: 6px;
}

.custom-copy:hover { background: #d3c8f9; color: #8a68ff; }
.custom-refresh {
  background: #fff9e3;
  color: #e0a522;
  border-radius: 9px;
  padding: 7px 10px 5px 10px;
  cursor: pointer;
  border: 1.5px solid #f5e5c6;
  transition: background 0.13s, color 0.13s;
  font-size: 17px;
  display: flex;
  align-items: center;
  margin-right: 3px;
  margin-left: 3px;
}
.custom-refresh:hover { background: #ffe6ab; color: #ff9a00; }

/* ========== LOADER & FADE ========== */
#cards-loader { text-align: center; margin:30px auto; }
.loader {
  border: 5px solid #eee;
  border-top: 5px solid #8e53ee;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes spin { 0% { transform: rotate(0deg);} 100% { transform: rotate(360deg);} }
.fade-in { animation: fadeIn 0.4s; }
.fade-out { animation: fadeOut 0.18s; opacity: 0.3; }
@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }
@keyframes fadeOut { from {opacity: 1;} to {opacity: 0.2;} }



/* ========== tabs ========== */

.section-tabs-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32vh;   /* غلاف يضمن التوسيط حتى لو لم يكن هناك محتوى كثير */
  width: 100vw;
}

.section-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.section-tab-btn {
  background: #ede7fa;
  color: #7a51e0;
  border: none;
  border-radius: 11px;
  padding: 10px 32px;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.13s, color 0.13s, box-shadow 0.13s;
  box-shadow: 0 1px 8px #ede1ff44;
}

.section-tab-btn.active,
.section-tab-btn:focus,
.section-tab-btn:hover {
  background: #8e53ee;
  color: #fff;
  outline: none;
  box-shadow: 0 6px 24px #d4c4ff33;
}

/* في الشاشات الصغيرة (جوال)، اجعل الأزرار عمودية وفي المنتصف */
@media (max-width: 600px) {
  .section-tabs-wrap {
    min-height: 20vh;    /* أقل ارتفاع للجوال */
    padding-top: 15px;
  }
  .section-tabs {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100vw;
  }
  .section-tab-btn {
    width: 70vw;
    font-size: 16px;
    padding: 10px 0;
    text-align: center;
  }
}

/* ========== PAGINATION ========== */

.custom-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 14px 0;
  flex-wrap: wrap;
}

.pagination-btn {
  background: #f4f3fd;
  border: 1px solid #ece8ff;
  color: #4930c4;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
  margin: 0 2px; 
}
.pagination-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.pagination-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-input {
  width: 45px;
  height: 32px;
  border: 1px solid #ece8ff;
  border-radius: 8px;
  text-align: center;
  font-size: 15px;
  outline: none;
}
.pagination-total {
  color: #555;
  font-size: 15px;
}

/* ========== loader ========== */
.app-loader {
  position: fixed;
  z-index: 999999;
  inset: 0;
  background: #f8f8fc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}
.app-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.app-loader-spinner {
  border: 5px solid #eee;
  border-top: 5px solid #9d80f6;
  border-radius: 50%;
  width: 72px;
  height: 72px;
  animation: spin 1.05s linear infinite;
  margin-bottom: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}
.app-loader-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* يمكن تغيير الحجم أو إضافة ظل حسب الحاجة */
}
.app-loader-text {
  color: #8863e7;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 0.8px;
}

/* لما ما يكون فيه نتائج */
#cardsContainer.show-center{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 45vh;        /* يخلي المحتوى بالنص عموديًا */
  padding: 16px;
}

.no-results-center{
  text-align:center;
  color:#6f6b80;           /* غامق خفيف، عدّلها لو تحب */
  font-size: 0.95rem;
  line-height: 1.8;
}

/* الصورة: صغيرة ومتجاوبة */
.no-results-center img{
  display:block;
  margin: 0 auto 10px;     /* وسط أفقيًا */
  width: clamp(90px, 22vw, 160px);  /* تتدرج بين 90 و 160px حسب العرض */
  max-width: 40%;          /* ما تتجاوز 40% من عرض الحاوية على الشاشات الصغيرة */
  height:auto;             /* حافظ على التناسب */
  object-fit: contain;
  opacity: .9;             /* لمسة لطيفة، اختياري */
}

/* لو فيه تنسيق للكونتينر الأساسي للكروت */
.cards-container-unite{
  /* تأكد ما فيه display:grid يخبّط الcenter وقت show-center */
  /* ما يحتاج تعديل إذا عندك class show-center يبدّل display */
}

.accordion-title {
    display: flex;
    justify-content: center;  /* أفقي */
    align-items: center;      /* عمودي */
}
