/* 
 * QuickCompare.shop - Global CSS
 * Premium Vanilla CSS Redesign
 */

:root {
  /* Brand Colors */
  --color-primary: #4f46e5;      /* Indigo 600 */
  --color-primary-hover: #4338ca; /* Indigo 700 */
  --color-primary-light: #e0e7ff; /* Indigo 100 */
  
  --color-secondary: #0ea5e9;    /* Sky 500 */
  --color-accent: #f43f5e;       /* Rose 500 */
  
  /* Neutral Colors (Light Theme) */
  --color-bg-main: #f8fafc;      /* Slate 50 */
  --color-bg-card: #ffffff;      /* White */
  --color-text-main: #0f172a;    /* Slate 900 */
  --color-text-muted: #64748b;   /* Slate 500 */
  --color-border: #e2e8f0;       /* Slate 200 */

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-premium: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.01);
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Layout */
  --container-max-width: 1200px;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

/* Dark Theme overrides */
html.dark:root {
  --color-bg-main: #0f172a;      /* Slate 900 */
  --color-bg-card: #1e293b;      /* Slate 800 */
  --color-text-main: #f8fafc;    /* Slate 50 */
  --color-text-muted: #94a3b8;   /* Slate 400 */
  --color-border: #334155;       /* Slate 700 */
  
  --color-primary: #6366f1;      /* Indigo 500 */
  --color-primary-hover: #818cf8; /* Indigo 400 */
  --color-primary-light: #3730a3; /* Indigo 800 */

  --shadow-premium: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Base Reset & Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  color: var(--color-text-main);
  background-color: var(--color-bg-main);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, textarea {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-4 { grid-column: span 4 / span 4; }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  
  .md\:col-span-1 { grid-column: span 1 / span 1; }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:col-span-3 { grid-column: span 3 / span 3; }
  .md\:col-span-4 { grid-column: span 4 / span 4; }
  
  .container { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  
  .lg\:col-span-1 { grid-column: span 1 / span 1; }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:col-span-3 { grid-column: span 3 / span 3; }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:col-span-5 { grid-column: span 5 / span 5; }
}

.text-center { text-align: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Header & Glassmorphism */
.header-main {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: all 0.3s ease;
}

html.dark .header-main {
  background-color: rgba(15, 23, 42, 0.8);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

html.dark .brand-icon {
  background: rgba(99, 102, 241, 0.2);
}

.brand-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-text-main);
}

.brand-text span {
  color: var(--color-primary);
}

.nav-links {
  display: none;
  align-items: center;
  gap: 2rem;
  font-family: var(--font-heading);
  font-weight: 600;
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

.nav-link {
  position: relative;
  color: var(--color-text-muted);
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.2s ease;
}

.nav-link:hover::after {
  width: 100%;
}

.theme-toggle-btn {
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background-color: var(--color-border);
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.theme-toggle-btn:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

/* Page Loader */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 99999;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease, opacity 0.3s ease;
  pointer-events: none;
}
#page-loader.loading { transform: scaleX(0.85); }
#page-loader.finish { transform: scaleX(1) !important; opacity: 0; }

/* Product Cards */
.product-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-premium);
  border-color: var(--color-primary-light);
}

.product-image-container {
  position: relative;
  height: 200px;
  padding: 1.5rem;
  background-color: #ffffff; /* keep white for product images */
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

html.dark .product-image-container {
  background-color: rgba(255, 255, 255, 0.02);
}

.product-image-container img {
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.product-card:hover .product-image-container img {
  transform: scale(1.05);
}

.product-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-brand {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.product-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 1rem;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card:hover .product-title {
  color: var(--color-primary);
}

/* Footer */
.footer-main {
  background-color: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  padding: 4rem 0 2rem 0;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  gap: 3rem;
}

@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
}

.footer-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-text-main);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--color-primary);
}

.footer-bottom {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* Responsive Utilities */
.hidden { display: none !important; }
@media (min-width: 768px) {
  .md\:hidden { display: none !important; }
}

/* Form Elements */
.input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-bg-card);
  color: var(--color-text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Content Area */
.main-content {
  flex: 1;
}

/* Helpers */
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-8 { margin-top: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }

.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-text-muted); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }

/* Mobile Menu */
.mobile-menu-btn {
  display: block;
  padding: 0.5rem;
  color: var(--color-text-main);
  background: transparent;
  border: none;
  cursor: pointer;
}

@media (min-width: 768px) {
  .mobile-menu-btn { display: none; }
}

#mobile-menu {
  display: none;
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-top: 1px solid var(--color-border);
}

#mobile-menu.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#mobile-menu a {
  font-weight: 600;
  padding: 0.5rem 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}
.pagination a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.pagination span.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
