/**
 * Tool Card Component Styles
 * 
 * @package AFEL
 */

/*--------------------------------------------------------------
# Tool Card Layout
--------------------------------------------------------------*/
.afel-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.afel-tool-card {
  border: 1px solid var(--afel-border-color);
  border-radius: 6px;
  overflow: hidden;
  transition: all var(--afel-transition-normal) ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.afel-tool-card__inner {
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/*--------------------------------------------------------------
# Tool Card Header
--------------------------------------------------------------*/
.afel-tool-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  position: relative;
}

.afel-tool-name-and-label {
  display: flex;
  gap: 4px;
  width: 100%;
}

.afel-tool-card__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  width: fit-content;
  max-width: fit-content;
}

.afel-tool-card__title a {
  color: var(--afel-primary-text-color);
  text-decoration: none;
}

.afel-tool-card__title a:hover {
  color: var(--afel-brand-color);
  text-decoration: none;
}

.afel-verified-label,
.afel-dark-mode .afel-verified-label {
  color: var(--afel-brand-color);
  border-radius: 0 4px 0 4px;
  font-size: 0.75rem;
  font-weight: 500;
  align-items: center;
}

.afel-tool-card__title svg.afel-verified-label {
  width: 14px;
  height: 14px;
  margin-bottom: 16px;
}

/* .afel-tool-card__save {
  flex-shrink: 0;
} */

/*--------------------------------------------------------------
# Favorite Button Styles
--------------------------------------------------------------*/
button.afel-favorite-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px;
  margin-top: -6px;
  background: var(--afel-body-bg);
  border: none;
  border-radius: 6px;
  color: var(--afel-secondary-text-color);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--afel-transition-normal) ease;
  text-decoration: none;
}

.afel-favorite-tool-btn:hover {
  border-color: var(--afel-brand-color);
  color: var(--afel-brand-color);
  background: var(--afel-brand-color-bg);
  text-decoration: none;
}

.afel-favorite-tool-btn.is-favorite {
  color: var(--afel-secondary-text-color);
}

.afel-favorite-tool-btn.is-favorite:hover {
  border-color: var(--afel-border-color);
  color: var(--afel-border-color);
}

.afel-favorite-tool-btn:disabled,
.afel-favorite-tool-btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

.afel-favorite-tool-btn .afel-favorite-icon {
  display: flex;
  align-items: center;
}

.afel-favorite-tool-btn .afel-favorite-icon svg {
  width: 20px;
  height: 20px;
}

/*--------------------------------------------------------------
# Tool Card Content
--------------------------------------------------------------*/
.afel-tool-card__price-type,
.afel-tool-price-type {
  font-size: 0.875rem;
  font-weight: 500;
}

.afel-tool-card__price-type[data-price-type="Free"],
.afel-tool-price-type[data-price-type="Free"] {
  color: var(--color-free-700);
  font-size: 14px;
}

.afel-tool-card__price-type[data-price-type="Freemium"],
.afel-tool-price-type[data-price-type="Freemium"] {
  color: var(--color-freemium-700);
  font-size: 14px;
}

.afel-tool-card__price-type[data-price-type="Free Trial"],
.afel-tool-price-type[data-price-type="Free Trial"] {
  color: var(--color-freetrial-700);
  font-size: 14px;
}

.afel-tool-card__price-type[data-price-type="Paid"],
.afel-tool-price-type[data-price-type="Paid"] {
  color: var(--color-paid-700);
  font-size: 14px;
}

.afel-tool-card__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  max-height: 30px;
  overflow: hidden;
}

.afel-tool-category-badge {
  display: inline-block;
  padding: 4px 10px;
  background-color: var(--afel-light-bg);
  color: var(--afel-secondary-text-color);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--afel-transition-normal) ease;
}

.afel-tool-category-badge.afel-tool-category-badge-main:hover {
  background-color: var(--afel-brand-color);
  color: #fff;
  text-decoration: none;
}

.afel-tool-card__description {
  margin: 0 0 16px 0;
  color: var(--afel-primary-text-color);
  font-size: 0.875rem;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3; /* Add this - use a tighter line-height */
  max-height: calc(
    1.2em * 2
  ); /* Add this - ensure max height matches exactly 2 lines */
}

/*--------------------------------------------------------------
# Tool Card Footer
--------------------------------------------------------------*/
.afel-tool-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--afel-border-color);
}

.afel-tool-card__rating {
  display: flex;
  align-items: center;
  gap: 2px;
}

.afel-star {
  font-size: 1rem;
  color: var(--afel-border-color);
  transition: color var(--afel-transition-normal) ease;
}

.afel-star.afel-filled {
  color: var(--color-rating-star);
}

.afel-star.afel-partial {
  background: linear-gradient(
    90deg,
    var(--color-rating-star) var(--fill-percentage, 0%),
    var(--afel-border-color) var(--fill-percentage, 0%)
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--color-rating-star);
}

.afel-star.afel-empty {
  color: var(--afel-border-color);
}

.afel-tool-card__visit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background-color: var(--afel-brand-color);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--afel-transition-normal) ease;
}

.afel-tool-card__visit-link:hover {
  background-color: var(--afel-secondary-color);
  border-color: var(--afel-secondary-color);
  color: #fff;
  text-decoration: none;
}

.afel-tool-card__visit-link svg {
  width: 14px;
  height: 14px;
}

/*--------------------------------------------------------------
# Clear Favorites Button
--------------------------------------------------------------*/
.afel-dashboard-tab__header button.afel-clear-favorites {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--afel-error-text);
  border-color: var(--afel-error-text);
  background-color: var(--afel-body-bg);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--afel-transition-normal) ease;
  text-decoration: none;
  font-size: 0.875rem;
}

.afel-dashboard-tab__header button.afel-clear-favorites:hover {
  color: var(--afel-brand-color);
  border-color: var(--afel-brand-color);
  background-color: var(--afel-body-bg);
}

.afel-clear-favorites:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.afel-clear-favorites svg {
  width: 16px;
  height: 16px;
}

/*--------------------------------------------------------------
# Responsive Design
--------------------------------------------------------------*/
@media (max-width: 1024px) {
  .afel-tools-grid {
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .afel-tool-card__inner {
    padding: 16px;
  }
}

/* Loading animation for clear button */
.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.afel-favorite-tool-btn {
  transition: all 0.2s ease;
}

.afel-favorite-tool-btn:hover {
  transform: scale(1.05);
}

.afel-favorite-tool-btn.processing {
  pointer-events: none;
}
