:root {
  --primary-light: #e8f5e9;
  --primary-medium: #a5d6a7;
  --primary-dark: #66bb6a;
  --primary-darker: #43a047;
  --primary-darkest: #2e7d32;
  --secondary-color: #5a6b7c;
  --accent-color: #ff7043;
  --light-bg: #f5f9f6;
  --dark-text: #212529;
  --light-text: #f8fafc;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--light-bg);
  color: var(--dark-text);
  line-height: 1.6;
}

@supports (font-variation-settings: normal) {
  body {
    font-family: "Inter var", -apple-system, BlinkMacSystemFont, sans-serif;
  }
}

.sidebar {
  background-color: white;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 15px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sidebar h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--primary-darkest);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.test-card {
  background-color: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.test-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-hover-shadow);
}

.image-container {
  position: relative;
  height: 150px;
  overflow: hidden;
}

.test-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%; /* 50% = horizontal center, 20% = push crop downward */
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: var(--transition);
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.4;
}

.image-container:hover .image-overlay {
  opacity: 0.8;
}

.image-container:hover .test-image {
  filter: brightness(0.7);
}

.test-info {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.test-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--dark-text);
  font-size: 1.1rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%; /* or any specific limit like 80%, 300px, etc. */
}

.test-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-item i {
  color: var(--primary-darker);
}

.test-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: nowrap;
  overflow: hidden;
}

/* Default: no truncation for all tags */
.test-tag {
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  background-color: var(--primary-light);
  color: var(--primary-darkest);
  white-space: nowrap;
  /* Remove these from default, so tags show full */
  overflow: visible;
  text-overflow: clip;
  max-width: none;
}

/* Truncate only the second tag */
.test-tag:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%; /* Or any desired width */
}

.test-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

.btn-start {
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--primary-darker) 100%
  );
  color: white;
  width: 100%;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  border-radius: 8px;
  transition: var(--transition);
  border: none;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(87, 204, 153, 0.3);
}

.btn-solution {
  background: linear-gradient(
    135deg,
    var(--primary-medium) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  width: 100%;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  border-radius: 8px;
  transition: var(--transition);
  border: none;
}

.btn-solution:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(128, 237, 153, 0.3);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-option label {
  font-size: 0.9rem;
  margin-bottom: 0;
  cursor: pointer;
  color: var(--secondary-color);
}

.search-container {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary-color);
}

.search-input {
  padding-left: 40px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  height: 42px;
  font-size: 0.9rem;
  transition: var(--transition);
  width: 100%;
}

.search-input:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(87, 204, 153, 0.2);
}

.sort-select {
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  border: 1px solid #e2e8f0;
  background-color: white;
  color: var(--secondary-color);
  transition: var(--transition);
  font-size: 0.9rem;
  height: 42px;
  min-width: 200px;
}

.sort-select:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(87, 204, 153, 0.2);
}

.section-title {
  text-align: center;
  margin-bottom: 1.5rem;
}

.section-title h2 {
  color: var(--primary-darkest);
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 2rem;
}

.section-title p {
  color: var(--secondary-color);
  font-size: 1.1rem;
  max-width: 700px;
  margin: 0 auto;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  background-color: white;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  display: none;
}

.no-results i {
  font-size: 3rem;
  color: #cbd5e0;
  margin-bottom: 1rem;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  color: var(--secondary-color);
}

.category-item:hover,
.category-item.active {
  background-color: var(--primary-light);
  color: var(--primary-darkest);
  font-weight: 500;
}

.category-item i {
  width: 20px;
  text-align: center;
  color: var(--primary-darker);
}

.category-count {
  margin-left: auto;
  background-color: var(--primary-medium);
  color: var(--primary-darkest);
  border-radius: 12px;
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.page-item {
  margin: 0 0.25rem;
}

.page-link {
  color: var(--primary-darkest);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  min-width: 40px;
  text-align: center;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-link:hover {
  background-color: var(--primary-light);
  border-color: #cbd5e0;
}

.page-item.active .page-link {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

.reset-filters-btn {
  background: linear-gradient(135deg, #db332d 0%, #f3a98e 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  width: 100%;
  justify-content: center;
  margin-top: 0.75rem;
}

.reset-filters-btn:hover {
  background: linear-gradient(135deg, #00e676 0%, #c8e6c9 100%);
  box-shadow: 0 6px 16px rgba(0, 230, 118, 0.6),
    inset 0 0 12px rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background-color: white;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-label {
  font-weight: 500;
  color: var(--primary-darkest);
  white-space: nowrap;
}

.form-check-input:checked {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.form-check-input:focus {
  box-shadow: 0 0 0 0.25rem rgba(87, 204, 153, 0.25);
}

.overlay-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.question-stats {
  flex-grow: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.481); /* white line at the bottom */
}

.question-stats h5 {
  font-size: 16px; /* Slightly bigger for heading */
  margin-bottom: 0.3rem;
  color: whitesmoke;
}

.question-stats div {
  font-size: 13px; /* Smaller for the question types */
}

.sharing-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.sharing-buttons a {
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  text-decoration: none; /* Removes underline from links */
  transition: transform 0.3s ease;
}

.sharing-buttons a[href*="whatsapp"] {
  background-color: #25d366;
}
.sharing-buttons a[href*="facebook"] {
  background-color: #1877f2;
}
.sharing-buttons a[href*="twitter"] {
  background-color: #1da1f2;
}
.sharing-buttons a[href*="instagram"] {
  background: radial-gradient(
    circle at 30% 30%,
    #fdf497,
    #fd5949,
    #d6249f,
    #285aeb
  );
}

.sharing-buttons a:hover {
  transform: scale(1.1);
  opacity: 0.9;
}

.mobile-filter-toggle {
  display: none;
  margin-bottom: 1rem;
  width: 100%;
  background: #43a047;
}

@media (max-width: 1200px) {
  .test-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .test-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 768px) {
  .test-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .sidebar {
    position: static;
  }

  .mobile-filter-toggle {
    display: block;
  }

  #sidebarCollapse {
    display: none;
  }

  #sidebarCollapse.show {
    display: block;
  }
}

.upper-container {
  max-width: 85%;
  margin: 20px auto;
  padding: 20px;
  background: #f8fdf8;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.08);
  border: 1px solid #e4f3e4;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.main-header i {
  font-size: 26px;
  color: #4caf50;
}

.main-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: #2e7d32;
  margin: 0;
  line-height: 1.3;
}

.main-container p {
  color: #4caf50;
  font-size: 16px;
  margin: 0;
  line-height: 1.5;
}
