/**
 * pk-shop-mobile.css  —  Mobile-First Shop Layout
 * Optimized for mobile devices with smooth interactions
 */

/* ── Mobile-First Design Tokens ─────────────────────────────────────── */
:root {
  --pk-navy:        #0A1628;
  --pk-navy-mid:    #122040;
  --pk-navy-light:  #1a3060;
  --pk-gold:        #E8A020;
  --pk-gold-light:  #f0b840;
  --pk-gold-dark:   #c88018;
  --pk-white:       #ffffff;
  --pk-gray-50:     #f8f9fc;
  --pk-gray-100:    #f0f2f7;
  --pk-gray-200:    #e2e6ef;
  --pk-gray-400:    #9aa5b8;
  --pk-gray-600:    #6b7a94;
  --pk-gray-800:    #2d3a52;
  --pk-success:     #22c55e;
  --pk-danger:      #ef4444;
  --pk-shadow-sm:   0 1px 3px rgba(10,22,40,.10);
  --pk-shadow-md:   0 4px 16px rgba(10,22,40,.12);
  --pk-shadow-lg:   0 8px 32px rgba(10,22,40,.18);
  --pk-radius:      12px;
  --pk-radius-sm:   8px;
  --pk-trans:       0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --pk-drawer-w:    100%;
  --pk-mobile-break: 768px;
}

/* ── Base Mobile Styles ─────────────────────────────────────────── */
.pk-shop {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--pk-gray-800);
  line-height: 1.6;
  background: var(--pk-gray-50);
  min-height: 100vh;
}

.pk-shop *,
.pk-shop *::before,
.pk-shop *::after { 
  box-sizing: border-box;
}

/* ── Mobile Filter Bar (Mobile Only) ─────────────────────────────────── */
.pk-mobile-filter-bar {
  display: none; /* Hidden by default, shown only on mobile */
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--pk-white);
  border-bottom: 1px solid var(--pk-gray-200);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.pk-mobile-filter-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pk-mobile-filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--pk-white);
  border: 1px solid var(--pk-gray-200);
  border-radius: var(--pk-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--pk-gray-800);
  cursor: pointer;
  transition: all var(--pk-trans);
}

.pk-mobile-filter-toggle:hover {
  background: var(--pk-gray-50);
  border-color: var(--pk-gold);
}

.pk-mobile-filter-toggle:active {
  transform: scale(0.98);
}

.pk-mobile-results-count {
  font-size: 0.875rem;
  color: var(--pk-gray-600);
  font-weight: 500;
}

.pk-mobile-filter-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pk-mobile-sort-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--pk-gray-200);
  border-radius: var(--pk-radius-sm);
  background: var(--pk-white);
  font-size: 0.875rem;
  color: var(--pk-gray-800);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7a94' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.25rem;
}

/* ── Shop Hero (Mobile Optimized) ─────────────────────────────────── */
.pk-shop-hero {
  background: linear-gradient(135deg,
    var(--pk-navy) 0%,
    var(--pk-navy-mid) 55%,
    var(--pk-navy-light) 100%);
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
}

.pk-shop-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.3;
}

.pk-shop-hero-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
}

.pk-shop-hero-content {
  flex: 1;
}

.pk-shop-title {
  color: var(--pk-white);
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.pk-shop-subtitle {
  color: var(--pk-gray-400);
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

.pk-shop-hero-actions {
  display: none; /* Hidden on mobile, cart is in filter bar */
}

/* ── Shop Body (Default Desktop Layout) ─────────────────────────── */
.pk-shop-body {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  gap: 2rem;
}

/* Sidebar visible on desktop by default */
.pk-shop-sidebar {
  display: block;
  width: 280px;
  flex-shrink: 0;
  height: auto;
  border: 1px solid var(--pk-gray-200);
  border-radius: var(--pk-radius);
  padding: 1.5rem;
  background: var(--pk-white);
}

/* Main content on desktop */
.pk-shop-main {
  flex: 1;
  padding: 0;
  min-height: auto;
}

/* ── Results Bar (Desktop) ─────────────────────────────────────────── */
.pk-shop-results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--pk-gray-200);
}

/* ── Product Grid (Desktop Default) ───────────────────────────────── */
.pk-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* ── Product Card (Mobile Redesign) ─────────────────────────────────── */
.pk-product-card {
  background: var(--pk-white);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow-sm);
  overflow: hidden;
  transition: all var(--pk-trans);
  position: relative;
}

