/* ===== MOBILE RESPONSIVE STYLES ===== */

/* FEATURE 4: Skeleton Loader / Shimmer Animation */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #1c2430 0%, #2a3344 50%, #1c2430 100%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 8px;
}

.skeleton-card {
  width: 100%;
  height: 280px;
  border-radius: 12px;
}

.skeleton-text {
  height: 16px;
  margin: 8px 0;
  border-radius: 6px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-banner {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.skeleton-row {
  width: 100%;
  height: 60px;
  margin: 8px 0;
  border-radius: 8px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

/* FEATURE 5: Reviews Drawer Styles */
.reviews-button {
  position: fixed;
  right: 20px;
  bottom: 100px;
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  transition: all 0.3s ease;
}

.reviews-button:hover {
  background: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.reviews-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  background: #141a23;
  border-left: 1px solid #2a3344;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.reviews-drawer.open {
  transform: translateX(0);
}

.reviews-drawer-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.reviews-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #2a3344;
  flex-shrink: 0;
}

.reviews-drawer-header h2 {
  margin: 0;
  font-size: 20px;
  color: #e9ecef;
}

.reviews-drawer-close {
  background: none;
  border: none;
  color: #8a92a6;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.reviews-drawer-close:hover {
  color: #e9ecef;
}

.reviews-drawer-stats {
  padding: 16px 20px;
  border-bottom: 1px solid #2a3344;
  flex-shrink: 0;
}

.reviews-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reviews-rating {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reviews-rating-value {
  font-size: 24px;
  font-weight: 700;
  color: #4f46e5;
}

.reviews-rating-count {
  font-size: 14px;
  color: #8a92a6;
}

.reviews-rating-distribution {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rating-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.rating-bar > span:first-child {
  width: 30px;
  color: #8a92a6;
}

.bar-bg {
  flex: 1;
  height: 6px;
  background: #1c2430;
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.rating-bar > span:last-child {
  width: 25px;
  text-align: right;
  color: #5a6278;
}

.reviews-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.review-card {
  padding: 16px 20px;
  border-bottom: 1px solid #2a3344;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.review-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.review-meta {
  flex: 1;
  min-width: 0;
}

.review-name {
  font-weight: 600;
  color: #e9ecef;
  font-size: 14px;
  margin-bottom: 4px;
}

.review-rating {
  font-size: 12px;
  color: #f59e0b;
}

.review-verified {
  background: #10b981;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.review-date {
  font-size: 12px;
  color: #5a6278;
}

.review-text {
  font-size: 14px;
  color: #8a92a6;
  line-height: 1.5;
}

.review-show-more {
  background: none;
  border: none;
  color: #4f46e5;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  margin-top: 4px;
  font-weight: 600;
}

.review-show-more:hover {
  text-decoration: underline;
}

.review-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.review-images img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
}

.reviews-empty,
.reviews-error {
  padding: 40px 20px;
  text-align: center;
  color: #8a92a6;
  font-size: 14px;
}

.reviews-error {
  color: #ef4444;
}

/* Mobile: full-width drawer */
@media (max-width: 600px) {
  .reviews-drawer {
    max-width: 100%;
  }
}

/* ===== MOBILE RESPONSIVE STYLES ===== */

/* Ensure no horizontal overflow on mobile */
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

* {
  box-sizing: border-box;
}

/* Tablet & Mobile */
@media (max-width: 900px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Navigation */
  .mobile-nav-toggle {
    display: flex;
  }

  nav.mainnav {
    display: none;
  }

  /* Product Grid */
  .prod-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .prod-card {
    padding: 8px;
    border-radius: 6px;
  }

  .prod-card .name {
    font-size: 13px;
    line-height: 1.3;
    margin: 6px 0;
    height: auto;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .prod-card img {
    max-height: 150px;
  }

  /* Product Buttons */
  .btn-stack {
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-buy-now, .btn-add-cart {
    padding: 8px 14px;
    font-size: 12px;
    flex: 1;
    min-width: 70px;
  }

  .btn-buy-now {
    padding: 10px 16px;
  }

  /* Forms & Inputs */
  input, select, textarea {
    font-size: 16px !important; /* Prevent zoom on iOS */
  }

  /* Checkout Button */
  .btn-checkout {
    padding: 12px 20px;
    font-size: 14px;
    width: 100%;
  }

  /* Modal Responsive */
  .modal-box {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 8px;
  }

  /* Category Grid */
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .cat-card {
    padding: 16px;
  }

  .cat-card.single {
    grid-column: 1 / -1;
  }

  /* Banner Responsive */
  .banner-slideshow {
    aspect-ratio: 16/6;
    min-height: 180px;
  }

  .banner-slideshow .banner-slide .banner-text {
    font-size: 13px;
    padding: 6px 12px;
    bottom: 16px;
    left: 16px;
  }

  .banner-slideshow .banner-arrow {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  /* Menu Drawer */
  .mobile-menu-drawer {
    max-width: 90vw;
  }

  /* Cart/Wishlist Drawer */
  .drawer {
    max-width: 90vw;
  }

  /* Grid Layouts */
  .grid {
    grid-template-columns: 1fr;
  }

  /* Sidebar Off on Mobile */
  .sidebar {
    display: none;
  }

  /* Full Width Content */
  .content {
    width: 100%;
    max-width: 100%;
  }
}

/* Small Mobile Phones */
@media (max-width: 600px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Padding & Spacing */
  body {
    padding: 0;
  }

  .container, main, .wrapper {
    padding: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Header */
  header {
    padding: 8px 12px;
  }

  .header-content {
    padding: 0 12px;
  }

  /* Navigation */
  nav.mainnav {
    display: none;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  /* Product Grid - Single Column Recommended */
  .prod-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .prod-card {
    padding: 6px;
    border-radius: 4px;
  }

  .prod-card img {
    max-height: 120px;
    border-radius: 4px;
  }

  .prod-empty {
    min-height: 140px;
    padding: 16px 10px;
    border-radius: 8px;
    grid-column: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .prod-empty .icon {
    font-size: 18px;
    margin-bottom: 6px;
  }

  .prod-empty span {
    font-size: 11px;
    line-height: 1.3;
  }

  .prod-empty .sku {
    font-size: 9px;
  }

  .prod-card .name {
    font-size: 12px;
    line-height: 1.2;
    margin: 4px 0;
    height: 24px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .prod-card .category {
    font-size: 10px;
    opacity: 0.7;
  }

  .prod-card .price {
    font-size: 11px;
    margin: 4px 0;
  }

  /* Buttons */
  .btn-stack {
    flex-direction: column;
    gap: 4px;
  }

  .btn-buy-now, .btn-add-cart {
    width: 100%;
    padding: 8px 12px;
    font-size: 11px;
    border-radius: 4px;
  }

  .btn-buy-now {
    padding: 9px 12px;
  }

  /* Forms */
  input, select, textarea {
    width: 100%;
    padding: 10px 8px;
    font-size: 16px !important;
    border-radius: 4px;
  }

  /* Checkout Button */
  .btn-checkout {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
  }

  /* Category Grid */
  .cat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .cat-card {
    padding: 16px;
    text-align: center;
  }

  /* Banner */
  .banner-slideshow {
    aspect-ratio: 16/8;
    min-height: 140px;
  }

  .banner-slideshow .banner-slide .banner-text {
    font-size: 11px;
    padding: 4px 8px;
    bottom: 8px;
    left: 8px;
  }

  .banner-slideshow .banner-arrow {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .banner-slideshow .banner-nav button {
    width: 8px;
    height: 8px;
  }

  /* Modal Responsive */
  .modal-overlay {
    padding: 12px;
  }

  .modal-box {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 8px;
  }

  /* Text Sizing */
  h1 {
    font-size: 20px;
  }

  h2 {
    font-size: 16px;
  }

  h3 {
    font-size: 14px;
  }

  /* Prevent Double Tap Zoom */
  button, a, .clickable {
    touch-action: manipulation;
  }

  /* Remove 300ms Click Delay */
  * {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }

  /* Ensure Content Width */
  .main-content, .page-content, .container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Drawer Responsive */
  .mobile-menu-drawer, .drawer {
    max-width: 80vw;
    max-height: 100vh;
  }

  /* Table Responsive */
  table {
    font-size: 12px;
  }

  table th, table td {
    padding: 8px 4px;
  }

  /* Prevent Horizontal Scroll */
  img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}

/* Extra Small Devices (< 400px) */
@media (max-width: 400px) {
  .prod-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .prod-card {
    padding: 4px;
  }

  .prod-card img {
    max-height: 100px;
  }

  .prod-card .name {
    font-size: 11px;
    height: 22px;
  }

  .btn-buy-now, .btn-add-cart {
    padding: 6px 10px;
    font-size: 10px;
  }

  .banner-slideshow {
    aspect-ratio: 4/3;
    min-height: 120px;
  }
}

/* Landscape Mode */
@media (max-height: 600px) and (orientation: landscape) {
  .prod-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .banner-slideshow {
    min-height: 150px;
  }
}
