/* =================================
   PRODUCTS PAGE IMPROVEMENTS
   Fixes for spacing, card heights, calculator, and interactions
   ================================= */

/* Page Hero - Already fixed by global-fixes.css but ensure it works */
.page-hero {
  padding: 160px 0 80px !important;
}

/* Category Section Spacing */
.category-section {
  padding: 4rem 0 !important;
  position: relative;
}

.category-section + .category-section {
  margin-top: 2rem;
  padding-top: 5rem !important;
}

/* Add subtle separators between category sections */
.category-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.1) 50%, 
    transparent 100%
  );
}

.category-section:first-of-type::before {
  display: none;
}

/* Product Cards - Equal Heights */
.products-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
  gap: 1.5rem !important;
  align-items: stretch !important;
}

.product-card {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 450px;
  position: relative;
  padding: 2rem !important;
}

.product-header {
  flex-shrink: 0;
}

.product-description {
  flex-shrink: 0;
  margin-bottom: 1.5rem;
  min-height: 3em; /* Ensure consistent space */
}

.product-features {
  flex-grow: 1;
  margin-bottom: 1.5rem;
}

.product-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}

/* Billing Toggle */
.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem auto;
  padding: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: fit-content;
}

.billing-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.3s ease;
}

.billing-label.active {
  color: var(--text-primary);
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  width: 60px;
  height: 32px;
  background: var(--bg-tertiary);
  border-radius: 999px;
  border: 2px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: var(--gradient-accent);
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.toggle-switch.annual::after {
  transform: translateX(28px);
}

.toggle-switch:hover {
  border-color: var(--color-primary);
}

/* Save badge for annual */
.save-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--color-success);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* Pricing Tables - Equal Heights */
.pricing-table {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: stretch;
  justify-content: center;
}

.pricing-tier {
  flex: 1;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
}

.tier-header {
  flex-shrink: 0;
}

.tier-price {
  flex-shrink: 0;
  padding: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.tier-features {
  flex-grow: 1;
  padding: 1.5rem;
}

.tier-features ul {
  list-style: none;
  padding: 0;
}

.tier-features li {
  padding: 0.75rem 0;
  display: flex;
  align-items: start;
  gap: 0.75rem;
}

.tier-features li::before {
  content: '✓';
  color: var(--color-success);
  font-weight: 700;
  flex-shrink: 0;
}

.tier-footer {
  flex-shrink: 0;
  padding: 1.5rem;
  margin-top: auto;
  border-top: 1px solid var(--glass-border);
}

/* Calculator Improvements */
.calculator-section {
  background: linear-gradient(180deg, 
    transparent 0%,
    rgba(0, 212, 255, 0.02) 50%,
    transparent 100%
  ) !important;
  padding: 5rem 0 !important;
}

.calculator-card {
  max-width: 600px;
  margin: 0 auto;
  padding: 2.5rem !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.calculator-content {
  margin-top: 2rem;
}

.calculator-summary {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  color: var(--text-primary) !important;
}

.summary-item:not(:last-child) {
  border-bottom: 1px solid var(--glass-border);
}

.summary-item span:first-child {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.price-display {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary) !important;
}

/* Calculator inputs (if any) */
.calculator-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.calculator-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(0, 212, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Feature Comparison Table */
.comparison-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 2rem -1rem;
  padding: 0 1rem;
}

.comparison-table {
  min-width: 600px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.comparison-table th,
.comparison-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.comparison-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.comparison-table tr:hover td {
  background: var(--glass-bg);
}

/* Mobile scroll indicator */
@media (max-width: 768px) {
  .comparison-wrapper::after {
    content: '→';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gradient-accent);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
  }
  
  .comparison-wrapper.scrolled::after {
    opacity: 0;
  }
}

/* Subcategory spacing */
.subcategory-divider {
  grid-column: 1 / -1;
  padding: 2rem 0 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.subcategory-divider h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.subcategory-spacer {
  grid-column: 1 / -1;
  height: 2rem;
}

/* Category Tabs - Better visibility */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding: 0.5rem;
  background: var(--glass-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

.tab-button {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  position: relative;
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.tab-button.active {
  background: var(--gradient-accent);
  color: white;
}

.badge-soon {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: var(--color-warning);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
  text-transform: uppercase;
}

/* Tier indicators - ensure consistency */
.tier-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tier-indicator.tier-starter {
  background: var(--color-success);
}

.tier-indicator.tier-pro {
  background: var(--color-primary);
}

.tier-indicator.tier-enterprise {
  background: var(--color-accent);
}

/* Responsive improvements */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .category-section {
    padding: 3rem 0 !important;
  }
  
  .product-card {
    min-height: 400px;
  }
  
  .category-tabs {
    margin: 1.5rem -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .pricing-table {
    flex-direction: column;
    align-items: center;
  }
  
  .pricing-tier {
    width: 100%;
    max-width: 400px;
  }
  
  .billing-toggle {
    margin: 1.5rem auto;
    font-size: 0.85rem;
  }
}

/* Additional Product Card Improvements */
.product-card {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
  box-shadow: 0 10px 30px rgba(0, 212, 255, 0.15);
  transform: translateY(-5px);
}

/* Feature list improvements */
.product-features {
  padding: 0;
  margin: 1rem 0;
}

.product-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  line-height: 1.4;
}

.feature-check {
  color: var(--color-success);
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

/* Price display enhancements */
.price-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.price-period {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* Category Header Improvements */
.category-header {
  padding: 2rem 0;
  margin-bottom: 3rem;
  position: relative;
}

.category-header h2 {
  font-size: 2.5rem;
  margin: 1rem 0;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.category-header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Subcategory tabs improvements */
.subcategory-tabs {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: inline-flex;
  margin: 0 auto;
}

/* Add visual loading states */
.products-grid.loading {
  opacity: 0.7;
  pointer-events: none;
}

.products-grid.loading .product-card {
  animation: skeleton-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes skeleton-pulse {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

/* Tier filter improvements */
.tier-filter {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: inline-flex;
  gap: 0.25rem;
  margin: 1rem auto;
}

/* Badge improvements */
.product-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tier label positioning */
.tier-label {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 3;
}

/* Ensure buttons are full width and positioned at bottom */
.btn-block {
  width: 100%;
  margin-top: auto;
}

/* Product header improvements */
.product-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