.pk-product-card:hover {
  box-shadow: var(--pk-shadow-md);
  transform: translateY(-2px);
}

.pk-product-img-link {
  display: block;
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

.pk-product-img-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--pk-gray-100);
}

.pk-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--pk-trans);
}

.pk-product-card:hover .pk-product-img {
  transform: scale(1.05);
}

.pk-product-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pk-gray-100) 0%, var(--pk-gray-200) 100%);
}

.pk-product-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 22, 40, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--pk-trans);
}

.pk-product-card:hover .pk-product-overlay {
  opacity: 1;
}

.pk-product-quick-view {
  color: var(--pk-white);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Product Info (Mobile) ─────────────────────────────────────────── */
.pk-product-info {
  padding: 1.25rem;
}

.pk-product-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.pk-product-title-link {
  color: var(--pk-navy);
  text-decoration: none;
  transition: color var(--pk-trans);
}

.pk-product-title-link:hover {
  color: var(--pk-gold);
}

.pk-product-desc {
  color: var(--pk-gray-600);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0 0 1rem 0;
  display: -webkit-box;
  display: box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Variation Select (Mobile) ─────────────────────────────────────── */
.pk-variation-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--pk-gray-200);
  border-radius: var(--pk-radius-sm);
  background: var(--pk-white);
  font-size: 0.875rem;
  color: var(--pk-gray-800);
  margin-bottom: 1rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7a94' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

/* ── Product Footer (Mobile) ───────────────────────────────────────── */
.pk-product-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pk-product-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--pk-navy);
  margin: 0;
}

.pk-product-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.pk-qty-input {
  width: 80px;
  padding: 0.75rem;
  border: 1px solid var(--pk-gray-200);
  border-radius: var(--pk-radius-sm);
  font-size: 1rem;
  text-align: center;
  background: var(--pk-white);
}

.pk-add-to-cart-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: var(--pk-gold);
  color: var(--pk-white);
  border: none;
  border-radius: var(--pk-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--pk-trans);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.pk-add-to-cart-btn:hover {
  background: var(--pk-gold-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 160, 32, 0.3);
}

.pk-add-to-cart-btn:active {
  transform: translateY(0);
}

/* ── Cart Trigger (Mobile) ─────────────────────────────────────────── */
.pk-cart-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--pk-gold);
  color: var(--pk-white);
  border: none;
  border-radius: var(--pk-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--pk-trans);
  position: relative;
}

.pk-cart-trigger:hover {
  background: var(--pk-gold-dark);
  transform: translateY(-1px);
}

.pk-cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  background: var(--pk-danger);
  color: var(--pk-white);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* ── Cart Drawer (Mobile Optimized) ─────────────────────────────────── */
.pk-cart-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--pk-trans);
}

.pk-cart-overlay.active {
  display: block;
  opacity: 1;
}

.pk-cart-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100vh;
  background: var(--pk-white);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right var(--pk-trans);
}

.pk-cart-drawer.active {
  right: 0;
}

.pk-cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--pk-gray-200);
  background: var(--pk-white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.pk-cart-drawer-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--pk-navy);
  margin: 0;
}

.pk-cart-drawer-close {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--pk-gray-100);
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--pk-gray-600);
  cursor: pointer;
  transition: all var(--pk-trans);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pk-cart-drawer-close:hover {
  background: var(--pk-gray-200);
  color: var(--pk-navy);
}

.pk-cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.pk-cart-drawer-footer {
  padding: 1rem;
  border-top: 1px solid var(--pk-gray-200);
  background: var(--pk-white);
  position: sticky;
  bottom: 0;
}

.pk-cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.pk-cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--pk-gold);
  color: var(--pk-white);
  text-align: center;
  text-decoration: none;
  border-radius: var(--pk-radius-sm);
  font-weight: 600;
  margin-bottom: 0.75rem;
  transition: all var(--pk-trans);
}

.pk-cart-checkout-btn:hover {
  background: var(--pk-gold-dark);
}

.pk-cart-view-link {
  display: block;
  text-align: center;
  color: var(--pk-gray-600);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--pk-trans);
}

.pk-cart-view-link:hover {
  color: var(--pk-navy);
}

/* ── Empty State (Mobile) ─────────────────────────────────────────── */
.pk-shop-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--pk-gray-600);
}

