:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-clean: #e2e8f0;
  --border-focus: #4f46e5;
  
  --accent-indigo: #4f46e5;
  --accent-indigo-light: #818cf8;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --color-green: #10b981;
  --color-green-dark: #069669;
  --color-orange: #f59e0b;
  --color-red: #ef4444;

  --shadow-subtle: 0 4px 6px -1px rgba(15, 23, 42, 0.03), 0 10px 15px -3px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hidden {
  display: none;
}

#loader.hidden, #error-container.hidden, #result-view.hidden {
  display: none !important;
}

/* --- LOADER --- */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 20px;
}

.progress-wrapper {
  width: 100%;
  max-width: 450px;
  background: var(--bg-card);
  border: 1px solid var(--border-clean);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-indigo-light));
  border-radius: 10px;
  transition: width 0.15s linear;
}

.progress-status {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-timer {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- ERROR CARD --- */
.error-card {
  display: flex;
  gap: 24px;
  border-left: 5px solid var(--color-red);
}

.error-icon-wrapper {
  font-size: 2.2rem;
  color: var(--color-red);
  display: flex;
  align-items: flex-start;
}

.error-content h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.error-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.error-tip {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: #991b1b;
}

/* --- RESULT VIEW & GRID --- */
.result-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

/* --- COLUMN 1: PRODUCT CARD --- */
.product-card {
  position: relative;
  overflow: hidden;
}

.product-card .platform-badge {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 6px 16px;
  border-bottom-right-radius: 16px;
  letter-spacing: 0.05em;
  color: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.platform-badge.amazon {
  background: #f97316;
}

.platform-badge.flipkart {
  background: #2563eb;
}

.product-header {
  display: flex;
  gap: 24px;
  margin-top: 15px;
  margin-bottom: 30px;
}

.product-image-container {
  background: #ffffff;
  border: 1px solid var(--border-clean);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

.product-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-essential-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.product-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rating-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.stars {
  color: #f59e0b;
  font-size: 0.9rem;
  display: flex;
  gap: 1px;
}

.rating-value {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 0;
}

/* --- PRICE SECTION --- */
.price-section {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.current-price-wrapper {
  display: flex;
  align-items: baseline;
}

.price-section .currency {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-green-dark);
}

.price-section .price-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--color-green-dark);
  line-height: 1;
}

.original-price-wrapper {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-decoration: line-through;
  font-weight: 500;
}

.discount-badge {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: var(--color-green-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 0;
}

/* --- BUTTONS --- */
.action-buttons {
  display: flex;
  gap: 12px;
}

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--accent-indigo);
  border: none;
  color: white;
  flex: 2;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.btn-primary:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  border: 1px solid var(--border-clean);
  color: var(--text-secondary);
  flex: 1;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

/* --- SPECIFICATIONS --- */
.specs-section h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  border-top: 1px solid var(--border-clean);
  padding-top: 20px;
  color: var(--text-primary);
}

.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 0;
  border: 1px solid #f1f5f9;
  font-size: 0.85rem;
}

.spec-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.spec-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- COLUMN 2: ANALYSIS CARD & GAUGE METER --- */
.analysis-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-clean);
  margin-bottom: 24px;
}

.tab-item {
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition-smooth);
}

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

.meter-wrapper h3, .price-stats-container h3, .history-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.meter-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.gauge-svg {
  width: 70%;
  max-width: 220px;
}

.gauge-needle {
  transform-origin: 100px 90px;
  transform: rotate(0deg); /* Managed via JS (range: -90deg to +90deg) */
  transition: transform 1s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  width: 75%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: -6px;
}

.label-bad {
  color: var(--color-red);
}

.label-good {
  color: var(--color-green-dark);
}

/* --- RECOMMENDATION BOX --- */
.recommendation-box {
  background: #f8fafc;
  border: 1px solid var(--border-clean);
  border-radius: 0;
  padding: 16px;
  text-align: center;
  margin-bottom: 25px;
  transition: var(--transition-smooth);
}

.recommendation-box.border-green {
  border-left: 4px solid var(--color-green);
  background: #f0fdf4;
}

.recommendation-box.border-orange {
  border-left: 4px solid var(--color-orange);
  background: #fffbeb;
}

.recommendation-box.border-red {
  border-left: 4px solid var(--color-red);
  background: #fef2f2;
}

.rec-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

.recommendation-box h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.rec-emerald { color: var(--color-green-dark); }
.rec-orange { color: #d97706; }
.rec-red { color: #dc2626; }

.rec-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- STATS GRID --- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-clean);
  border-radius: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-highest .stat-label i { color: var(--color-red); }
.stat-lowest .stat-label i { color: var(--color-green); }
.stat-optimal .stat-label i { color: var(--accent-indigo); }

.status-badge {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 2px 0;
  display: inline-block;
}

.status-badge.badge-green { color: var(--color-green-dark); }
.status-badge.badge-orange { color: #d97706; }
.status-badge.badge-red { color: #dc2626; }

/* --- PRICE HISTORY CARD --- */
.history-card {
  margin-top: 10px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-clean);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.history-header h3 {
  margin-bottom: 0;
}

.history-filters {
  display: flex;
  background: #f1f5f9;
  border-radius: 0;
  padding: 3px;
  border: 1px solid #e2e8f0;
}

.filter-btn {
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-btn.active {
  background: #ffffff;
  color: var(--accent-indigo);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-container {
  width: 100%;
  height: 280px;
  position: relative;
}

/* --- FOOTER SECTION --- */
.app-footer {
  background-color: #1e1b4b; /* Deep Indigo matching BuyHatke screenshot */
  color: #e2e8f0;
  padding: 60px 20px 30px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  width: 100%;


/* --- CUSTOM PRICE GRAPH DROPDOWN HEADER MENU STYLES --- */
.header-dropdown {
  position: relative;
  display: inline-block;
}
.header-dropdown-btn {
  background: none;
  border: none;
  color: #475569 !important;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}
.header-dropdown-btn:hover {
  color: #4f46e5 !important;
}
.header-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  min-width: 190px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  z-index: 1000;
  padding: 8px 0;
}
.header-dropdown:hover .header-dropdown-content {
  display: block;
}
.header-dropdown-content a {
  color: #1e293b !important;
  padding: 10px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: left;
}
.header-dropdown-content a:hover {
  background-color: #f1f5f9;
  color: #4f46e5 !important;
}
.indian-flag-icon {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 1px;
}


/* --- RESPONSIVE HEADER OVERRIDES --- */
.mobile-header {
  display: flex !important;
}

.desktop-header {
  display: none !important;
}

@media (min-width: 768px) {
  .mobile-header {
    display: none !important;
  }
  .desktop-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
  }
}
