/**
 * RibbonRoute Marketplace Widget Styles
 * Standalone CSS for embeddable marketplace widget
 * Self-contained with no external dependencies
 */

/* Widget Container */
#ribbonroute-marketplace {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1f2937;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Filters */
.rr-filters {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rr-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.rr-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 140px;
}

.rr-filter-group label {
  font-size: 1rem;
  font-weight: 500;
  color: #4b5563;
}

.rr-filter-select,
.rr-filter-input {
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  color: #1f2937;
  background: #ffffff;
  transition: border-color 0.2s;
}

.rr-filter-select:focus,
.rr-filter-input:focus {
  outline: none;
  border-color: #9333ea;
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.rr-filter-checkbox {
  justify-content: center;
}

.rr-filter-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #1f2937;
}

.rr-filter-checkbox-input {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.rr-filter-button {
  padding: 0.875rem 1.75rem;
  background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}

.rr-filter-button:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.rr-filter-button-secondary {
  padding: 0.875rem 1.75rem;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.rr-filter-button-secondary:hover {
  background: #e5e7eb;
}

@media (max-width: 768px) {
  .rr-filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .rr-filter-group {
    width: 100%;
  }

  .rr-filter-button,
  .rr-filter-button-secondary {
    width: 100%;
  }
}

/* Products Grid */
.rr-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

@media (max-width: 768px) {
  .rr-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }
}

/* Product Card */
.rr-product-card {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

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

/* Product Image */
.rr-product-image {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 aspect ratio */
  background: #f3f4f6;
  overflow: hidden;
}

.rr-product-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Rent Badge */
.rr-rent-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #3b82f6;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Product Info */
.rr-product-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.rr-product-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rr-product-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #9333ea;
  margin: 0 0 0.75rem 0;
}

/* Product Meta */
.rr-product-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

/* Condition Badge */
.rr-condition-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: capitalize;
}

.rr-condition-new {
  background: #dcfce7;
  color: #166534;
}

.rr-condition-like_new {
  background: #dbeafe;
  color: #1e40af;
}

.rr-condition-good {
  background: #fef3c7;
  color: #92400e;
}

.rr-condition-fair {
  background: #fed7aa;
  color: #9a3412;
}

.rr-condition-poor {
  background: #fee2e2;
  color: #991b1b;
}

/* Size Badge */
.rr-size-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  background: #f3f4f6;
  color: #4b5563;
}

/* View Button */
.rr-view-button {
  display: block;
  width: 100%;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
  color: #ffffff;
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
  margin-top: auto;
}

.rr-view-button:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Loading State */
.rr-widget-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.rr-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top-color: #9333ea;
  border-radius: 50%;
  animation: rr-spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

.rr-widget-loading p {
  color: #6b7280;
  font-size: 1.0625rem;
}

/* Error State */
.rr-widget-error {
  padding: 2rem 1rem;
  text-align: center;
  background: #fee2e2;
  border-radius: 8px;
  color: #991b1b;
}

.rr-widget-error p {
  margin: 0;
  font-size: 1.0625rem;
}

/* Empty State */
.rr-widget-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: #6b7280;
}

.rr-widget-empty p {
  margin: 0;
  font-size: 1.125rem;
}

/* Load More Trigger (for infinite scroll) */
.rr-load-more-trigger {
  height: 1px;
  margin: 2rem 0;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .rr-product-card {
    border-radius: 8px;
  }

  .rr-product-info {
    padding: 0.75rem;
  }

  .rr-product-title {
    font-size: 0.875rem;
  }

  .rr-product-price {
    font-size: 1.125rem;
  }

  .rr-view-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* Print styles */
@media print {
  .rr-product-card {
    break-inside: avoid;
  }
  
  .rr-view-button {
    display: none;
  }
}

