/*
 * Custom Responsive Styles for Dar Al Mahja
 * Fix logo size and icon positions in responsive mode
 */

/* Responsive logo sizing */
@media (max-width: 991px) {
  .navbar-brand img {
    max-width: 120px !important;
    height: auto !important;
  }
}

@media (max-width: 768px) {
  .navbar-brand img {
    max-width: 100px !important;
    height: auto !important;
  }
}

@media (max-width: 576px) {
  .navbar-brand img {
    max-width: 80px !important;
    height: auto !important;
  }
}

/* Fix header container layout in responsive mode */
@media (max-width: 768px) {
  .navbar .container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-direction: row-reverse !important;
  }

  /* Logo on the right */
  .navbar-brand {
    order: 2 !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    padding-left: 0.5rem !important;
    padding-right: 0 !important;
  }

  /* Icons on the left */
  .navbar .d-flex.align-items-center.gap-md-1.ms-auto {
    order: 1 !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    gap: 0.25rem !important;
    padding-right: 0.5rem !important;
    padding-left: 0 !important;
  }

  /* Account and cart buttons */
  .d-flex.align-items-center.justify-content-end {
    gap: 0.25rem !important;
  }

  /* Show account button on mobile */
  .d-flex.align-items-center.justify-content-end .d-none.d-md-inline-flex {
    display: inline-flex !important;
  }

  /* Adjust button sizes for mobile */
  .btn-icon.fs-xl,
  .btn-icon.fs-lg {
    width: 2.5rem !important;
    height: 2.5rem !important;
    font-size: 1.25rem !important;
  }

  /* Ensure cart badge is visible */
  .btn-icon .badge {
    font-size: 0.625rem !important;
    padding: 0.2em 0.35em !important;
  }

  /* Remove unnecessary margins */
  .btn-icon.btn-outline-secondary {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

@media (max-width: 576px) {
  /* Further adjustments for small screens */
  .navbar .container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .navbar-brand {
    padding-left: 0.25rem !important;
    padding-right: 0 !important;
  }

  .navbar .d-flex.align-items-center.gap-md-1.ms-auto {
    gap: 0.125rem !important;
    padding-right: 0.25rem !important;
    padding-left: 0 !important;
  }

  .d-flex.align-items-center.justify-content-end {
    gap: 0.125rem !important;
  }

  .btn-icon.fs-xl,
  .btn-icon.fs-lg {
    width: 2.25rem !important;
    height: 2.25rem !important;
    font-size: 1.125rem !important;
  }
}

/* Fix search bar in responsive mode */
@media (max-width: 767px) {
  #searchBar .form-control {
    font-size: 0.875rem !important;
    padding-right: 3rem !important;
  }

  #searchBar .position-relative {
    width: 100%;
  }

  #mobileSearchBtn {
    z-index: 10;
  }

  #mobileSearchInput {
    width: 100%;
  }
}

/* Ensure proper spacing between logo and icons on medium screens */
@media (min-width: 769px) and (max-width: 991px) {
  .navbar .d-flex.align-items-center.gap-md-1.ms-auto {
    margin-left: auto !important;
    flex-shrink: 0 !important;
  }
}

/* Additional spacing fix for the navbar on mobile */
@media (max-width: 768px) {
  header.navbar .container {
    gap: 0 !important;
  }

  header.navbar .container .justify-content-start {
    justify-content: space-between !important;
  }
}

/* Navigation Menu Styling */
nav.navbar-expand-lg .navbar-nav .nav-link {
  color: #edf4ff !important;
  transition: all 0.3s ease;
}

nav.navbar-expand-lg .navbar-nav .nav-link:hover {
  color: #ffffff !important;
  opacity: 0.9;
}

