/* ============================================================
   ShopPHP - Modernized storefront stylesheet
   ============================================================ */

:root {
  --primary-color:   #232F3E; /* Amazon Navy Header */
  --primary-hover:   #131921; /* Darker Navy */
  --secondary-color: #FFD814; /* Amazon Yellow */
  --secondary-hover: #F7CA00; /* Amazon Yellow Hover */
  --accent-color:    #FFA41C; /* Amazon Orange Action */
  --accent-hover:    #FA8900;
  --link-color:      #007185; /* Amazon Link Blue */
  --link-hover:      #C40000;
  --dark-bg:         #131921; /* Topbar */
  --dark-mid:        #232F3E; /* Category nav / Footer */
  --body-bg:         #EAEDED; /* Amazon Light Gray */
  --card-bg:         #FFFFFF;
  --border-color:    #D5D9D9; /* Amazon Border */
  --text-main:       #0F1111; /* Amazon Text */
  --text-muted:      #565959; /* Amazon Muted Text */
  --shadow-sm:       0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:       0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg:       0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-premium:  0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
}

/* ---- Global Styles ---- */
body {
  background-color: var(--body-bg);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--dark-bg);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--primary-hover);
}

/* ---- Layout ---- */
.main-content {
  min-height: calc(100vh - 400px);
}

/* ---- Topbar & Navbar ---- */
.topbar {
  background-color: var(--dark-bg) !important;
  border-bottom: 1px solid var(--dark-mid);
}

.bg-amazon-dark {
  background-color: var(--dark-mid) !important;
}

.navbar .nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  color: rgba(255, 255, 255, 0.8) !important;
  transition: all 0.2s ease;
}
.navbar .nav-link:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
.navbar .nav-link.text-warning {
  color: var(--secondary-color) !important;
}

/* ---- Buttons ---- */
.btn {
  border-radius: 10px;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
}
.btn-warning {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
  color: #ffffff !important;
}
.btn-warning:hover {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.btn-outline-warning {
  color: var(--secondary-color) !important;
  border-color: var(--secondary-color);
}
.btn-outline-warning:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: #ffffff !important;
}

/* ---- Search Bar ---- */
.search-form {
  max-width: 650px;
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: box-shadow 0.2s ease;
}
.search-form:focus-within {
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.4);
}
.search-cat {
  background-color: #f1f5f9;
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  padding: 0.5rem 1rem;
}
.search-input {
  border: none;
  padding: 0.5rem 1rem;
}
.search-input:focus {
  outline: none;
  box-shadow: none;
}

/* ---- Hero Carousel ---- */
.carousel-inner {
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-banner {
  min-height: 380px;
  display: flex;
  align-items: center;
  position: relative;
}
.hero-banner::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(45deg, rgba(35, 47, 62, 0.05) 0%, rgba(255, 153, 0, 0.02) 100%);
  z-index: 1;
}
.hero-banner .container {
  position: relative;
  z-index: 2;
}

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.75rem;
}
.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0;
  position: relative;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -14px;
  width: 50px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

/* ---- Product Card ---- */
.product-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-premium);
  border-color: rgba(79, 70, 229, 0.15);
}
.product-img-wrap {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  padding: 1.5rem;
  overflow: hidden;
  position: relative;
}
.product-img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
}
.product-card:hover .product-img {
  transform: scale(1.06);
}
.product-img-placeholder {
  height: 220px;
  width: 100%;
  background-color: #f8fafc;
}
.wishlist-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.2s ease;
}
.product-card:hover .wishlist-btn {
  opacity: 1;
  transform: scale(1);
}
.wishlist-btn:hover {
  background: #ffffff;
  color: #ef4444;
  box-shadow: var(--shadow-md);
}

.product-name {
  font-weight: 600;
  color: var(--dark-bg);
  line-height: 1.4;
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Badges ---- */
.badge {
  padding: 0.35em 0.65em;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
}
.badge.bg-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}
.badge.bg-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
}

