/* Custom Styles for Tool Comparison Page */

/* Hero Adjustments */
.tools-hero {
  padding-bottom: 3rem;
  border-bottom: 1px solid #E5E7EB;
}

/* Layout */
.wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.tools-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .tools-container {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Styles */
.tools-sidebar {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid #E5E7EB;
  position: sticky;
  top: 100px;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #E5E7EB;
}

.filter-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #111827;
}

.btn-clear {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0;
}

.btn-clear:hover {
  color: #5C71F0;
  text-decoration: underline;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group h4 {
  font-size: 0.875rem;
  text-transform: uppercase;
  color: #6B7280;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.filter-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.filter-select:focus {
  border-color: #5C71F0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #4B5563;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #5C71F0;
  cursor: pointer;
}

/* Main Content Area */
.tools-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.tools-count {
  font-size: 1.25rem;
  color: #111827;
  margin: 0;
}

.tools-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #4B5563;
}

.tools-sort select {
  width: auto;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.1);
  border-color: #D4D5F4;
}

.tool-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.tool-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.25rem 0;
}

.tool-card-category {
  font-size: 0.75rem;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-free { background: #Dcfce7; color: #166534; }
.badge-freemium { background: #fef3c7; color: #92400e; }
.badge-paid { background: #fee2e2; color: #991b1b; }
.badge-enterprise { background: #e0e7ff; color: #3730a3; }

.tool-card-desc {
  font-size: 0.875rem;
  color: #4B5563;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.tool-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.meta-tag {
  background: #F3F4F6;
  color: #4B5563;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.meta-tag strong {
  color: #111827;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  border-top: 1px solid #E5E7EB;
  padding-top: 1.25rem;
}

.checkbox-compare {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #4B5563;
  cursor: pointer;
  user-select: none;
}

.checkbox-compare input {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: #5C71F0;
  cursor: pointer;
}

/* Comparison Bar */
.comparison-bar {
  position: fixed;
  bottom: -100px;
  left: 0;
  width: 100%;
  background: white;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  transition: bottom 0.3s ease-in-out;
  border-top: 2px solid #5C71F0;
}

.comparison-bar.visible {
  bottom: 0;
}

.comparison-bar-info {
  display: flex;
  flex-direction: column;
}

.comparison-bar-info span {
  font-size: 0.875rem;
  color: #4B5563;
}

.comparison-selected-names {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.compare-tag {
  background: #EEF2FF;
  color: #5C71F0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.compare-tag .remove {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.comparison-bar-actions {
  display: flex;
  gap: 1rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Comparison Modal Table */
.compare-modal-wrapper {
  z-index: 1000;
}

.compare-modal {
  max-width: 1200px !important;
  width: 95vw !important;
  margin: 5vh auto !important;
  display: flex !important;
  flex-direction: column;
  max-height: 90vh !important;
  padding: 1.5rem !important;
  box-sizing: border-box;
  overflow: hidden !important; /* Prevent anything from breaking out of the modal box */
}

.compare-table-container {
  overflow: auto !important; /* Allow both X and Y scrolling */
  flex: 1 1 auto; /* Fill available remaining space */
  min-height: 0; /* Crucial for flex child to allow scrolling instead of overflowing parent */
  width: 100%;
}

.compare-table {
  width: max-content !important; /* Force table to actually be as wide as its content needs */
  border-collapse: collapse;
  margin: 0 auto; /* Center table when there is extra space */
}

.compare-table th,
.compare-table td {
  padding: 1rem;
  border: 1px solid #E5E7EB;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
  white-space: normal;
  min-width: 250px; /* Guarantee readable columns, triggering horizontal scroll */
  max-width: 400px;
}

.compare-table th {
  background: #F9FAFB;
  font-weight: 600;
  color: #111827;
  width: 200px;
}

.compare-table tr:hover td {
  background: #F9FAFB;
}

.compare-table td {
  color: #4B5563;
  font-size: 0.875rem;
}

.compare-table ul {
  margin: 0;
  padding-left: 1.25rem;
}

.compare-table li {
  margin-bottom: 0.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  background: #F9FAFB;
  border-radius: 12px;
  color: #6B7280;
  grid-column: 1 / -1;
}

/* --- ADDED FOR FIXES --- */
#compareModal.active {
  display: block !important;
}

.guidance-icon svg {
  width: 48px;
  height: 48px;
  stroke: #5C71F0;
  margin-bottom: 1rem;
}

.guidance-card {
  padding: 2rem;
  background: white;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  text-align: center;
}

.guidance-card h3 {
  margin-top: 0;
  font-size: 1.25rem;
  color: #111827;
  margin-bottom: 1rem;
}

.guidance-card ul {
  text-align: left;
  list-style-type: none;
  padding: 0;
  color: #4B5563;
  font-size: 0.95rem;
  line-height: 1.6;
}

.guidance-card li {
  margin-bottom: 0.5rem;
  position: relative;
  padding-left: 1.25rem;
}

.guidance-card li::before {
  content: '\2022';
  color: #5C71F0;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.guidance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}