nav.navbar-expand-lg .navbar-nav .nav-link.active {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-radius: 0.375rem;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* Ensure navbar toggler icon is visible on mobile */
@media (max-width: 991px) {
  nav.navbar-expand-lg .navbar-toggler-icon {
    filter: brightness(0) invert(1);
  }
}

/* Book categories dropdown menu - limit height and add scroll */
.dropdown-menu.rounded-4 {
  max-height: 400px !important;
  overflow-y: auto !important;
}

/* Style the scrollbar for the dropdown */
.dropdown-menu.rounded-4::-webkit-scrollbar {
  width: 8px;
}

.dropdown-menu.rounded-4::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.dropdown-menu.rounded-4::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.dropdown-menu.rounded-4::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Product Card Hover Details - Fix to show all items */
.product-card-details {
  max-height: none !important;
  overflow: visible !important;
  z-index: 10 !important;
  height: auto !important;
  min-height: fit-content !important;
}

/* Ensure product card has proper stacking context on hover */
.product-card:hover {
  z-index: 20 !important;
  position: relative !important;
}

.product-card:hover .product-card-details {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Add smooth transition for better user experience */
.product-card-details {
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out !important;
}

/* Fix for swiper slides to allow overflow */
.hero-swiper-section .swiper,
.hero-swiper-section .hero-swiper {
  overflow: visible !important;
}

.hero-swiper .swiper-slide,
.hero-swiper-slide {
  overflow: visible !important;
}

.hero-swiper .swiper-wrapper {
  overflow: visible !important;
}

/* Ensure the swiper container allows overflow */
section.hero-swiper-section {
  overflow: visible !important;
}

.swiper-container {
  overflow: visible !important;
}

/* Fix hero swiper horizontal shift on RTL pages */
section.hero-swiper-section {
  position: relative !important;
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

section.hero-swiper-section .container {
  max-width: 100% !important;
}

.hero-swiper {
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Prevent body horizontal scroll but allow vertical overflow for hover details */
body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  max-width: 100vw !important;
}

main.content-wrapper {
  overflow-x: hidden !important;
  overflow-y: visible !important;
  width: 100% !important;
}

/* Fix product grid overflow to show all hover details */
#productsGrid,
#productsGrid .row,
#productsGrid .col,
.product-item {
  overflow: visible !important;
}

/* Ensure all grid containers allow overflow */
.row.row-cols-2,
.row.row-cols-md-3,
.row.g-4 {
  overflow: visible !important;
}

/* Ensure grid row containers don't clip */
.row {
  overflow: visible !important;
}

/* Make sure parent sections don't clip content */
section.pb-5,
section.container,
.container {
  overflow: visible !important;
}

.col-lg-9,
.col-lg-3,
.col {
  overflow: visible !important;
}

/* ============================================
   Mobile Bottom Navigation Bar
   ============================================ */

/* Bottom Navigation Container */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1030;
  display: none;
  padding: 0.5rem 0;
  direction: rtl;
}

/* Show bottom nav only on mobile (under 768px) */
@media (max-width: 767px) {
  .mobile-bottom-nav {
    display: block;
  }

  /* Add padding to body to prevent content from being hidden behind bottom nav */
  body {
    padding-bottom: 70px;
  }
}

/* Navigation Items Container */
.mobile-bottom-nav-items {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-around !important;
  align-items: center !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
  list-style: none !important;
  width: 100% !important;
  gap: 0 !important;
}

/* Individual Nav Item */
.mobile-bottom-nav-item {
  flex: 1 !important;
  display: block !important;
  text-align: center !important;
  position: relative !important;
  padding: 0.25rem 0.5rem !important;
  min-width: 60px !important;
  max-width: 25% !important;
}

/* Nav Item Link */
.mobile-bottom-nav-item a {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  color: #6c757d !important;
  transition: all 0.2s ease !important;
  width: 100% !important;
  padding: 0.25rem !important;
  border-radius: 0.5rem !important;
  min-height: 44px !important;
  min-width: 44px !important;
}

/* Nav Item Link Hover/Active */
.mobile-bottom-nav-item a:hover,
.mobile-bottom-nav-item a:active,
.mobile-bottom-nav-item a.active {
  color: #1bb1b6;
  background-color: rgba(27, 177, 182, 0.1);
}

/* Nav Icon */
.mobile-bottom-nav-item .nav-icon {
  font-size: 1.5rem;
  margin-bottom: 0.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  position: relative;
}

/* Nav Label */
.mobile-bottom-nav-item .nav-label {
  font-size: 0.675rem;
  font-weight: 500;
  white-space: nowrap;
  margin-top: 0.125rem;
}

/* Cart Badge */
.mobile-bottom-nav-item .cart-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background-color: #1bb1b6;
  color: #ffffff;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.35rem;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .mobile-bottom-nav {
    background: #1a1a1a;
    border-top-color: #333333;
  }

  .mobile-bottom-nav-item a {
    color: #a0a0a0;
  }

  .mobile-bottom-nav-item a:hover,
  .mobile-bottom-nav-item a:active,
  .mobile-bottom-nav-item a.active {
    color: #1bb1b6;
    background-color: rgba(27, 177, 182, 0.15);
  }
}

/* Extra small screens */
@media (max-width: 375px) {
  .mobile-bottom-nav-item {
    padding: 0.25rem 0.25rem;
    min-width: 50px;
  }

  .mobile-bottom-nav-item .nav-icon {
    font-size: 1.35rem;
    width: 24px;
    height: 24px;
  }

  .mobile-bottom-nav-item .nav-label {
    font-size: 0.625rem;
  }
}

/* ============================================
   Product Card Enhancements - Curved Books
   ============================================ */

/* Book Image Container - More Curved Effect */
.product-card .position-relative > a {
  border-radius: 20px !important;
  overflow: hidden !important;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  transition: all 0.3s ease !important;
}

.product-card:hover .position-relative > a {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
  transform: translateY(-2px) !important;
}

/* Book Image - More Curved Corners */
.product-card .ratio-item {
  border-radius: 16px !important;
}

/* Add subtle book spine effect */
.product-card .position-relative > a::before {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 10px !important;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.15),
    transparent
  ) !important;
  z-index: 1 !important;
  border-radius: 20px 0 0 20px !important;
}

