/* ========================================
   PROFESSIONAL SHOP DESIGN
   Modern, clean, and cohesive e-commerce styling
   ======================================== */

/* Shop Page Layout */
.shop-page {
  background: #f9fafb;
  min-height: 100vh;
  overflow-x: hidden;
}

.shop-page .shop-sidebar {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shop-page .shop-sidebar::-webkit-scrollbar {
  width: 6px;
}

.shop-page .shop-sidebar::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.shop-page .shop-sidebar::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.shop-page .shop-sidebar::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Mobile Sidebar */
@media (max-width: 1023px) {
  .shop-sidebar {
    position: fixed;
    top: 0;
    left: -340px;
    width: 320px;
    max-width: calc(100vw - 24px);
    max-height: 100vh;
    z-index: 50;
    background: #fff;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 4rem 1.5rem 2rem;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .shop-sidebar.open {
    left: 0;
  }
  
  #shop-sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
}

/* Shop Content Area */
.shop-content {
  background: transparent;
}

/* Toolbar Styling */
.shop-toolbar {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.shop-view-btn {
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  outline: none;
}

.shop-view-btn:focus {
  outline: 2px solid #EB1D20;
  outline-offset: 2px;
}

/* Product Grid */
#shop-product-grid {
  gap: 1.5rem;
}

/* List View */
#shop-product-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

#shop-product-grid.list-view .shop-product-card {
  display: flex;
  flex-direction: row;
  max-width: 100%;
  height: auto;
}

#shop-product-grid.list-view .shop-product-card > div:first-child,
#shop-product-grid.list-view .shop-product-card .shop-product-card-img-wrap {
  width: 220px;
  min-width: 220px;
  height: 180px;
}

#shop-product-grid.list-view .shop-product-card img {
  width: 220px;
  height: 180px;
  object-fit: cover;
}

#shop-product-grid.list-view .shop-product-card .shop-product-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem;
}

/* Product Card Styling */
.shop-product-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.shop-product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #EB1D20, #c21517);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.shop-product-card:hover::before {
  transform: scaleX(1);
}

.shop-product-card:hover {
  border-color: #EB1D20;
  box-shadow: 0 10px 30px rgba(235, 29, 32, 0.15);
  transform: translateY(-4px);
}

.shop-product-card-img-wrap {
  position: relative;
  overflow: hidden;
  background: #f9fafb;
}

.shop-product-card-img-wrap img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.shop-product-card:hover .shop-product-card-img-wrap img {
  transform: scale(1.08);
}

.shop-product-card-body {
  padding: 1.5rem;
  min-width: 0;
}

.shop-product-card-body h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.shop-product-card:hover .shop-product-card-body h2 {
  color: #EB1D20;
}

.shop-product-card-body p {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
}

.shop-product-card-body .font-bold {
  color: #EB1D20;
  font-size: 1.25rem;
}

