/* ============================================================
   UI IMPROVEMENTS — feature/ui-improvements-2026
   All responsive fixes and enhancements in one file.
   ============================================================ */

/* ============================================================
   1. MOBILE HEADER — Logo RIGHT / Menu+Search LEFT
   ============================================================ */
/*
   Layout logic (RTL page):
   - In RTL flexbox, the first child appears on the visual RIGHT.
   - .brand (first child) = logo only  → RIGHT side  ✓
   - .header_cta (second child) = search + hamburger → LEFT side  ✓
   - No flex-direction override needed — RTL row does this automatically.
*/

@media screen and (max-width: 1199px) {
  /* Logo is smaller on mobile */
  .header__inner-mobile .brand .logo img {
    width: 5.5rem !important;
    height: auto !important;
  }

  /* .brand should only show the logo — no flex gymnastics needed */
  .header__inner-mobile .brand {
    display: flex !important;
    align-items: center !important;
  }

  /* Hide the EN <a> link from the header bar (it's in the sidebar) */
  .header__inner-mobile .header_cta ul > li > a.nav_link[href="#"]:not(.roya__search-overlay-btn) {
    display: none !important;
  }
  /* Hide the .roya__menu-btn (Login button) from the header bar */
  .header__inner-mobile .header_cta ul > li.roya__menu-btn {
    display: none !important;
  }
}

/* ============================================================
   1b. MOBILE HEADER — Cart icon + badge
   ============================================================ */
