/* ==========================================
   ASINWATCH Product Detail — Light Mode (Sync with keepa.html)
   ========================================== */

.detail-page-main {
  padding: 24px;
  background-color: var(--bg-primary); /* Sync with main.css */
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  align-items: center; /* Center the boxed content */
}

/* --- Control Panel (Search Bar) --- */
.detail-control-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 1100px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-sm);
}

.detail-content-boxed {
  width: 100%;
  max-width: 1100px;
}

/* --- Grid Layout --- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.detail-grid__left, .detail-grid__right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Shared Card Style --- */
.detail-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.detail-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.detail-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.detail-card-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* ============================================================
   Overview Hero Card & Redesigned Analytics Layout
   ============================================================ */

.overview-card {
  display: flex;
  gap: 24px;
  align-items: stretch;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), box-shadow var(--transition);
}

.overview-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 102, 0, 0.12);
}

/* Image section */
.overview-image-section {
  flex: 0 0 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.overview-image-box {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
}

.overview-image-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.overview-image-box img:hover {
  transform: scale(1.08);
}

.market-badge-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background-color: var(--accent);
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-align: center;
  box-shadow: 0 2px 6px rgba(255, 102, 0, 0.2);
}

/* Info section */
.overview-info-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.overview-title-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-meta-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.meta-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.brand-badge {
  color: var(--accent);
  background-color: rgba(255, 102, 0, 0.06);
  border-color: rgba(255, 102, 0, 0.2);
}

.category-badge {
  color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.2);
}

.manufacturer-badge {
  color: #6366f1;
  background-color: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.2);
}

.asin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 20px;
}

.asin-badge .asin-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 700;
}

.asin-badge .asin-value {
  font-size: 0.82rem;
  font-weight: 800;
  font-family: monospace;
  color: #1e293b;
}

.asin-badge .copy-asin-btn {
  color: #94a3b8;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.asin-badge .copy-asin-btn:hover {
  color: var(--accent);
}

.overview-actions-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.amazon-direct-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-weight: 700;
  border-radius: 100px !important; /* Pill-shaped like Amazon buy box */
  background: #ffd814 !important; /* Amazon gold background */
  border: 1px solid #fcd200 !important;
  color: #0f1111 !important; /* Amazon dark text color */
  box-shadow: 0 2px 5px rgba(213, 170, 0, 0.3) !important;
  transition: transform var(--transition), background-color var(--transition), box-shadow var(--transition);
}

.amazon-direct-btn:hover {
  background: #f7ca00 !important; /* Amazon hover state */
  border-color: #f2b700 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(213, 170, 0, 0.4) !important;
  color: #0f1111 !important;
}

.affiliate-notice-box {
  font-size: 0.76rem;
  color: var(--text-muted);
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* KPIs section */
.overview-kpis-section {
  flex: 0 0 280px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  border-left: 1px solid var(--border);
  padding-left: 24px;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  transition: border-color var(--transition);
}

.kpi-item:hover {
  border-color: var(--accent);
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.live-price-kpi .kpi-value {
  font-size: 1.25rem;
}

/* --- ROI Calculator Card --- */
.calculator-card {
  display: flex;
  flex-direction: column;
}

.calc-body {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.calc-inputs-panel {
  display: flex;
  flex-direction: column;
}

.fee-breakdown {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.fee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 2px 0;
  transition: background-color 0.15s;
}

.fee-row:hover {
  background-color: rgba(255, 102, 0, 0.02);
}

.fee-label {
  color: var(--text-muted);
  font-weight: 500;
}

.fee-value {
  color: var(--text-primary);
  font-weight: 600;
}

.fee-row--bold .fee-label {
  color: var(--text-primary);
  font-weight: 700;
}

.fee-row--bold .fee-value {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 800;
}

.calc-results-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.roi-gauge-container {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--bg-primary) 78%, transparent 79% 100%),
              conic-gradient(var(--accent) 0%, var(--border) 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  transition: background 0.3s ease;
}

.roi-gauge-value-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.roi-percent {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.roi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.profit-box {
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  width: 100%;
  box-shadow: var(--shadow-sm);
}

/* --- Tabbed Intelligence Card --- */
.intelligence-card {
  padding: 20px;
}

.tabs-header {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--accent);
  background-color: rgba(255, 102, 0, 0.03);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

/* Tab 1: Specs Grid Override */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: border-color var(--transition);
}

.spec-item:hover {
  border-color: var(--accent);
}

.spec-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.spec-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Tab 2: Features Bullet Points */
.features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.features-list li {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  padding-left: 24px;
  position: relative;
}

.features-list li::before {
  content: "\f058"; /* check circle */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--success);
  font-size: 0.9rem;
}

/* Tab 3: Competitor Offers Table */
.offers-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.offers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.offers-table th {
  background-color: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
}

.offers-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.offers-table tr:last-child td {
  border-bottom: none;
}

.offers-table tr:hover {
  background-color: rgba(255, 102, 0, 0.02);
}

.offers-table .prime-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #00a8e8;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Overrides */
@media (max-width: 990px) {
  .overview-card {
    flex-direction: column;
    gap: 20px;
  }
  .overview-image-section {
    flex: 0 0 auto;
    width: 100%;
    align-items: center;
  }
  .overview-kpis-section {
    flex: 0 0 auto;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 20px;
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .calc-body {
    grid-template-columns: 1fr;
  }
  .overview-kpis-section {
    grid-template-columns: repeat(2, 1fr);
  }
  .specs-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Search Bar Prominence --- */
#detail-asin-search {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

#detail-asin-search:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(255, 102, 0, 0.15), inset 0 2px 4px rgba(0,0,0,0.03) !important;
  background-color: #ffffff !important;
}

#detail-search-btn {
  box-shadow: 0 2px 6px rgba(255, 102, 0, 0.2);
}

#detail-search-btn:hover {
  background-color: #e05500 !important; /* Slightly darker orange */
  transform: scale(1.02);
}

#detail-search-btn:active {
  transform: scale(0.98);
}
