/* More/Less toggle button for product description */
.desc-toggle-btn {
  z-index: 10;
  position: relative;
  color: #0d6efd;
  cursor: pointer;
  font-weight: bold;
  margin-right: 6px;
  transition: color 0.2s;
}
.desc-toggle-btn:hover {
  color: #f7971e;
}
body.dark-mode {
  background: #181a1b !important;
  color: #e0e0e0 !important;
}
.dark-mode .product-card {
  background: #23272b !important;
  color: #e0e0e0 !important;
  border-color: #333 !important;
}
.dark-mode .product-badge {
  background: #444 !important;
  color: #ffd700 !important;
}
.dark-mode .buy-btn {
  background: #005fa3 !important;
  color: #fff !important;
}
.dark-mode .price {
  color: #ffd700 !important;
}
/* =========================
   PRODUCTS – GOD MODE
========================= */

.products-page {
  padding: 120px 80px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #e0f7ff 0%, #f8fcff 40%, #e6f3ff 100%);
}

/* Water Glow Effect */
.products-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 15% 20%,
      rgba(0, 150, 255, 0.25),
      transparent 40%
    ),
    radial-gradient(circle at 85% 10%, rgba(0, 180, 255, 0.2), transparent 45%),
    radial-gradient(
      circle at 50% 100%,
      rgba(0, 120, 255, 0.15),
      transparent 50%
    );
  animation: waterMove 8s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes waterMove {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.08);
  }
}

.products-page > * {
  position: relative;
  z-index: 1;
}

.page-title {
  text-align: center;
}
/* GRID */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 50px;
}

/* CARD */
.product-card {
  position: relative;
  background: linear-gradient(180deg, #ffffff, #f6f9fd);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(11, 60, 93, 0.15);
  transform-style: preserve-3d;
  transition: all 0.5s ease;
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top,
    rgba(50, 130, 184, 0.25),
    transparent 60%
  );
  opacity: 0;
  transition: 0.5s;
}

.product-card:hover {
  transform: translateY(-18px) rotateX(6deg);
  box-shadow: 0 40px 90px rgba(11, 60, 93, 0.35);
}

.product-card:hover::before {
  opacity: 1;
}

/* BADGE */

.product-badge {
  position: absolute;
  top: 18px;
  left: 18px;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 30px;
  font-weight: 800;
  z-index: 101;
  transition:
    transform 0.18s,
    box-shadow 0.18s;
  box-shadow: 0 2px 10px #0001;
}

