/**
 * Shop App - Mobile-First E-commerce Theme
 * Inspired by Noon App Design
 * Version: 1.0.0
 */

/* ================================================
   MOBILE PRODUCT GRID - منتجين جنب بعض
   ================================================ */

@media (max-width: 767px) {
  /* فرض عرض منتجين في الصف - بقوة! */
  .product-layout.product-grid,
  .product-layout.product-list {
    width: 50% !important;
    max-width: 50% !important;
    flex: 0 0 50% !important;
    float: left !important;
    padding: 5px !important;
    margin: 0 !important;
  }

  .row .product-layout {
    width: 50% !important;
  }

  #content .product-layout {
    width: 50% !important;
  }

  .product-layout.col-xs-12 {
    width: 50% !important;
  }

  /* تنظيف الـ clearfix */
  .product-layout:nth-child(2n + 1) {
    clear: both !important;
  }

  /* تحسين بطاقة المنتج */
  .product-thumb {
    margin-bottom: 8px !important;
    border-radius: 8px;
    overflow: hidden;
  }

  .product-thumb .image {
    padding: 0 !important;
    margin: 0 !important;
  }

  .product-thumb .image a {
    margin: 0 !important;
  }

  .product-thumb .caption {
    padding: 8px !important;
    min-height: auto !important;
  }

  .product-thumb h4 {
    font-size: 12px !important;
    line-height: 1.3 !important;
    height: auto !important;
    min-height: 30px !important;
    margin-bottom: 6px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }

  .product-thumb .price {
    font-size: 13px !important;
    margin-bottom: 6px !important;
  }

  .product-thumb .info {
    margin: 8px 0 !important;
    font-size: 11px !important;
  }

  .product-thumb .button-group {
    padding: 8px !important;
    display: flex !important;
    gap: 4px !important;
  }

  .product-thumb .button-group button {
    flex: 1 !important;
    width: auto !important;
    font-size: 10px !important;
    padding: 6px 4px !important;
    line-height: 1.4 !important;
    height: auto !important;
  }

  .product-thumb .button-group button i {
    font-size: 14px !important;
  }
}

/* ================================================
   BOTTOM NAVIGATION BAR - شريط التنقل السفلي
   ================================================ */

body {
  padding-bottom: 0;
}

@media (max-width: 767px) {
  body {
    padding-bottom: 70px !important; /* مساحة للشريط */
  }
}

.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  display: none; /* مخفي افتراضياً */
  justify-content: space-around;
  align-items: stretch;
  padding: 0;
  border-top: 1px solid #e0e0e0;
  height: 60px;
}

@media (max-width: 767px) {
  .app-bottom-nav {
    display: flex !important; /* ظاهر على الموبايل فقط */
  }
}

.app-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #757575;
  font-size: 10px;
  padding: 6px 4px;
  transition: all 0.2s ease;
  position: relative;
  border: none;
  background: transparent;
}

.app-bottom-nav a.active {
  color: #ab0f10;
  background: rgba(171, 15, 16, 0.05);
}

.app-bottom-nav a:hover {
  color: #ab0f10;
  background: rgba(171, 15, 16, 0.05);
}

.app-bottom-nav a i {
  font-size: 20px;
  margin-bottom: 2px;
  display: block;
}

.app-bottom-nav a span {
  display: block;
  font-weight: 500;
}

.app-bottom-nav a .nav-badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(10px);
  background: #ab0f10;
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 1.2;
}

/* ================================================
   FLOATING SORT/FILTER BAR
   ================================================ */

.app-floating-bar {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  z-index: 9998;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  border-top: 1px solid #e0e0e0;
  height: 48px;
}

@media (max-width: 767px) {
  .app-floating-bar {
    display: flex !important;
  }
}

.app-floating-bar button {
  flex: 1;
  max-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #e0e0e0;
  color: #212121;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.app-floating-bar button:hover {
  border-color: #ab0f10;
  color: #ab0f10;
  background: rgba(171, 15, 16, 0.05);
}

.app-floating-bar button i {
  font-size: 14px;
}

.app-floating-bar .filter-active-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #ab0f10;
  border-radius: 50%;
  display: none;
}

.app-floating-bar .filter-active-dot.show {
  display: block;
}

/* ================================================
   FILTER DRAWER - درج الفلترة
   ================================================ */

.app-filter-drawer {
  position: fixed;
  top: 0;
  left: -100%;
  width: 85%;
  max-width: 320px;
  height: 100%;
  background: #ffffff;
  z-index: 10000;
  overflow-y: auto;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.app-filter-drawer.active {
  left: 0;
}

html[dir="rtl"] .app-filter-drawer {
  left: auto;
  right: -100%;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
}

html[dir="rtl"] .app-filter-drawer.active {
  right: 0;
}

.app-drawer-header {
  position: sticky;
  top: 0;
  background: #ffffff;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.app-drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: #212121;
  margin: 0;
}

.app-drawer-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #757575;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.app-drawer-close:hover {
  background: #f5f5f5;
  color: #ab0f10;
}