.cart-btn {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cart-badge {
  position: absolute;
  top: 8px;
  right: -8px;
  background: linear-gradient(135deg, #f79433 0%, #e67e1a 100%);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  line-height: 1;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(247, 148, 51, 0.4);
}

.cart-badge.hide {
  display: none;
}

/* ============================================================
   1c. MOBILE HEADER — Sidebar bottom buttons full-width stacked
   ============================================================ */
@media screen and (max-width: 1199px) {
  /* Make the bottom action items in sidebar look like full-width buttons */
  .sidebar-offcanvas .offcanvas-body .content .list .list-item:nth-last-child(-n+3) {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    margin: 0 1.2rem 0.5rem;
    padding: 0.75rem 1rem;
    text-align: center;
    width: auto;
  }

  /* 2nd-to-last and last items get orange text */
  .sidebar-offcanvas .offcanvas-body .content .list .list-item:nth-last-child(-n+2) .list-link,
  .sidebar-offcanvas .offcanvas-body .content .list .list-item:nth-last-child(-n+2) .list-icon {
    color: #f79433 !important;
  }

  .sidebar-offcanvas .offcanvas-body .content .list .list-item:nth-last-child(-n+2) {
    border-color: #f79433;
  }
}

/* ============================================================
   2. HOME PAGE — Mobile button stacking & font size
   ============================================================ */

/* Stack side-by-side CTA buttons on mobile */
@media (max-width: 767px) {
  /* Hero section 2-button row */
  .hero-cta .inner-wrap.d-flex,
  .hero-cta .inner-wrap {
    flex-direction: column !important;
  }

  /* About sections with 2 side-by-side buttons */
  .roya__about-section .cta.d-flex,
  .roya__about-section .cta {
    flex-direction: column !important;
  }

  /* 2nd and 3rd buttons in hero → orange text */
  .hero-cta .inner-wrap:not(:first-child) .btn-roya.white,
  .hero-cta .btn-roya.white {
    color: #f79433 !important;
  }
}

/* Reduce font size of bullet list content on mobile (keep heading size) */
@media (max-width: 767px) {
  .roya-ul__style1 {
    font-size: 0.875rem !important;
  }
  .roya-ul__style1 li {
    font-size: 0.875rem !important;
  }
}

/* ============================================================
   3. SERVICE PAGES — Breadcrumb removal
   ============================================================ */

/* Hide the Home > Services breadcrumb bar (all pages, all screen sizes) */
.breadcrumb-nav,
.sdv2-nav,
.roya_services_breadcrumb {
  display: none !important;
}

/* ============================================================
   3b. SERVICE PAGES — Image above title on mobile
   ============================================================ */

@media (max-width: 991px) {
  /* service-details-v2: show image column BEFORE text column */
  .sdv2-hero .col-lg-7 {
    order: 2 !important;
  }
  .sdv2-hero .col-lg-5 {
    order: 1 !important;
  }

  /* service-details-v3: image (col-lg-5) above text (col-lg-7) on mobile */
  .roya_services_hero .col-lg-7 {
    order: 2 !important;
  }
  .roya_services_hero .col-lg-5 {
    order: 1 !important;
  }

  /* service-details v1: show image above title */
  .service-details-hero .service-icon-large {
    margin-bottom: 1rem;
  }
}

/* ============================================================
   3c. SERVICE PAGES — Accordion Plus sign: larger, no circle, left
   ============================================================ */

/* Accordion button: larger + on the LEFT (RTL: start) */
.sdv2-faq .accordion-button::after,
.sdv2-faq .accordion-button:not(.collapsed)::after {
  width: 28px !important;
  height: 28px !important;
  font-size: 1.4rem !important;
  margin-inline-start: 0 !important;
  margin-inline-end: auto !important;
  order: -1 !important;
  background-image: none !important;
  content: "+" !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700 !important;
  color: #1464ff !important;
  flex-shrink: 0 !important;
}

.sdv2-faq .accordion-button:not(.collapsed)::after {
  content: "−" !important;
  color: #f79433 !important;
}

.sdv2-faq .accordion-button {
  flex-direction: row-reverse !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

/* ============================================================
   3d. SERVICE PAGES — Reviews swiper: fix lag & show more slides
   ============================================================ */

/* Optimize swiper transitions for performance */
.swiper {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}

.swiper-slide {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ============================================================
   4. PACKAGES/POWERPOINTS PAGES — Mobile improvements
   ============================================================ */

/* Improve search bar on mobile */
@media (max-width: 767px) {
  .search-section .search-bar {
    padding: 0 1rem;
  }

  .search-section .search-bar .input-group,
  .search-section .search-bar > div {
    border-radius: 16px !important;
    overflow: visible;
  }

  .search-section .search-bar input {
    padding: 14px 18px !important;
    font-size: 0.95rem !important;
    border-radius: 12px !important;
  }

  /* Make "عرض ...." text show on one line */
  .results-header .results-count,
  .results-header p,
  .results-count {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* Add horizontal margins on mobile */
@media (max-width: 767px) {
  .courses-page .container,
  .powerpoints-page .container {
    padding-right: 1.25rem !important;
    padding-left: 1.25rem !important;
  }

  .courses-grid,
  .powerpoints-grid {
    padding: 0 0.5rem;
  }

  /* Checkmark style: small bullet on the right, text next to it */
  .package-features-list li,
  .usage-terms-section li,
  .package-details-content ul li {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.4rem !important;
    list-style: none !important;
    padding-right: 0 !important;
    margin-right: 0 !important;
  }

  .package-features-list li::before,
  .usage-terms-section ul li::before,
  .package-details-content ul li .flaticon-check,
  .package-details-content ul li i.flaticon-check {
    content: "✓" !important;
    color: #28a745 !important;
    font-size: 0.8rem !important;
    font-style: normal !important;
    flex-shrink: 0 !important;
    margin-top: 3px !important;
    display: inline-block !important;
  }

  /* Pagination on mobile: same style as desktop */
  .pagination-wrapper .pagination {
    flex-wrap: nowrap !important;
    justify-content: center !important;
  }

  .pagination-wrapper .pagination .page-item .page-link {
    width: 38px !important;
    height: 38px !important;
    font-size: 0.875rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }
}

/* ============================================================
   4b. PACKAGES/POWERPOINTS — Desktop improvements
   ============================================================ */

/* Add margin on desktop matching hero section */
@media (min-width: 992px) {
  .courses-page .courses-content,
  .powerpoints-page .powerpoints-layout {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Filter sidebar: scrollable */
  .filter-sidebar {
    position: sticky !important;
    top: 90px !important;
    max-height: calc(100vh - 110px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin !important;
    scrollbar-color: #f79433 #f0f0f0 !important;
  }

  .filter-sidebar::-webkit-scrollbar {
    width: 4px;
  }

  .filter-sidebar::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
  }

  .filter-sidebar::-webkit-scrollbar-thumb {
    background: #f79433;
    border-radius: 4px;
  }
}

/* ============================================================
   4c. PACKAGE DETAILS — Sticky sidebar card & larger title
   ============================================================ */

/* Sticky sidebar scrolls the full length of the page */
@media (min-width: 992px) {
  .package-sidebar {
    position: sticky !important;
    top: 90px !important;
    align-self: flex-start !important;
    max-height: calc(100vh - 110px) !important;
    overflow-y: auto !important;
  }

  /* Larger sidebar title */
  .package-sidebar-card .sidebar-title {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    line-height: 1.6 !important;
  }

  /* Horizontal margins aligning with hero section */
  .package-details-page .package-page-layout {
    padding: 0 1rem;
  }
}

/* ============================================================
   5. PACKAGES/POWERPOINTS LISTING — Header icons & description
   ============================================================ */

/* Move icons above the page title (both pages) */
.page-header .page-header-icons {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.75rem !important;
  margin-bottom: 1rem !important;
  flex-wrap: wrap !important;
}

/* Smaller icons matching the top bar style */
.page-header .page-header-icons img,
.page-header .page-header-icons i {
  width: 28px !important;
  height: 28px !important;
  font-size: 1.1rem !important;
  opacity: 0.9 !important;
}

/* Delete the old icon bar above the title */
.page-header .page-header-top-bar {
  display: none !important;
}

/* Description field below the main title */
.page-header .page-header-description {
  font-size: 1rem !important;
  opacity: 0.9 !important;
  max-width: 600px !important;
  margin: 0.5rem auto 0 !important;
  line-height: 1.7 !important;
}

/* ============================================================
   6. 90% SCROLL POPUP — Both desktop & mobile
   ============================================================ */

/* Popup overlay */
#scroll-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

#scroll-popup-overlay.active {
  display: flex !important;
}

#scroll-popup-box {
  background: #ffffff;
  border-radius: 20px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  direction: rtl;
  text-align: right;
  animation: popupFadeIn 0.35s ease-out;
}

@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#scroll-popup-box .popup-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.2s;
}

#scroll-popup-box .popup-close:hover {
  color: #f79433;
}

#scroll-popup-box .popup-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff3e6;
  color: #f79433;
  border: 1px solid #ffd8a8;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

#scroll-popup-box h3 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a2b3c;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

#scroll-popup-box p {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

#scroll-popup-box .popup-form .form-control {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  text-align: right;
  width: 100%;
  transition: border-color 0.2s;
}

#scroll-popup-box .popup-form .form-control:focus {
  border-color: #f79433;
  outline: none;
  box-shadow: 0 0 0 3px rgba(247, 148, 51, 0.15);
}

#scroll-popup-box .popup-form .btn-popup-submit {
  width: 100%;
  background: #f79433;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  margin-top: 0.25rem;
}

