/* ==========================================================================
   CSS Reset, Custom Properties & Base Styles
   Design Style: Professional, Human-designed, Clean, High-Contrast Light Theme
   Informed by G2 & Housecall Pro Visual Hierarchy
   ========================================================================== */

:root {
  --bg-primary: #f1f5f9; /* Softer slate grey background to reduce glare */
  --bg-surface: #ffffff; /* Crisp white panels */
  --bg-surface-alt: #e2e8f0; /* Darker slate for header/alt backgrounds */
  
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --border-color-active: #818cf8;
  
  /* Primary brand colors - Royal Blue / Indigo */
  --primary: #4f46e5;
  --primary-hover: #3730a3;
  --primary-light: #eeebff;
  
  /* Accent States (High Trust) */
  --accent-green: #059669;
  --accent-green-bg: #ecfdf5;
  --accent-green-border: rgba(16, 185, 129, 0.2);
  
  --accent-red: #dc2626;
  --accent-red-bg: #fef2f2;
  --accent-red-border: rgba(239, 68, 68, 0.2);
  
  --accent-orange: #d97706;
  --accent-orange-bg: #fffbeb;
  --accent-orange-border: rgba(245, 158, 11, 0.2);
  
  /* Typography Scale */
  --text-main: #334155;
  --text-title: #0f172a;
  --text-muted: #64748b;
  
  --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-heading: 'Outfit', sans-serif;
  
  /* UI Tokens */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-drawer: -10px 0 30px rgba(15, 23, 42, 0.08);
  
  --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family-body);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Hide background glows from prior dark theme to maintain clean light theme */
.glow-bg {
  display: none !important;
}

/* App Container Layout */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Area (Similar to G2 Header spacing) */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.6rem;
}

.logo-text {
  font-family: var(--font-family-heading);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-title);
}

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

.trust-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  box-shadow: var(--shadow-sm);
}

.badge-icon {
  font-size: 1rem;
}

.badge-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 3rem auto;
}

.hero-title {
  font-family: var(--font-family-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-title);
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.8px;
}

.hero-subtitle {
  font-size: 1.3rem; /* Distinctly larger font size */
  font-weight: 700;  /* Bold font weight to stand out */
  color: var(--text-title);
  line-height: 1.4;
}

.hero-description {
  font-size: 0.95rem; /* Standard body description text size */
  color: var(--text-muted); /* Soft slate grey color */
  line-height: 1.7;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  
  /* Visual divider line to split the two sections clearly */
  border-top: 1px solid var(--border-color); 
  margin-top: 2rem; 
  padding-top: 1.5rem;
}

/* Controls / Filters Panel */
.controls-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.search-bar-wrapper {
  position: relative;
  margin-bottom: 1.25rem;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

#search-input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  color: var(--text-title);
  font-family: var(--font-family-body);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

#search-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.filters-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}

.filter-chip:hover {
  background-color: var(--bg-surface-alt);
  border-color: var(--border-color-hover);
}

.checkbox-input {
  display: none;
}

.checkbox-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

/* Checked styling */
.filter-chip:has(.checkbox-input:checked) {
  background-color: var(--primary-light);
  border-color: var(--border-color-active);
}

.filter-chip:has(.checkbox-input:checked) .checkbox-label {
  color: var(--primary);
}

.dropdown-wrapper {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.select-input {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-title);
  padding: 0.45rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.select-input:focus {
  border-color: var(--primary);
}

/* Results Metadata Section */
.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.5rem 1rem 0.5rem;
}

.counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.reset-button {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.reset-button:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Comparison Matrix Table (G2-Style Crisp Card Table) */
.matrix-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 3rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.matrix-table th {
  background-color: var(--bg-surface-alt);
  padding: 1rem 1.25rem;
  color: var(--text-title);
  font-weight: 700;
  font-family: var(--font-family-heading);
  letter-spacing: 0.2px;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--border-color);
}

.matrix-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition-smooth);
}

.matrix-table th.sortable:hover {
  background-color: #e2e8f0;
}

.sort-indicator {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.75rem;
}

.matrix-table td {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-main);
  transition: var(--transition-smooth);
}

.matrix-table tbody tr {
  transition: var(--transition-smooth);
}

.matrix-table tbody tr:nth-child(even) {
  background-color: rgba(248, 250, 252, 0.5); /* Subtle zebra striping for scannability */
}

.matrix-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* Table Text Formats */
.row-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-title);
  font-family: var(--font-family-heading);
}

.row-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-title);
}

.row-trial {
  font-weight: 500;
  color: var(--text-main);
}

/* Checkmark Badges - High Contrast & Simple */
.badge-check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.65rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-check.yes {
  background-color: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid var(--accent-green-border);
}

.badge-check.no {
  background-color: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red-border);
}

.badge-check.partial {
  background-color: var(--accent-orange-bg);
  color: var(--accent-orange);
  border: 1px solid var(--accent-orange-border);
}

/* Actions Button - Clean & Sharp (Like Housecall Pro buttons) */
.btn-details {
  background-color: #ffffff;
  border: 1px solid var(--primary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
  text-align: center;
}

.btn-details:hover {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: var(--font-family-heading);
  font-size: 1.25rem;
  color: var(--text-title);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  font-family: var(--font-family-heading);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

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

/* Sliding Specs Panel Drawer (Clean light theme) */
.details-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  transition: visibility 0.25s;
}

.details-drawer.open {
  visibility: visible;
}

.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s;
}

.details-drawer.open .drawer-overlay {
  opacity: 1;
}

.drawer-content {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100%;
  background-color: #ffffff;
  border-left: 1px solid var(--border-color);
  padding: 3rem 2.5rem;
  overflow-y: auto;
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.details-drawer.open .drawer-content {
  transform: translateX(0);
}

.close-drawer {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-drawer:hover {
  background-color: var(--bg-surface-alt);
  color: var(--text-title);
}

/* Detail Drawer Components (Clean & Structured) */
.drawer-title {
  font-family: var(--font-family-heading);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-title);
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.drawer-subtitle {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
}

.drawer-description {
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.drawer-section-title {
  font-family: var(--font-family-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.drawer-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
  border-radius: var(--border-radius-sm);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.metric-val {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-title);
}

/* Expanded Checklist inside Drawer */
.features-checklist {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.check-bullet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.check-bullet.yes {
  background-color: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid var(--accent-green-border);
}

.check-bullet.no {
  background-color: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red-border);
}

.check-info {
  display: flex;
  flex-direction: column;
}

.check-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-title);
}

.check-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Detail CTA */
.drawer-cta {
  display: block;
  width: 100%;
  text-align: center;
  background-color: var(--primary);
  color: #ffffff;
  padding: 1rem;
  border-radius: var(--border-radius-md);
  font-weight: 700;
  text-decoration: none;
  font-family: var(--font-family-heading);
  transition: var(--transition-smooth);
}

.drawer-cta:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Footer Section */
.app-footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.data-sync-tag {
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 0.15rem;
}

.footer-right {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.footer-link:hover {
  color: var(--text-title);
  text-decoration: underline;
}

/* Responsive Viewports */
@media (max-width: 900px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .filters-grid {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dropdown-wrapper {
    margin-left: 0;
    justify-content: space-between;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
  }
  
  .select-input {
    width: 50%;
  }
}

@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .trust-badge {
    align-self: stretch;
    justify-content: center;
  }
  
  .app-footer {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .footer-right {
    justify-content: center;
  }
}