/* Badge Colors by Status */
.product-badge.new {
  background: linear-gradient(90deg, #4facfe, #00f2fe);
  color: #fff;
}
.product-badge.offer {
  background: linear-gradient(90deg, #43e97b, #38f9d7);
  color: #0a2b1f;
}
.product-badge.discount {
  background: linear-gradient(90deg, #ff416c, #ff4b2b);
  color: #fff;
}
.product-badge.limited {
  background: linear-gradient(90deg, #f7971e, #ffd200);
  color: #222;
}

/* Optional: subtle shadow for badges */
.product-badge {
  box-shadow:
    0 2px 10px #0001,
    0 1.5px 0 #fff2 inset;
}

/* Badge hover effect */
.product-card:hover .product-badge {
  transform: scale(1.08);
  box-shadow: 0 6px 24px #0002;
}

/* IMAGE */
.product-image {
  height: 240px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
}

.product-image img {
  max-width: 75%;
  max-height: 75%;
  transition: transform 0.6s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.15) rotate(-2deg);
}

/* BODY */
.product-body {
  padding: 30px 26px 34px;
  text-align: center;
}

.product-body h3 {
  font-size: 22px;
  margin-bottom: 12px;
  color: #0b3c5d;
}

.product-body p {
  font-size: 15px;
  color: #566;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* FOOTER */
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.price {
  font-size: 22px;
  font-weight: 800;
  color: #3282b8;
}

/* BUTTON */

.buy-btn {
  padding: 10px 22px;
  border-radius: 30px;
  background: linear-gradient(90deg, #0b3c5d, #3282b8);
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s;
  position: relative;
  z-index: 5;
}

.buy-btn:hover {
  background: linear-gradient(90deg, #f4b41a, #ffd36a);
  color: #222;
  box-shadow: 0 10px 30px rgba(244, 180, 26, 0.45);
}

/* DARK MODE */
body.dark-mode {
  background: #181a1b;
  color: #e0e0e0;
}
.product-card,
.products-page {
  background: inherit;
  color: inherit;
}
.modern-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  box-shadow: 0 2px 16px #0001;
  padding: 1.2rem 3rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.modern-filter .filter-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.modern-filter .filter-input {
  display: flex;
  align-items: center;
  background: #f7f8fa;
  border-radius: 8px;
  box-shadow: 0 1px 6px #0001;
  padding: 0.3rem 2rem;
  min-width: 170px;
  position: relative;
}
.modern-filter .filter-icon {
  font-size: 1.2rem;
  margin-left: 0.5rem;
  color: #007bff;
}
.modern-filter input {
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
  width: 100%;
  padding: 0.5rem 0;
}
.modern-filter .autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0 0 8px 8px;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 2px 8px #0002;
}
.modern-filter .filter-actions {
  display: flex;
  gap: 1rem;
}
.modern-filter .filter-btn {
  padding: 0.7rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  background: #eee;
  color: #222;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  box-shadow: 0 1px 6px #0001;
}
.modern-filter .filter-btn.primary {
  background: #007bff;
  color: #fff;
}
.modern-filter .filter-btn:hover {
  background: #007bff;
  color: #fff;
}
@media (max-width: 900px) {
  .modern-filter {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
  }
  .modern-filter .filter-group {
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
  }
  .modern-filter .filter-input {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  .modern-filter .filter-actions {
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
  }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .products-page {
    padding: 80px 20px 40px;
  }

  .page-title {
    font-size: 28px;
    text-align: center;
    word-break: break-word;
  }
}

.fancy-toggle-btn {
  padding: 0.6rem 1.4rem;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(90deg, #232526 0%, #414345 100%);
  color: #ffe082;
  border: none;
  box-shadow:
    0 4px 24px 0 rgba(0, 0, 0, 0.18),
    0 1.5px 0 #ffe082 inset;
  letter-spacing: 1.5px;
  transition:
    background 0.3s,
    color 0.3s,
    transform 0.18s,
    box-shadow 0.3s;
  cursor: pointer;
  outline: none;
  position: relative;
  overflow: hidden;
}
.fancy-toggle-btn:hover,
.fancy-toggle-btn:focus {
  background: linear-gradient(90deg, #ffe082 0%, #ffb300 100%);
  color: #232526;
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 8px 32px 0 rgba(255, 224, 130, 0.18),
    0 1.5px 0 #232526 inset;
}
.fancy-toggle-btn:active {
  transform: scale(0.98);
}
.darkmode-btn {
  background: linear-gradient(90deg, #232526 0%, #414345 100%);
  color: #ffe082;
}
.lang-btn {
  background: linear-gradient(90deg, #00c6ff 0%, #0072ff 100%);
  color: #fff;
  box-shadow:
    0 4px 24px 0 rgba(0, 114, 255, 0.13),
    0 1.5px 0 #fff2 inset;
}
.lang-btn:hover,
.lang-btn:focus {
  background: linear-gradient(90deg, #ffe082 0%, #ffb300 100%);
  color: #232526;
}

@media (max-width: 600px) {
  html, body {
    overflow-x: hidden;
  }

  .products-page {
    padding: 65px 14px 40px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .page-title {
    font-size: 22px;
    text-align: center;
    word-break: break-word;
  }

  .products-grid {
    max-width: 100% !important;
    width: 100% !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    box-sizing: border-box;
  }

  .product-card {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* تأكد أن الفلتر لا يتجاوز عرض الشاشة */
  .modern-filter {
    width: 100%;
    box-sizing: border-box;
    padding: 0.9rem;
  }

  .modern-filter .filter-input {
    min-width: 0 !important;
    width: 100%;
    box-sizing: border-box;
  }

  .modern-filter .filter-btn {
    width: 100%;
    box-sizing: border-box;
  }
}
/* ============================
   PRODUCT MODAL – OVERLAY
============================ */
.pmodal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8, 25, 45, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: pmodalFadeIn 0.28s ease;
}
.pmodal-overlay.open {
  display: flex;
}
@keyframes pmodalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* THE CARD */
.pmodal-card {
  position: relative;
  background: linear-gradient(160deg, #ffffff 0%, #f0f8ff 60%, #e6f3ff 100%);
  border-radius: 28px;
  box-shadow:
    0 32px 80px rgba(11, 60, 93, 0.28),
    0 0 0 1.5px rgba(50, 130, 184, 0.18);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: pmodalSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  scrollbar-width: thin;
}
@keyframes pmodalSlideUp {
  from {
    opacity: 0;
    transform: translateY(48px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.dark-mode .pmodal-card {
  background: linear-gradient(160deg, #1e2a36 0%, #1a2535 60%, #16202e 100%);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1.5px rgba(50, 130, 184, 0.22);
}

/* CLOSE BUTTON */
.pmodal-close {
  position: absolute;
  top: 14px;
  left: 14px; /* RTL friendly – left side */
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(11, 60, 93, 0.1);
  color: #0b3c5d;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    transform 0.18s;
  line-height: 1;
}
.pmodal-close:hover {
  background: #ff4b2b;
  color: #fff;
  transform: rotate(90deg) scale(1.1);
}
body.dark-mode .pmodal-close {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

/* CAROUSEL INSIDE MODAL */
.pmodal-carousel {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  border-radius: 28px 28px 0 0;
  background: #dbeeff;
  flex-shrink: 0;
}
.pmodal-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.pmodal-track img {
  min-width: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex-shrink: 0;
  padding: 18px;
  box-sizing: border-box;
  transition: transform 0.5s ease;
}
.pmodal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.85);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  z-index: 3;
  color: #0b3c5d;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px #0002;
  transition:
    background 0.2s,
    transform 0.18s;
}
.pmodal-arrow:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.12);
}
.pmodal-prev {
  left: 10px;
}
.pmodal-next {
  right: 10px;
}
.pmodal-arrow.hidden {
  display: none;
}

/* DOTS */
.pmodal-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.pmodal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s;
}
.pmodal-dot.active {
  background: #fff;
  transform: scale(1.35);
}

/* BADGE in modal – overlays the carousel image */
.pmodal-badge-wrap {
  display: none;
}
@keyframes badgePopIn {
  from { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  to   { transform: scale(1)   rotate(0deg);   opacity: 1; }
}
.pmodal-carousel .product-badge {
  position: absolute;
  top: 16px;
  right: 30px;
  left: auto;
  z-index: 10;
  font-size: 13px;
  padding: 7px 18px;
  border-radius: 30px;
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.30),
    0 1.5px 0 rgba(255, 255, 255, 0.3) inset;
  animation: badgePopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.2s;
}
@media (max-width: 480px) {
  .pmodal-carousel .product-badge {
    font-size: 11px;
    padding: 5px 13px;
    top: 12px;
    right: 12px;
  }
}

/* INFO SECTION */
.pmodal-info {
  padding: 26px 28px 28px;
  direction: rtl;
  text-align: right;
}
html[lang="en"] .pmodal-info {
  direction: ltr;
  text-align: left;
}
.pmodal-name {
  font-size: 24px;
  font-weight: 900;
  color: #0b3c5d;
  margin: 0 0 6px;
  font-family: "Cairo", "Montserrat", sans-serif;
}
body.dark-mode .pmodal-name {
  color: #e8f4ff;
}

.pmodal-type {
  font-size: 13px;
  color: #3282b8;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.pmodal-desc {
  font-size: 15px;
  color: #445566;
  line-height: 1.75;
  margin: 0 0 22px;
}
body.dark-mode .pmodal-desc {
  color: #b0c4d8;
}

.pmodal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.pmodal-price {
  font-size: 24px;
  font-weight: 900;
  color: #3282b8;
  display: none !important;
}
body.dark-mode .pmodal-price {
  display: none !important;
}
body.dark-mode .pmodal-price {
  color: #ffd700;
}

/* prevent card 3D hover on modal trigger zones */
.product-card {
  cursor: pointer;
}

/* scrollbar style */
.pmodal-card::-webkit-scrollbar {
  width: 5px;
}
.pmodal-card::-webkit-scrollbar-track {
  background: transparent;
}
.pmodal-card::-webkit-scrollbar-thumb {
  background: rgba(50, 130, 184, 0.3);
  border-radius: 4px;
}

/* ============================
   PRODUCT MODAL – TABLET
============================ */
@media (max-width: 768px) {
  .pmodal-card {
    max-width: 96vw;
    border-radius: 22px;
  }
  .pmodal-carousel {
    height: 260px;
  }
}

/* ============================
   PRODUCT MODAL – MOBILE FULLSCREEN
============================ */
@media (max-width: 600px) {
  .pmodal-overlay {
    padding: 0;
    align-items: flex-start;
  }
  .pmodal-card {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    border-radius: 0;
    animation: pmodalSlideUpFull 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .pmodal-carousel {
    height: 44vh;
    border-radius: 0;
    flex-shrink: 0;
  }
  .pmodal-info {
    padding: 18px 18px 20px;
    flex: 1;
    overflow-y: auto;
  }
  .pmodal-name {
    font-size: 20px;
  }
  .pmodal-desc {
    font-size: 14px;
    margin-bottom: 16px;
  }
  .pmodal-close {
    top: 12px;
    left: 12px;
    width: 42px;
    height: 42px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.92);
    color: #0b3c5d;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  }
  .pmodal-footer {
    padding-bottom: env(safe-area-inset-bottom, 6px);
  }
  .pmodal-buy {
    flex: 1;
    text-align: center;
    padding: 13px 20px;
    font-size: 16px;
  }
}

@keyframes pmodalSlideUpFull {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