/* Availability Badges */
.shop-availability {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shop-availability-IN_STOCK { 
  background: #d1fae5; 
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.shop-availability-LOW_STOCK { 
  background: #fef3c7; 
  color: #92400e;
  border: 1px solid #fde68a;
}

.shop-availability-OUT_OF_STOCK { 
  background: #fee2e2; 
  color: #991b1b;
  border: 1px solid #fecaca;
}

.shop-availability-PRE_ORDER { 
  background: #dbeafe; 
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.shop-availability-DISCONTINUED { 
  background: #f3f4f6; 
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

/* Star Ratings */
.shop-reviews-stars,
.shop-stars { 
  color: #f59e0b;
  font-size: 1rem;
}

.shop-star-btn.text-amber-500 { 
  color: #f59e0b;
  transition: color 0.2s ease;
}

.shop-star-btn:hover {
  color: #d97706;
}

/* Sidebar Elements */
.shop-search-input {
  transition: all 0.2s ease;
  font-size: 0.9375rem;
}

.shop-search-input:focus {
  border-color: #EB1D20;
  ring-color: rgba(235, 29, 32, 0.2);
}

.shop-cat-tab {
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  cursor: pointer;
}

.shop-cat-tab:hover {
  background: #f3f4f6;
}

.shop-cat-tab.bg-gray-900 {
  background: #EB1D20 !important;
}

.shop-cat-tab.bg-gray-900:hover {
  background: #c21517 !important;
}

/* Collapsible category groups (default collapsed) */
.shop-cat-details {
  margin: 0;
}
.shop-cat-summary {
  cursor: pointer;
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
}
.shop-cat-summary::-webkit-details-marker {
  display: none;
}
.shop-cat-details[open] .shop-cat-chevron-icon {
  transform: rotate(90deg);
}
.shop-cat-children {
  list-style: none;
  padding-left: 0.75rem;
  margin-top: 0.25rem;
  border-left: 1px solid #e5e7eb;
}

/* Price Filter */
.shop-price-filter input {
  transition: border-color 0.2s ease;
}

.shop-price-filter input:focus {
  border-color: #EB1D20;
  outline: 2px solid rgba(235, 29, 32, 0.2);
}

/* Tags */
.shop-tag-checkbox {
  cursor: pointer;
  transition: all 0.2s ease;
}

.shop-tag-checkbox:checked {
  background-color: #EB1D20;
  border-color: #EB1D20;
}

/* Product Gallery - Single Page */
.shop-gallery-wrap {
  position: relative;
}

.shop-product-gallery {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.shop-gallery-main {
  position: relative;
  min-height: 280px;
}

.shop-gallery-main-img {
  display: block;
  transition: opacity 0.2s ease;
}

.shop-gallery-zoom {
  cursor: pointer;
}

.shop-gallery-thumbs {
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.shop-gallery-thumbs::-webkit-scrollbar {
  height: 6px;
}

.shop-gallery-thumbs::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.shop-gallery-thumbs::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.shop-gallery-thumb {
  cursor: pointer;
  transition: all 0.2s ease;
}

.shop-gallery-thumb-active {
  border-color: #EB1D20 !important;
  box-shadow: 0 0 0 1px #EB1D20;
}

.shop-gallery-lightbox {
  cursor: zoom-out;
  transition: opacity 0.2s ease;
}

.shop-gallery-lightbox:not(.hidden) {
  display: flex !important;
}

.shop-gallery-lightbox img {
  cursor: default;
}

/* Legacy gallery img (list view etc.) */
.shop-gallery-img {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.shop-gallery-img:first-child {
  border: 2px solid #e5e7eb;
}

/* Product Data Section */
.shop-product-data {
  background: #f9fafb !important;
  border: 1px solid #e5e7eb;
}

.shop-product-data label {
  cursor: pointer;
  transition: background 0.2s ease;
  padding: 0.75rem;
  border-radius: 6px;
}

.shop-product-data label:hover {
  background: #f3f4f6;
}

.shop-product-data input[type="radio"]:checked + span {
  font-weight: 600;
  color: #EB1D20;
}

.shop-product-data input[type="checkbox"]:checked + span {
  font-weight: 600;
  color: #EB1D20;
}

/* Buttons */
#shop-add-to-cart {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#shop-add-to-cart:hover {
  background: #f9fafb !important;
  border-color: #EB1D20;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#shop-buy-now {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #EB1D20 !important;
}

#shop-buy-now:hover {
  background: #c21517 !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(235, 29, 32, 0.3);
}

/* Filter Toggle Button (Mobile) */
#shop-sidebar-toggle {
  background: #EB1D20;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(235, 29, 32, 0.4);
}

#shop-sidebar-toggle:hover {
  background: #c21517;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(235, 29, 32, 0.5);
}

/* Wishlist & Share Buttons */
.shop-wishlist-btn,
.shop-share-btn {
  transition: all 0.2s ease;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.shop-wishlist-btn:hover {
  background: #fef2f2;
  color: #ef4444 !important;
  transform: scale(1.1);
}

.shop-share-btn:hover {
  background: #f3f4f6;
  color: #111827 !important;
  transform: scale(1.1);
}

/* Sort Dropdown */
#shop-sort {
  cursor: pointer;
  transition: all 0.2s ease;
}

#shop-sort:focus {
  border-color: #EB1D20;
  outline: 2px solid rgba(235, 29, 32, 0.2);
}

/* Loading States */
.shop-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #6b7280;
}

/* Empty State */
#shop-no-results {
  padding: 4rem 2rem;
  text-align: center;
  color: #9ca3af;
  font-size: 1.125rem;
}

/* FAQ Accordion - open state */
.shop-faq-item-open {
  border-color: #EB1D20 !important;
}

.shop-faq-item .shop-faq-chevron.rotate-180 {
  transform: rotate(180deg);
}

/* ========================================
   Product description (contentHtml) – opisy z importu
   Sekcje: product-hero, compatibility, symptoms, calibration,
   fault-codes, technical-specs, pricing, how-it-works,
   what-it-does-not-fix, faq, internal-links
   ======================================== */