/* Add to Cart Button - Red Color with Better Hover */
.product-card-button.btn-secondary,
.add-to-cart-btn.btn-secondary {
  background-color: #dc3545 !important;
  border-color: #dc3545 !important;
  color: #ffffff !important;
  transition: all 0.3s ease !important;
}

.product-card-button.btn-secondary:hover,
.add-to-cart-btn.btn-secondary:hover {
  background-color: #1bb1b6 !important;
  border-color: #1bb1b6 !important;
  transform: scale(1.05) !important;
  box-shadow: 0 4px 8px rgba(27, 177, 182, 0.3) !important;
}

.product-card-button.btn-secondary:active,
.add-to-cart-btn.btn-secondary:active {
  background-color: #159a9f !important;
  border-color: #159a9f !important;
}

/* Disabled state */
.product-card-button.disabled,
.add-to-cart-btn.disabled {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}

/* Product Card itself - subtle curve */
.product-card {
  border-radius: 20px !important;
  transition: all 0.3s ease !important;
}

.product-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

/* Responsive Adjustments */
@media (max-width: 767px) {
  .product-card .position-relative > a {
    border-radius: 16px !important;
  }

  .product-card .ratio-item {
    border-radius: 12px !important;
  }

  .product-card {
    border-radius: 16px !important;
  }
}

/* ============================================
   Header Categories Icons Enhancement
   ============================================ */

/* Categories dropdown button with icon */
.btn.btn-secondary[data-bs-toggle="dropdown"] i.ci-grid {
  color: #1bb1b6 !important;
  margin-left: 0.5rem !important;
}

/* ============================================
   Footer Professional Enhancement
   ============================================ */

/* Footer heading icons */
.footer .accordion-header span::before,
.footer h6::before {
  font-family: "cartzilla-icons" !important;
  margin-left: 0.5rem !important;
  color: #1bb1b6 !important;
  font-size: 1.2rem !important;
}

/* Footer links with icons */
.footer .nav-link::before {
  content: "◆" !important;
  margin-left: 0.5rem !important;
  color: #1bb1b6 !important;
  font-size: 0.5rem !important;
  vertical-align: middle !important;
  opacity: 0.7 !important;
  transition: opacity 0.2s ease !important;
}

.footer .nav-link:hover::before {
  opacity: 1 !important;
}

/* Footer section styling */
.footer {
  background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%) !important;
}

/* Footer headings */
.footer h6,
.footer .accordion-header span,
.footer h4 {
  color: #1bb1b6 !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
}

/* Footer links enhancement */
.footer .nav-link {
  padding: 0.5rem 0 !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
}

.footer .nav-link:hover {
  color: #1bb1b6 !important;
  padding-right: 0.5rem !important;
}

/* Contact info icons */
.footer .ci-phone::before,
.footer .ci-mail::before,
.footer .ci-location::before {
  color: #1bb1b6 !important;
}

/* Social media buttons enhancement */
.footer .btn-secondary {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transition: all 0.3s ease !important;
}

.footer .btn-secondary:hover {
  background-color: #1bb1b6 !important;
  border-color: #1bb1b6 !important;
  transform: translateY(-3px) !important;
  box-shadow: 0 4px 8px rgba(27, 177, 182, 0.3) !important;
}

/* Footer category links */
.footer .nav.align-items-center a {
  position: relative !important;
  padding: 0.25rem 0.5rem !important;
  transition: all 0.2s ease !important;
}

.footer .nav.align-items-center a::after {
  content: "" !important;
  position: absolute !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 0 !important;
  height: 2px !important;
  background-color: #1bb1b6 !important;
  transition: width 0.3s ease !important;
}

.footer .nav.align-items-center a:hover::after {
  width: 100% !important;
}

/* Copyright section */
.footer .border-top {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Footer description text */
.footer .text-body {
  color: rgba(255, 255, 255, 0.8) !important;
  line-height: 1.6 !important;
}

/* ============================================
   Hero Slider Height Adjustment
   ============================================ */

/* Reduce slider height */
.bg-body-tertiary .swiper {
  max-height: 600px !important;
  overflow: hidden !important;
}

.bg-body-tertiary .swiper-slide {
  height: 300px !important;
}

.bg-body-tertiary .swiper-slide img {
  height: 300px !important;
  object-fit: cover !important;
  object-position: center !important;
}

/* Mobile - even smaller height */
@media (max-width: 768px) {
  .bg-body-tertiary .swiper {
    max-height: 250px !important;
  }

  .bg-body-tertiary .swiper-slide {
    height: 250px !important;
  }

  .bg-body-tertiary .swiper-slide img {
    height: 250px !important;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .bg-body-tertiary .swiper {
    max-height: 350px !important;
  }

  .bg-body-tertiary .swiper-slide {
    height: 350px !important;
  }

  .bg-body-tertiary .swiper-slide img {
    height: 350px !important;
  }
}

/* ============================================
   Product Details Page - Image Fix Only
   ============================================ */

/* Fix product details image ratio for book covers */
.product-details-img-ratio {
  aspect-ratio: 3/4 !important;
}

.product-details-img-ratio img {
  object-fit: contain !important;
  object-position: center !important;
  padding: 1rem !important;
}