/* ---- Category Card ---- */
.category-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.category-card:hover {
  background-color: #ffffff;
  border-color: var(--primary-color) !important;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.cat-icon i {
  color: var(--primary-color) !important;
  font-size: 2.25rem !important;
  transition: transform 0.3s ease;
}
.category-card:hover .cat-icon i {
  transform: scale(1.1) rotate(5deg);
}

/* ---- Flash Sale Banner ---- */
.flash-sale-section {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
  border: none !important;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.flash-sale-section::before {
  content: "";
  position: absolute;
  top: -50%; right: -20%;
  width: 300px; height: 300px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  z-index: 1;
}

/* ---- Brand Badge ---- */
.brand-badge {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s ease;
}
.brand-badge:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

/* ---- Features Grid ---- */
.feature-box {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.feature-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(79, 70, 229, 0.15);
}
.feature-icon {
  width: 55px;
  height: 55px;
  margin: 0 auto 1rem;
  background-color: rgba(79, 70, 229, 0.08);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.5rem;
}

/* ---- Footer ---- */
.footer {
  background-color: var(--dark-bg) !important;
  border-top: 1px solid var(--dark-mid);
}
.footer p, .footer .text-muted, .footer small {
  color: #94a3b8 !important;
}
.footer h5, .footer h6 {
  color: #ffffff !important;
  font-weight: 700;
  margin-bottom: 1.25rem;
}
.footer a {
  color: #94a3b8 !important;
  transition: color 0.15s ease;
}
.footer a:hover {
  color: #ffffff !important;
}
.footer hr {
  border-color: var(--dark-mid);
}

/* ---- Responsive Overrides ---- */
@media (max-width: 991px) {
  .hero-banner {
    min-height: 280px;
  }
}
@media (max-width: 768px) {
  .topbar {
    padding-bottom: 0.5rem;
  }
  .search-cat {
    display: none;
  }
  .product-img-wrap {
    height: 160px;
    padding: 0.75rem;
  }
  .product-img-placeholder {
    height: 160px;
  }
}

/* ── Product Detail — Responsive ── */
@media (max-width: 991.98px) {
  /* Stack the 3-column layout into 1 on tablets/phones */
  .container .row.g-4 > .col-lg-5,
  .container .row.g-4 > .col-lg-4,
  .container .row.g-4 > .col-lg-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  /* Remove sticky behavior on the image when stacked */
  .product-gallery-wrap {
    position: static !important;
  }
  .main-image-wrap {
    max-height: 350px;
  }
  .main-image-wrap img {
    max-height: 300px !important;
  }
  /* Delivery box side-by-side items */
  .delivery-box {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }
  .delivery-box > div {
    flex: 1 1 45%;
    min-width: 140px;
  }
  .delivery-box > hr {
    flex-basis: 100%;
    margin: 4px 0;
  }
}

@media (max-width: 575.98px) {
  /* Product detail — compact on phones */
  .main-image-wrap {
    max-height: 260px;
    padding: 0.75rem !important;
  }
  .main-image-wrap img {
    max-height: 220px !important;
  }
  /* Thumbnails smaller */
  .thumb-img {
    width: 50px !important;
    height: 50px !important;
  }
  /* Price smaller */
  .price-section .fs-3 {
    font-size: 1.4rem !important;
  }
  /* Tabs full width */
  #productTabs .nav-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
  .tab-content {
    padding: 1rem !important;
  }
  /* Review stars inline */
  .star-rating {
    flex-wrap: wrap;
  }
  /* Related products — 2 cols */
  .container .row.g-3 > .col-lg-2 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* ── Products Listing — Responsive ── */
@media (max-width: 991.98px) {
  /* Filters sidebar: collapse on mobile */
  .filter-panel {
    position: relative;
  }
  .col-lg-2 .filter-panel {
    max-height: none;
  }
}
@media (max-width: 767.98px) {
  /* Sort bar stacks */
  .d-flex.justify-content-between.align-items-center.mb-3 {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }
  /* Product cards — 2 columns always on mobile */
  .col-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .product-card .card-body {
    padding: 0.5rem !important;
  }
  .product-name {
    font-size: 0.78rem;
    min-height: 32px;
  }
  .price-block .fs-5 {
    font-size: 0.95rem !important;
  }
  .product-card .btn-sm {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
  }
}

/* ── Compare Page — Responsive ── */
@media (max-width: 575.98px) {
  .table-responsive table th,
  .table-responsive table td {
    min-width: 120px;
    font-size: 0.8rem;
  }
  .table-responsive table img {
    max-height: 80px !important;
  }
}

/* ── Cart Page — Responsive ── */
@media (max-width: 575.98px) {
  .qty-selector input {
    width: 36px !important;
  }
}

/* ── General Mobile Polish ── */
@media (max-width: 575.98px) {
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }
  .breadcrumb {
    font-size: 0.75rem;
  }
}
