/**
 * Products Grid List - Styles
 * Grid und List View für Produkte mit Toolbar
 */

/* Container */
.pgl-container {
  width: 100%;
  margin: 0px 0;
}

/* Toolbar */
.pgl-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #f8f8f8;
  border-radius: 8px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.pgl-toolbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.pgl-toolbar-right {
  display: flex;
  align-items: center;
}

/* View Toggle Buttons */
.pgl-view-toggle {
  display: flex;
  gap: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}

.pgl-view-btn {
  padding: 10px 15px;
  border: none;
  background: #fff !important;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666 !important;
}

.pgl-view-btn:hover,
.pgl-view-btn:focus {
  background: #f0f0f0 !important;
  color: #666 !important;
}

.pgl-view-btn.active {
  background: #333 !important;
  color: #fff !important;
}

.pgl-view-btn.active:hover,
.pgl-view-btn.active:focus {
  background: #333 !important;
  color: #fff !important;
}

.pgl-view-btn svg {
  display: block;
}

/* Per Page Dropdown */
.pgl-per-page {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

.pgl-items-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

.pgl-items-select:focus {
  outline: none;
  border-color: #333 !important;
  background: #fff !important;
  color: inherit !important;
}

/* Produkt-Zähler */
.pgl-count {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

/* Produkte Container */
.pgl-products {
  width: 100%;
  transition: all 0.3s ease;
}

/* Grid View */
.pgl-products.pgl-view-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

/* List View */
.pgl-products.pgl-view-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Produkt Item - Grid */
.pgl-view-grid .pgl-product-item {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.pgl-view-grid .pgl-product-item:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-5px);
}

.pgl-view-grid .pgl-product-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Produkt Item - List */
.pgl-view-list .pgl-product-item {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.pgl-view-list .pgl-product-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.pgl-view-list .pgl-product-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

/* Produkt Bild - Grid */
.pgl-view-grid .pgl-product-image {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  overflow: hidden;
  background: #f5f5f5;
}

.pgl-view-grid .pgl-product-image a {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pgl-view-grid .pgl-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}

.pgl-view-grid .pgl-product-item:hover .pgl-product-image img {
  transform: scale(1.05);
}

/* Produkt Bild - List */
.pgl-view-list .pgl-product-image {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  background: #f5f5f5;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.pgl-view-list .pgl-image-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.pgl-view-list .pgl-image-wrapper {
  width: 100%;
  height: 100%;
}

.pgl-view-list .pgl-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.pgl-view-list .pgl-hover-overlay {
  border-radius: 4px;
}

/* List View: Hover über gesamtes Produkt-Item triggert Overlay im Bild */
.pgl-view-list .pgl-product-item:hover .pgl-hover-overlay {
  opacity: 1;
  visibility: visible;
}

.pgl-view-list .pgl-product-item:hover .pgl-image-wrapper img {
  opacity: 0.6;
}

/* Produkt Info - Grid */
.pgl-view-grid .pgl-product-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

/* Produkt Info - List */
.pgl-view-list .pgl-product-info {
  flex-grow: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Produkt Titel */
.pgl-product-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.pgl-product-title a {
  color: #333;
  text-decoration: none;
  transition: color 0.2s;
}

.pgl-product-title a:hover {
  color: #0073aa;
}

.pgl-view-list .pgl-product-title {
  font-size: 18px;
}

/* Preis */
.pgl-product-price {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.pgl-product-price del {
  color: #999;
  font-weight: 400;
  margin-right: 8px;
}

.pgl-product-price ins {
  text-decoration: none;
  color: #e74c3c;
}

/* Buttons */
.pgl-product-actions {
  margin-top: auto;
}

.pgl-add-to-cart,
.pgl-view-product {
  display: inline-block;
  padding: 12px 24px;
  background: #333;
  color: #fff !important;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.pgl-add-to-cart:hover,
.pgl-view-product:hover {
  background: #000;
  transform: translateY(-2px);
}

/* Pagination */
.pgl-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.pgl-page-btn,
.pgl-page-number {
  padding: 10px 15px;
  background: #fff !important;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none !important;
  color: #333 !important;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-block;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.pgl-page-btn:hover,
.pgl-page-btn:focus,
.pgl-page-number:hover,
.pgl-page-number:focus {
  background: #f0f0f0 !important;
  border-color: #333 !important;
  color: #333 !important;
}

.pgl-page-btn:disabled,
.pgl-page-number:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pgl-page-number.active {
  background: #333 !important;
  color: #fff !important;
  border-color: #333 !important;
}

.pgl-page-number.active:hover,
.pgl-page-number.active:focus {
  background: #333 !important;
  color: #fff !important;
  border-color: #333 !important;
}

.pgl-page-numbers {
  display: flex;
  gap: 5px;
}

/* Loading State */
.pgl-container.pgl-loading {
  position: relative;
}

.pgl-container.pgl-loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.pgl-container.pgl-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #333;
  border-radius: 50%;
  animation: pgl-spin 1s linear infinite;
  z-index: 101;
}

@keyframes pgl-spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Loading State für Produkte */
.pgl-products {
  transition: opacity 0.3s ease;
  position: relative;
}

/* Keine Produkte */
.pgl-no-products {
  text-align: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #666;
}

/* Fehlermeldungen */
.pgl-error {
  padding: 15px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  color: #721c24;
}

.pgl-info {
  padding: 15px;
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  color: #0c5460;
}

/* Responsive Design */

/* Tablet */
@media (max-width: 1024px) {
  .pgl-products.pgl-view-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .pgl-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .pgl-toolbar-left,
  .pgl-toolbar-right {
    width: 100%;
  }

  .pgl-toolbar-right {
    justify-content: space-between;
  }

  .pgl-products.pgl-view-grid {
    gap: 20px;
  }

  .pgl-view-list .pgl-product-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .pgl-view-list .pgl-product-image {
    width: 100%;
    height: 200px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .pgl-container {
    margin: 20px 0;
  }

  .pgl-toolbar {
    padding: 15px;
  }

  .pgl-products.pgl-view-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .pgl-pagination {
    gap: 5px;
  }

  .pgl-page-btn,
  .pgl-page-number {
    padding: 8px 12px;
    font-size: 14px;
  }

  .pgl-count {
    font-size: 12px;
  }
}

/* Hover Overlay Styles */
.pgl-image-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease;
}

.pgl-view-grid .pgl-image-container {
  position: absolute;
  top: 0;
  left: 0;
}

.pgl-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.pgl-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: opacity 0.3s ease;
}

.pgl-image-container:hover .pgl-image-wrapper img {
  opacity: 0.6;
}

.pgl-hover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 10;
}

.pgl-image-container:hover .pgl-hover-overlay {
  opacity: 1;
  visibility: visible;
}

.pgl-overlay-inner {
  text-align: center;
  padding: 30px;
  width: 100%;
  max-width: 280px;
}

.pgl-quantity-section {
  margin-bottom: 20px;
}

.pgl-quantity-label {
  display: block;
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.pgl-quantity-input {
  width: 80px;
  padding: 10px;
  font-size: 16px;
  font-weight: 500;
  border: 1px solid #ffffff;
  background: #ffffff;
  color: #000000;
  text-align: center;
  transition: all 0.2s ease;
}

.pgl-quantity-input:hover {
  border-color: #f3f4f6;
}

.pgl-quantity-input:focus {
  outline: none;
  border-color: #d1d5db;
}

.pgl-add-to-cart-btn {
  width: 100%;
  padding: 14px 24px;
  background: #ffffff !important;
  color: #000000 !important;
  border: 1px solid #ffffff;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none !important;
}

.pgl-add-to-cart-btn:hover,
.pgl-add-to-cart-btn:focus {
  background: #000000 !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
}

.pgl-add-to-cart-btn:active {
  transform: scale(0.98);
}

.pgl-add-to-cart-btn.loading {
  pointer-events: none;
}

.pgl-add-to-cart-btn.loading .pgl-btn-text {
  opacity: 0;
}

.pgl-btn-text {
  display: inline-block;
  transition: opacity 0.2s ease;
}

.pgl-btn-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid #000000;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pgl-add-to-cart-btn.loading .pgl-btn-spinner {
  opacity: 1;
  animation: pgl-spinner-spin 0.6s linear infinite;
}

.pgl-add-to-cart-btn:hover .pgl-btn-spinner,
.pgl-add-to-cart-btn:focus .pgl-btn-spinner {
  border-color: #ffffff !important;
  border-top-color: transparent !important;
}

@keyframes pgl-spinner-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Toast Notifications */
#pgl-toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.pgl-toast {
  background: #000000;
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #1f2937;
  transform: translateX(450px);
  opacity: 0;
  transition: all 0.3s ease;
  min-width: 350px;
}

.pgl-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.pgl-toast-success {
  border-color: #ffffff;
}

.pgl-toast-error {
  background: #1f2937;
  border-color: #ef4444;
}

.pgl-toast-content {
  flex: 1;
  min-width: 0;
}

.pgl-toast-message {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.3px;
}

.pgl-toast-close {
  background: transparent !important;
  border: none;
  color: #9ca3af !important;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pgl-toast-close:hover,
.pgl-toast-close:focus {
  color: #ffffff !important;
  background: transparent !important;
}

/* List View Hover Overlay Anpassungen */
.pgl-view-list .pgl-overlay-inner {
  padding: 10px;
  max-width: 130px;
}

.pgl-view-list .pgl-quantity-label {
  font-size: 10px;
  margin-bottom: 6px;
}

.pgl-view-list .pgl-quantity-input {
  width: 60px;
  padding: 6px;
  font-size: 14px;
}

.pgl-view-list .pgl-add-to-cart-btn {
  padding: 8px 12px;
  font-size: 10px;
}

.pgl-view-list .pgl-quantity-section {
  margin-bottom: 10px;
}

/* Responsive für Hover Overlay */
@media (max-width: 768px) {
  .pgl-overlay-inner {
    padding: 20px;
    max-width: 240px;
  }

  .pgl-quantity-input {
    width: 70px;
    padding: 8px;
    font-size: 14px;
  }

  .pgl-add-to-cart-btn {
    padding: 12px 20px;
    font-size: 12px;
  }

  #pgl-toast-container {
    bottom: 20px;
    right: 20px;
    left: 20px;
    max-width: none;
  }

  .pgl-toast {
    min-width: auto;
    width: 100%;
  }

  /* List View Anpassung für Mobile */
  .pgl-view-list .pgl-product-image {
    width: 100%;
    height: 200px;
  }

  .pgl-view-list .pgl-overlay-inner {
    padding: 15px;
    max-width: 200px;
  }

  .pgl-view-list .pgl-quantity-label {
    font-size: 11px;
  }

  .pgl-view-list .pgl-quantity-input {
    width: 70px;
    padding: 8px;
    font-size: 14px;
  }

  .pgl-view-list .pgl-add-to-cart-btn {
    padding: 10px 16px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .pgl-quantity-label {
    font-size: 11px;
  }

  .pgl-add-to-cart-btn {
    font-size: 11px;
    padding: 10px 16px;
  }

  #pgl-toast-container {
    bottom: 15px;
    right: 15px;
    left: 15px;
  }
}

.pgl-quantity-input:focus-visible,
.pgl-add-to-cart-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pgl-image-wrapper img,
  .pgl-hover-overlay,
  .pgl-toast,
  .pgl-add-to-cart-btn,
  .pgl-btn-spinner {
    transition: none;
    animation: none;
  }
}