.app-drawer-body {
  padding: 16px;
  padding-bottom: 80px; /* مساحة للفوتر */
}

.app-drawer-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 12px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.app-drawer-footer .btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-drawer-footer .btn-clear {
  background: #f5f5f5;
  color: #757575;
}

.app-drawer-footer .btn-clear:hover {
  background: #e0e0e0;
}

.app-drawer-footer .btn-apply {
  background: #ab0f10;
  color: white;
}

.app-drawer-footer .btn-apply:hover {
  background: #cb1c22;
  transform: scale(1.02);
}

/* Drawer Overlay */
.app-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Prevent body scroll */
body.drawer-open {
  overflow: hidden !important;
}

/* ================================================
   HIDE SIDEBAR ON MOBILE - إخفاء السايدبار
   ================================================ */

@media (max-width: 767px) {
  #column-left {
    display: none !important; /* إخفاء كامل على الموبايل */
  }

  #content.col-sm-9 {
    width: 100% !important; /* استغلال كامل العرض */
  }
}

/* ================================================
   MOBILE OPTIMIZATIONS
   ================================================ */

@media (max-width: 767px) {
  /* Container full width */
  .container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* Product category list compact */
  .product-category-list {
    margin-top: 10px !important;
  }

  .product-category-list .col-md-5,
  .product-category-list .col-md-2,
  .product-category-list .col-md-3 {
    display: none !important; /* إخفاء على الموبايل */
  }

  .product-category-list .col-md-2.hidden-xs {
    display: none !important;
  }

  /* Breadcrumb compact */
  .breadcrumb {
    margin-bottom: 10px;
    padding: 8px 10px;
    font-size: 11px;
  }

  .breadcrumb > li {
    padding: 0 6px;
  }

  .breadcrumb > li:after {
    width: 20px;
    height: 20px;
  }

  /* Header compact */
  #header {
    padding: 8px 0;
  }

  #logo {
    margin: 0 0 6px 0;
  }

  #logo img {
    max-height: 36px !important;
  }

  /* Search bar */
  #search .input-lg {
    height: 36px;
    font-size: 13px;
    padding: 0 12px;
    border-radius: 18px;
  }

  #search .btn-lg {
    padding: 8px 20px;
    font-size: 13px;
  }

  /* Cart button */
  #cart {
    margin-bottom: 6px;
  }

  #cart > .btn {
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 18px;
  }
}

/* ================================================
   PRODUCT CARD ENHANCEMENTS
   ================================================ */

.product-thumb {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: #ffffff;
}

.product-thumb:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.product-thumb .image {
  position: relative;
  background: #f9f9f9;
}

.product-thumb .image img {
  transition: transform 0.3s ease;
}

.product-thumb:hover .image img {
  transform: scale(1.05);
}

/* ================================================
   FILTER DRAWER CONTENT STYLING
   ================================================ */

.app-drawer-body .panel {
  margin-bottom: 0;
  border: none;
  box-shadow: none;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 0;
}

.app-drawer-body .panel:last-child {
  border-bottom: none;
}

.app-drawer-body .panel-heading {
  background: transparent;
  border: none;
  padding: 14px 0;
  font-weight: 600;
  font-size: 15px;
  color: #212121;
}

.app-drawer-body .list-group {
  border: none;
  margin-bottom: 0;
}

.app-drawer-body .list-group-item {
  border: none;
  background: transparent;
  padding: 10px 0;
}

.app-drawer-body .checkbox {
  margin: 8px 0;
}

.app-drawer-body .checkbox label {
  font-weight: 400;
  font-size: 14px;
  color: #212121;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px 0;
}