#scroll-popup-box .popup-form .btn-popup-submit:hover {
  background: #e8811f;
  transform: translateY(-1px);
}

#scroll-popup-box .popup-note {
  font-size: 0.78rem;
  color: #999;
  text-align: center;
  margin-top: 0.75rem;
}

/* ============================================================
   7. SERVICE DETAILS V2 — Include items: + sign, image inside
   ============================================================ */

/* Plus sign: large, no circle, left of text */
.sdv2-plus-sign {
  font-size: 1.6rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  color: #f79433 !important;
  flex-shrink: 0 !important;
  margin-top: 2px !important;
  font-family: monospace !important;
  min-width: 20px !important;
}

/* Include item: stack image on top of text content */
.sdv2-include-item {
  flex-direction: column !important;
  align-items: stretch !important;
}

.sdv2-include-content {
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 8px !important;
}



/* Image fills full card width — stacked layout */
.sdv2-include-media {
  width: 100% !important;
  height: 160px !important;
  border-radius: 10px !important;
  object-fit: cover !important;
  display: block !important;
  flex-shrink: 0 !important;
  margin-bottom: 0.5rem !important;
}

@media (max-width: 575px) {
  .sdv2-include-media {
    height: 130px !important;
  }
}

/* ============================================================
   8. GENERAL — Page header description field
   ============================================================ */

.page-header-subtitle {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0.5rem auto 0;
  line-height: 1.7;
}

/* ============================================================
   9. OUR WORK PAGE — أعمالنا
   ============================================================ */

.our-work-page {
  padding: 0 0 80px;
}

.our-work-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.our-work-filter-btn {
  padding: 8px 22px;
  border: 2px solid #e0e0e0;
  border-radius: 999px;
  background: white;
  color: #333;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.our-work-filter-btn.active,
.our-work-filter-btn:hover {
  background: #f79433;
  border-color: #f79433;
  color: white;
}

.our-work-gallery {
  display: none;
  animation: fadeInGallery 0.4s ease;
}

.our-work-gallery.active {
  display: block;
}

@keyframes fadeInGallery {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.our-work-swiper {
  padding-bottom: 3rem !important;
}

.our-work-swiper .swiper-slide img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

@media (max-width: 767px) {
  .our-work-swiper .swiper-slide img {
    height: 220px;
  }
}

.our-work-video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 14px;
}

.our-work-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 14px;
}
