/* ToolSurf Cart Overhaul - Premium CSS */
:root {
  --primary: #00A67E;
  --primary-hover: #008f6b;
  --secondary: #1a1a2e;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.cart-overhaul-active .am-cart-main > div > .am-cart-layout-product-list,
.cart-overhaul-active .am-cart-main > div > h2,
.cart-overhaul-active .am-cart-main > div > .am-cart-category-desc,
.cart-overhaul-active #cart-search {
  display: none !important;
}

html.cart-overhaul-active body,
body.cart-overhaul-active {
  background-color: var(--bg-color) !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* Base aMember layout overrides (applies to /product/id/ single views) */
.am-cart-product-content-desc-img-wrapper,
.am-cart-product-page-image,
.am-cart-product-content-desc-img,
.am-cart-product-page-image img {
  background: #ffffff !important;
}

/* Container */
.ts-cart-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px 60px;
}

/* Hero Section */
.ts-hero {
  background: linear-gradient(135deg, var(--secondary) 0%, #16213e 100%);
  border-radius: 16px;
  padding: 40px 30px;
  text-align: center;
  color: white;
  margin-top: 30px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.ts-hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(0,166,126,0.1) 0%, transparent 60%);
  z-index: 0;
}

.ts-hero-content {
  position: relative;
  z-index: 1;
}

.ts-hero h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
}

.ts-hero p {
  font-size: 1.1rem;
  color: #94a3b8;
  max-width: 600px;
  margin: 0 auto;
}

/* Trust Bar */
.ts-trust-bar {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  border: 1px solid var(--border-light);
}

.ts-trust-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
}

.ts-trust-icon {
  color: var(--primary);
  font-size: 1.25rem;
}

/* Search & Filter Bar */
.ts-control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
  position: sticky;
  top: 70px;
  z-index: 100;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(12px);
  padding: 15px 0;
  border-bottom: 1px solid var(--border-light);
}

.ts-search {
  position: relative;
  flex: 1;
  min-width: 250px;
  max-width: 350px;
}

#tsSearchInput {
  width: 100%;
  padding: 12px 20px 12px 45px !important;
  box-sizing: border-box !important;
  border: 2px solid var(--border-light);
  border-radius: 30px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

#tsSearchInput:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 166, 126, 0.1);
}

.ts-search i {
  position: absolute;
  left: 18px;
  top: 15px;
  color: var(--text-muted);
}

/* Category Pills */
.ts-categories {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 2;
}

.ts-cat-btn {
  padding: 8px 18px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.ts-cat-btn:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  background: white !important;
}

.ts-cat-btn.active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

/* Grid Layout */
.ts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* Product Card */
.ts-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.ts-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

/* Image */
.ts-card-img-wrap {
  width: 100%;
  height: 160px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.ts-card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.ts-card:hover .ts-card-img-wrap img {
  transform: scale(1.05);
}

/* Content */
.ts-card-body {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.ts-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  text-decoration: none;
}

.ts-card-price-area {
  margin-top: auto;
  margin-bottom: 15px;
}

.ts-comp-price {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.ts-actual-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.ts-actual-price span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Badge overlay */
.ts-badge-save {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ef4444;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
}

.ts-badge-cat {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Form cloning area styles (we hide raw aMember text but keep inputs/buttons styled) */
.ts-form-container {
  margin-top: 15px;
}

.ts-form-container .am-cart-product-status,
.ts-form-container .am-cart-product-qty-label {
  display: none;
}

/* Re-style the aMember Select dropdown */
.ts-form-container .billing-plan-select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
  font-size: 0.9rem;
  background: #f8fafc;
  outline: none;
  cursor: pointer;
}
.ts-form-container .billing-plan-select:focus {
  border-color: var(--primary);
}

/* Quantity input wrapper */
.ts-form-container .am-cart-qty-el {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.ts-form-container .am-cart-qty-el-minus,
.ts-form-container .am-cart-qty-el-plus {
  background: #f1f5f9;
  border: none;
  padding: 5px 12px;
  cursor: pointer;
  font-weight: bold;
  color: var(--text-main);
  transition: background 0.2s;
}
.ts-form-container .am-cart-qty-el-minus:hover,
.ts-form-container .am-cart-qty-el-plus:hover {
  background: #e2e8f0;
}
.ts-form-container .am-cart-qty-el-val {
  border: none;
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  text-align: center;
  width: 40px;
  padding: 5px 0;
  font-size: 0.9rem;
  outline: none;
}

/* Re-style aMember Add Buttons */
.ts-form-container .am-cart-product-content-buttons {
  display: flex;
  gap: 10px;
}
.ts-form-container .am-cart-button-add,
.ts-form-container .am-cart-button-order {
  flex: 1;
  padding: 12px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.ts-form-container .am-cart-product-content-buttons .am-cart-button-add,
.ts-form-container input.am-cart-button-add,
.ts-form-container .am-cart-button-add {
  display: none !important;
}

.ts-form-container .am-cart-button-order {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(0, 166, 126, 0.2);
}
.ts-form-container .am-cart-button-order:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* Missing Results */
.ts-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 16px;
  border: 1px dashed var(--border-light);
  color: var(--text-muted);
}
.ts-no-results i {
  font-size: 3rem;
  margin-bottom: 15px;
  color: #cbd5e1;
}

/* Footer Section */
.ts-footer {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.ts-footer-links {
  display: flex;
  gap: 15px;
}
.ts-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.ts-footer-links a:hover {
  color: var(--primary);
}

@media (max-width: 768px) {
  .ts-hero h1 { font-size: 2rem; }
  .ts-control-bar { flex-direction: column; align-items: stretch; }
  .ts-search { max-width: none; }
  .ts-categories { overflow-x: auto; padding-bottom: 5px; flex-wrap: nowrap; }
  .ts-cat-btn { white-space: nowrap; }
  .ts-trust-bar { justify-content: flex-start; }
}