.pk-shop-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.pk-shop-empty h2 {
  color: var(--pk-navy);
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
}

.pk-shop-empty p {
  margin: 0 0 1.5rem 0;
  line-height: 1.6;
}

/* ── Mobile Styles (767px and down) ─────────────────────────────────── */
@media (max-width: 767px) {
  
  /* Show mobile filter bar */
  .pk-mobile-filter-bar {
    display: flex;
  }
  
  /* Hide desktop hero actions */
  .pk-shop-hero-actions {
    display: none;
  }
  
  /* Change to mobile layout */
  .pk-shop-body {
    flex-direction: column;
    padding: 0;
    max-width: none;
    margin: 0;
    gap: 0;
  }
  
  /* Hide desktop sidebar, show mobile overlay */
  .pk-shop-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--pk-white);
    z-index: 100;
    overflow-y: auto;
    transition: left var(--pk-trans);
    box-shadow: var(--pk-shadow-lg);
    border: none;
    border-radius: 0;
    padding: 0;
  }
  
  .pk-shop-sidebar.active {
    left: 0;
  }
  
  /* Main content takes full width on mobile */
  .pk-shop-main {
    flex: 1;
    padding: 1rem;
    min-height: calc(100vh - 200px);
  }
  
  /* Hide results bar on mobile (count is in filter bar) */
  .pk-shop-results-bar {
    display: none;
  }
  
  /* Single column grid on mobile */
  .pk-product-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  /* Mobile hero layout */
  .pk-shop-hero-inner {
    flex-direction: column;
    text-align: center;
  }
  
  .pk-shop-title {
    font-size: 2rem;
  }
  
  /* Mobile product actions */
  .pk-product-footer {
    flex-direction: column;
    gap: 1rem;
  }
  
  .pk-product-actions {
    width: 100%;
  }
  
  .pk-qty-input {
    width: 80px;
  }
  
  /* Full screen cart drawer on mobile */
  .pk-cart-drawer {
    width: 100%;
    right: -100%;
  }
  
  .pk-cart-drawer.active {
    right: 0;
  }
}

/* ── Desktop Styles (768px and up) ───────────────────────────────────── */
@media (min-width: 768px) {
  
  /* Hide mobile elements */
  .pk-mobile-filter-bar {
    display: none;
  }
  
  /* Show desktop hero actions */
  .pk-shop-hero-actions {
    display: block;
  }
  
  .pk-shop-hero-inner {
    flex-direction: row;
    text-align: left;
  }
  
  .pk-shop-hero-content {
    flex: 1;
  }
  
  .pk-cart-trigger--desktop {
    display: flex;
  }
  
  .pk-shop-title {
    font-size: 2.5rem;
  }
  
  .pk-product-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .pk-product-actions {
    width: auto;
  }
  
  .pk-qty-input {
    width: 60px;
  }
  
  .pk-cart-drawer {
    width: var(--pk-drawer-w);
    right: -420px;
  }
  
  .pk-cart-drawer.active {
    right: 0;
  }
}

/* ── Large Desktop Styles (1024px and up) ───────────────────────────── */
@media (min-width: 1024px) {
  .pk-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
  }
  
  .pk-shop-sidebar {
    width: 320px;
  }
  
  .pk-shop-title {
    font-size: 3rem;
  }
}

/* ── Touch Optimizations ───────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .pk-product-card:hover .pk-product-img {
    transform: none;
  }
  
  .pk-product-card:hover .pk-product-overlay {
    opacity: 0;
  }
  
  .pk-product-card:active {
    transform: scale(0.98);
  }
  
  .pk-add-to-cart-btn:active {
    transform: scale(0.95);
  }
  
  .pk-mobile-filter-toggle:active {
    transform: scale(0.95);
  }
}

/* ── Smooth Scrolling ───────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

/* ── Loading States ─────────────────────────────────────────────── */
.pk-cart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--pk-gray-600);
}

.pk-cart-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--pk-gray-200);
  border-top: 2px solid var(--pk-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Success Animation ───────────────────────────────────────────── */
.pk-add-success {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--pk-success);
  color: var(--pk-white);
  padding: 0.5rem 1rem;
  border-radius: var(--pk-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-10px);
  transition: all var(--pk-trans);
  z-index: 10;
}

.pk-add-success.show {
  opacity: 1;
  transform: translateY(0);
}
