/* TSO Product Feed Styles */

/* Filter Styles */
.tso-filters-container {
  margin-bottom: 30px;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

.tso-product-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  width: 100%;
  box-sizing: border-box;
}

.tso-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
}

.tso-filter-group label {
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.tso-filter-select,
.tso-filter-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background: white;
  transition: border-color 0.3s ease;
  min-width: 150px;
  cursor: pointer;
}

.tso-filter-select {
  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='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 32px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.tso-filter-select:focus,
.tso-filter-input:focus {
  outline: none;
  border-color: #2c5aa0;
  box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.tso-filter-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #2c5aa0;
  color: white;
  margin-top: 20px;
  width: 100%;
}

.tso-filter-btn:hover {
  background: #1e3a5f;
}

.tso-clear-btn {
  background: #6c757d;
  padding: 0px !important;
}

.tso-clear-btn:hover {
  background: #5a6268;
  padding: 0px !important;
}

.tso-filter-group .tso-filter-btn {
  margin-top: 0;
  width: 100%;
  min-height: 38px;
}

.tso-no-products {
  text-align: center;
  padding: 40px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin: 20px 0;
}

.tso-no-products p {
  margin: 10px 0;
  color: #666;
}

.tso-products-grid {
  display: grid;
  gap: 20px;
  margin: 20px 0;
}

.tso-products-grid[data-columns="1"] {
  grid-template-columns: 1fr;
}

.tso-products-grid[data-columns="2"] {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.tso-products-grid[data-columns="3"] {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.tso-products-grid[data-columns="4"] {
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  max-width: 100%;
  margin: 20px auto;
}

.tso-product-item {
  background: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tso-product-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tso-product-image {
  position: relative;
  height: auto;
  overflow: hidden;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tso-product-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

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

.tso-product-image:hover {
  opacity: 0.9;
}

.tso-product-image:hover::after {
  content: "Click to view details";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  z-index: 10;
  pointer-events: none;
}

.tso-product-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tso-product-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #333;
  line-height: 1.3;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6em;
  overflow: hidden;
}

.tso-product-price {
  font-size: 18px;
  font-weight: 700;
  color: #2c5aa0;
  margin-bottom: 15px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tso-product-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.tso-view-more-btn,
.tso-buy-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  text-align: center;
  min-width: 120px;
}

.tso-view-more-btn {
  background: #6c757d;
  color: white;
  padding: 0px !important;
}

.tso-view-more-btn:hover {
  background: #5a6268;
  color: white;
}

.tso-buy-btn {
  background: #28a745;
  color: white;
}

.tso-buy-btn:hover {
  background: #218838;
  color: white;
}

/* Modal Styles */
.tso-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.tso-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  height: auto;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.tso-modal-close {
  position: absolute;
  right: 15px;
  top: 15px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.tso-modal-close:hover {
  color: #000;
}

#tso-product-modal-content {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
  /*max-height: calc(80vh - 60px);*/
}

.tso-modal-product-image {
  text-align: center;
  margin-bottom: 20px;
}

.tso-modal-product-image img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tso-modal-product-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 15px;
}

.tso-modal-product-price {
  font-size: 22px;
  font-weight: 700;
  color: #2c5aa0;
  margin-bottom: 20px;
}

.tso-modal-product-description {
  color: #666;
  line-height: 1.6;
  margin-bottom: 25px;
}

.tso-modal-product-category {
  color: #888;
  font-size: 14px;
  margin-bottom: 20px;
}

.tso-modal-buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.tso-modal-buy-btn {
  padding: 12px 24px;
  background: #28a745;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: background 0.3s ease;
}

.tso-modal-buy-btn:hover {
  background: #218838;
  color: white;
}

/* Loading State */
.tso-loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.tso-loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 10px;
}

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

/* Responsive Design */
@media (min-width: 769px) {
  .tso-modal-content {
    width: 95%;
    margin: 0 auto;
    max-height: 100vh;
    /*height: 80vh;*/
    border-radius: 0;
    margin-top: 1%;
  }

  #tso-product-modal-content {
    text-align: left;
  }

  .tso-modal-product-title {
    text-align: left;
  }

  .tso-modal-product-price {
    text-align: left;
  }

  .tso-modal-product-description {
    text-align: left;
  }

  .tso-modal-product-category {
    text-align: left;
  }

  .tso-modal-buttons {
    justify-content: flex-start;
    align-items: flex-start;
  }
}

@media (max-width: 1200px) {
  .tso-products-grid[data-columns="4"] {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .tso-products-grid[data-columns="4"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .tso-products-grid {
    gap: 15px;
  }

  .tso-filters-container {
    padding: 15px;
  }

  .tso-product-filters {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .tso-filter-group {
    min-width: auto;
    width: 100%;
  }

  .tso-filter-group .tso-filter-btn {
    width: 100%;
    margin-top: 0;
  }

  .tso-product-info {
    padding: 12px;
  }

  .tso-product-title {
    font-size: 14px;
    min-height: 2.4em;
    line-height: 1.2;
  }

  .tso-product-price {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .tso-product-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .tso-view-more-btn,
  .tso-buy-btn {
    flex: none;
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    min-width: auto;
  }

  .tso-modal-content {
    width: 95%;
    margin: 0 auto;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  #tso-product-modal-content {
    padding: 20px;
    text-align: center;
  }

  .tso-modal-product-title {
    font-size: 18px;
    text-align: center;
  }

  .tso-modal-product-price {
    text-align: center;
  }

  .tso-modal-product-description {
    text-align: center;
  }

  .tso-modal-product-category {
    text-align: center;
  }

  .tso-modal-buttons {
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .tso-products-grid[data-columns="3"],
  .tso-products-grid[data-columns="4"] {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tso-modal-content {
    width: 95%;
    margin: 0 auto;
    max-height: 90vh;
    height: 100vh;
    border-radius: 0;
  }

  .tso-product-info {
    padding: 10px;
  }

  .tso-product-title {
    font-size: 13px;
    min-height: 2.2em;
  }

  .tso-product-price {
    font-size: 15px;
    margin-bottom: 10px;
  }

  .tso-product-buttons {
    gap: 6px;
  }

  .tso-view-more-btn,
  .tso-buy-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  /*.tso-buy-btn {
    width: 94%;
  }*/

  .tso-filters-container {
    padding: 12px;
  }

  .tso-product-filters {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