.shop-product-prose {
  color: #374151;
  line-height: 1.65;
}

.shop-product-prose.prose h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 0.75em;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.shop-product-prose.prose h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin-top: 1.75em;
  margin-bottom: 0.6em;
  padding-bottom: 0.35em;
  border-bottom: 2px solid #EB1D20;
  display: inline-block;
}

.shop-product-prose.prose h2:first-of-type {
  margin-top: 0;
}

.shop-product-prose.prose h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1f2937;
  margin-top: 1.25em;
  margin-bottom: 0.4em;
}

.shop-product-prose.prose p {
  margin-bottom: 0.9em;
  color: #4b5563;
}

.shop-product-prose.prose ul,
.shop-product-prose.prose ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.shop-product-prose.prose li {
  margin-bottom: 0.4em;
}

.shop-product-prose.prose li::marker {
  color: #EB1D20;
}

.shop-product-prose.prose strong {
  color: #111827;
  font-weight: 600;
}

.shop-product-prose.prose em {
  color: #6b7280;
  font-style: italic;
}

.shop-product-prose.prose a {
  color: #EB1D20;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.shop-product-prose.prose a:hover {
  color: #c21517;
  border-bottom-color: #c21517;
}

/* Sekcje – wizualne rozdzielenie */
.shop-product-prose section {
  margin-bottom: 2rem;
}

.shop-product-prose section:last-child {
  margin-bottom: 0;
}

.shop-product-prose section.product-hero {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.shop-product-prose section.compatibility,
.shop-product-prose section.symptoms,
.shop-product-prose section.calibration,
.shop-product-prose section.fault-codes,
.shop-product-prose section.pricing,
.shop-product-prose section.how-it-works,
.shop-product-prose section.what-it-does-not-fix,
.shop-product-prose section.faq,
.shop-product-prose section.internal-links {
  padding: 1.25rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.shop-product-prose section.internal-links {
  border-bottom: none;
}

/* Technical specs – tabela w opisie (z contentHtml) */
.shop-product-prose section.technical-specs {
  padding: 1.25rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.shop-product-prose.prose table {
  font-size: 0.9375rem;
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.shop-product-prose.prose table th,
.shop-product-prose.prose table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.shop-product-prose.prose table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  width: 40%;
}

.shop-product-prose.prose table td {
  background: #fff;
  color: #111827;
}

.shop-product-prose.prose table tr:last-child th,
.shop-product-prose.prose table tr:last-child td {
  border-bottom: none;
}

/* FAQ w opisie (h3 = pytanie, p = odpowiedź) */
.shop-product-prose section.faq h3 {
  margin-top: 1.5em;
  margin-bottom: 0.35em;
  font-size: 1rem;
  color: #EB1D20;
}

.shop-product-prose section.faq h3:first-of-type {
  margin-top: 0;
}

.shop-product-prose section.faq p {
  margin-bottom: 0.75em;
  padding-left: 0;
}

/* Related / internal links */
.shop-product-prose section.internal-links ul {
  list-style: none;
  padding-left: 0;
}

.shop-product-prose section.internal-links li {
  margin-bottom: 0.5em;
}

.shop-product-prose section.internal-links li::marker {
  display: none;
}

.shop-product-prose section.internal-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.shop-product-prose section.internal-links a::before {
  content: '';
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  background: #EB1D20;
  border-radius: 50%;
}

/* Responsywność tabeli w opisie */
@media (max-width: 639px) {
  .shop-product-prose.prose table th,
  .shop-product-prose.prose table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

  .shop-product-prose.prose h1 {
    font-size: 1.5rem;
  }

  .shop-product-prose.prose h2 {
    font-size: 1.125rem;
  }
}

/* Specs grid - single product */
.shop-specs-grid {
  display: grid;
}

/* Responsive - Single product page */
@media (max-width: 639px) {
  .shop-gallery-main {
    min-height: 240px;
  }

  .shop-specs-grid {
    grid-template-columns: 1fr;
  }

  .shop-faq-question {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .shop-faq-answer > div {
    padding-left: 1.5rem;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .shop-specs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive Adjustments - List/shop page */
@media (max-width: 768px) {
  .shop-page .shop-sidebar {
    border-radius: 0;
  }

  .shop-toolbar {
    padding: 1rem;
    border-radius: 8px;
  }

  .shop-product-card {
    border-radius: 10px;
  }

  /* List view: stack card (image on top) to avoid horizontal scroll */
  #shop-product-grid.list-view .shop-product-card {
    flex-direction: column;
  }

  #shop-product-grid.list-view .shop-product-card > div:first-child,
  #shop-product-grid.list-view .shop-product-card .shop-product-card-img-wrap {
    width: 100%;
    min-width: 100%;
    height: 200px;
  }

  #shop-product-grid.list-view .shop-product-card img {
    width: 100%;
    height: 200px;
  }
}

/* Animation Utilities */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shop-product-card {
  animation: fadeIn 0.4s ease-out;
}

/* Accessibility */
.shop-product-card:focus-within {
  outline: 2px solid #EB1D20;
  outline-offset: 2px;
}

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

.shop-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Category Tabs Enhanced */
.shop-cat-tab svg {
  transition: transform 0.2s ease;
}

.shop-cat-tab:hover svg {
  transform: translateX(2px);
}

/* Product Card - List View Enhanced */
#shop-product-grid.list-view .shop-product-card .shop-product-card-body h2 {
  font-size: 1.25rem;
}

#shop-product-grid.list-view .shop-product-card .shop-product-card-body p {
  font-size: 0.9375rem;
}

/* Account Page Styles */
#shop-auth-login-wrap,
#shop-auth-register-wrap,
#shop-auth-orders-wrap {
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Checkout Items Summary */
#shop-checkout-items > div {
  transition: all 0.2s ease;
}