.app-drawer-body .checkbox input[type="checkbox"] {
  margin-right: 12px;
  margin-left: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

html[dir="rtl"] .app-drawer-body .checkbox input[type="checkbox"] {
  margin-right: 0;
  margin-left: 12px;
}

/* ================================================
   SORT OPTIONS IN DRAWER
   ================================================ */

.sort-option {
  padding: 14px 0;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.sort-option:hover {
  background: #f9f9f9;
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 6px;
}

.sort-option:last-child {
  border-bottom: none;
}

.sort-option input[type="radio"] {
  margin-right: 12px;
  margin-left: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

html[dir="rtl"] .sort-option input[type="radio"] {
  margin-right: 0;
  margin-left: 12px;
}

.sort-option label {
  flex: 1;
  margin: 0;
  font-size: 14px;
  color: #212121;
  cursor: pointer;
}

/* ================================================
   SMOOTH ANIMATIONS
   ================================================ */

html {
  scroll-behavior: smooth;
}

* {
  -webkit-tap-highlight-color: rgba(171, 15, 16, 0.1);
}

/* ================================================
   RESPONSIVE ADJUSTMENTS
   ================================================ */

@media (max-width: 767px) {
  /* Full width content */
  .col-sm-9 {
    width: 100% !important;
  }

  .col-sm-12 {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* Hide unnecessary elements */
  .btn-view {
    display: none !important;
  }

  .input-group-addon {
    display: none !important;
  }

  /* Compact pagination */
  .pagination {
    font-size: 12px;
  }

  .pagination > li > a {
    padding: 6px 10px;
  }
}

/* ================================================
   MOBILE CATEGORIES & FILTER DRAWER - احترافي مثل Shopify
   ================================================ */

.mobile-categories-filter-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 380px;
  height: 100%;
  background: #ffffff;
  z-index: 10001;
  overflow-y: auto;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

html[dir="rtl"] .mobile-categories-filter-drawer {
  right: auto;
  left: -100%;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
}

html[dir="rtl"] .mobile-categories-filter-drawer.active {
  left: 0;
}

.mobile-categories-filter-drawer.active {
  right: 0;
}

.categories-drawer-header {
  position: sticky;
  top: 0;
  background: #ffffff;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.categories-drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: #212121;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.categories-drawer-title i {
  color: #ab0f10;
}

.categories-drawer-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #757575;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.categories-drawer-close:hover {
  background: #f5f5f5;
  color: #ab0f10;
}

/* Tabs */
.categories-drawer-tabs {
  display: flex;
  background: #f8f8f8;
  border-bottom: 1px solid #e0e0e0;
  padding: 0;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #757575;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  position: relative;
  border-bottom: 3px solid transparent;
}

.tab-btn.active {
  color: #ab0f10;
  background: #ffffff;
  border-bottom-color: #ab0f10;
}

.tab-btn i {
  font-size: 16px;
}

.tab-btn .filter-count-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ab0f10;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* Drawer Body */
.categories-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px;
}

.tab-content {
  display: none;
  padding: 0;
}

.tab-content.active {
  display: block;
}

/* Categories List */
.categories-list {
  padding: 8px 0;
}

.category-item {
  border-bottom: 1px solid #f0f0f0;
}

.category-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  color: #212121;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.category-link:hover {
  background: #f8f8f8;
  color: #ab0f10;
}

.category-link.has-children i {
  color: #757575;
  font-size: 12px;
}

.category-children {
  background: #f8f8f8;
  padding: 8px 0;
  display: none;
}

.category-item.active .category-children {
  display: block;
}

.child-category-link {
  display: block;
  padding: 12px 20px 12px 40px;
  color: #616161;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.child-category-link:hover {
  background: #eeeeee;
  color: #ab0f10;
}

/* Filter Content */
.mobile-filter-content {
  padding: 16px;
}

.mobile-filter-content .panel {
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.mobile-filter-content .panel-heading {
  background: #f8f8f8;
  padding: 14px 16px;
  font-weight: 600;
  color: #212121;
  border-bottom: 1px solid #e0e0e0;
}

.mobile-filter-content .list-group-item {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid #f0f0f0;
}

.mobile-filter-content .checkbox {
  margin: 0;
}

.mobile-filter-content .checkbox label {
  font-weight: normal;
  color: #424242;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-filter-content .checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* Footer */
.categories-drawer-footer {
  position: sticky;
  bottom: 0;
  background: #ffffff;
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 12px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.btn-clear-filter,
.btn-apply-filter {
  flex: 1;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear-filter {
  background: #f5f5f5;
  color: #757575;
}

.btn-clear-filter:hover {
  background: #e0e0e0;
}

.btn-apply-filter {
  background: #ab0f10;
  color: white;
}

.btn-apply-filter:hover {
  background: #cb1c22;
  transform: scale(1.02);
}

/* Overlay */
.categories-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.categories-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

body.categories-drawer-open {
  overflow: hidden !important;
}

/* Bottom Nav Button for Categories */
.nav-categories-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #757575;
  font-size: 10px;
  padding: 6px 4px;
  transition: all 0.2s ease;
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-categories-btn.active {
  color: #ab0f10;
  background: rgba(171, 15, 16, 0.05);
}

.nav-categories-btn:hover {
  color: #ab0f10;
  background: rgba(171, 15, 16, 0.05);
}

.nav-categories-btn i {
  font-size: 20px;
  margin-bottom: 2px;
  display: block;
}

.nav-categories-btn span {
  display: block;
  font-weight: 500;
}

/* Hide on desktop */
@media (min-width: 768px) {
  .mobile-categories-filter-drawer,
  .categories-drawer-overlay {
    display: none !important;
  }
}