/* Cart Items Enhanced */
.shop-cart-item {
  animation: slideInRight 0.3s ease-out;
}

/* Cart item: stack on mobile for better readability */
@media (max-width: 639px) {
  .shop-cart-item > div:first-child {
    flex-direction: column;
    align-items: flex-start;
  }
  .shop-cart-item .flex-1 {
    width: 100%;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Review Cards Enhanced */
.shop-reviews-section .bg-white {
  animation: fadeInUp 0.4s ease-out;
}

/* Form Focus States */
input:focus,
textarea:focus,
select:focus {
  outline: none;
}

/* Success/Error Messages */
.shop-success-message {
  background: #d1fae5;
  border: 2px solid #10b981;
  color: #065f46;
  padding: 1rem;
  border-radius: 0.75rem;
  font-weight: 500;
}

.shop-error-message {
  background: #fee2e2;
  border: 2px solid #ef4444;
  color: #991b1b;
  padding: 1rem;
  border-radius: 0.75rem;
  font-weight: 500;
}

/* Enhanced Hover Effects */
.shop-product-card-body .line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* View Toggle Buttons */
.shop-view-btn.bg-gray-900 {
  background: #111827 !important;
  color: white !important;
}

.shop-view-btn.bg-gray-100 {
  background: #f3f4f6 !important;
  color: #374151 !important;
}

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

/* Loading Spinner */
.shop-spinner {
  border: 3px solid #f3f4f6;
  border-top-color: #EB1D20;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Badge Pulse Animation */
.shop-availability {
  animation: badgeFadeIn 0.3s ease-out;
}

@keyframes badgeFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Single product - visual polish */
.shop-gallery-wrap,
.shop-product-gallery,
.shop-specs-wrapper,
.shop-faq-section {
  animation: shopFadeIn 0.4s ease-out;
}

@keyframes shopFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shop-spec-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.shop-spec-card:hover {
  box-shadow: 0 4px 12px rgba(235, 29, 32, 0.08);
}

.shop-option-label:has(input:checked) {
  border-color: #EB1D20;
  background-color: rgba(235, 29, 32, 0.06);
}

.shop-product-data label:has(input:focus-visible) {
  outline: 2px solid #EB1D20;
  outline-offset: 2px;
}

/* Availability badges - contrast */
.shop-availability-IN_STOCK {
  background: #d1fae5;
  color: #065f46;
}

.shop-availability-LOW_STOCK {
  background: #fef3c7;
  color: #92400e;
}

.shop-availability-OUT_OF_STOCK {
  background: #fee2e2;
  color: #991b1b;
}

/* Print Styles */
@media print {
  .shop-sidebar,
  .shop-toolbar,
  #shop-sidebar-toggle,
  .shop-gallery-zoom,
  .shop-gallery-thumbs,
  .shop-wishlist-btn,
  .shop-share-btn {
    display: none !important;
  }

  .shop-product-card {
    break-inside: avoid;
  }

  .shop-faq-answer.hidden {
    display: block !important;
  }
}
