/**
 * CRM Comparison Tool - Styles
 * Matches the Plan Digital Now theme design system
 *
 * @package PlanDigitalNow
 * @since 2.5.0
 */

/* ==========================================================================
   Tool Container
   ========================================================================== */

.pdn-crm-tool {
  font-family: var(--pdn-font-primary);
  color: var(--pdn-text);
}

/* ==========================================================================
   Header
   ========================================================================== */

.pdn-crm-tool__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.pdn-crm-tool__title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  color: var(--pdn-accent);
  margin: 0 0 8px 0;
}

.pdn-crm-tool__subtitle {
  font-size: 16px;
  color: var(--pdn-text-secondary);
  margin: 0;
}

.pdn-crm-tool__meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pdn-crm-tool__time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--pdn-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--pdn-text-secondary);
}

.pdn-crm-tool__time i {
  color: var(--pdn-primary);
}

/* Language Selector */
.pdn-crm-lang {
  display: flex;
  gap: 6px;
}

.pdn-crm-lang__btn {
  padding: 8px 14px;
  border: 1px solid var(--pdn-border);
  background: var(--pdn-white);
  color: var(--pdn-text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdn-crm-lang__btn:hover {
  border-color: var(--pdn-primary);
  color: var(--pdn-primary);
}

.pdn-crm-lang__btn.active {
  background: var(--pdn-primary);
  border-color: var(--pdn-primary);
  color: var(--pdn-white);
}

/* ==========================================================================
   Filters
   ========================================================================== */

.pdn-crm-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: var(--pdn-light);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .pdn-crm-filters {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .pdn-crm-filters {
    grid-template-columns: 1fr;
  }
}

.pdn-crm-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pdn-crm-filter__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--pdn-text);
}

.pdn-crm-filter__select {
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--pdn-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--pdn-text);
  background: var(--pdn-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23525252' d='M5 7L0 2h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease;
}

.pdn-crm-filter__select:hover,
.pdn-crm-filter__select:focus {
  border-color: var(--pdn-primary);
  outline: none;
}

/* Results count */
.pdn-crm-results {
  font-size: 14px;
  color: var(--pdn-text-secondary);
  margin-bottom: 20px;
}

.pdn-crm-results strong {
  color: var(--pdn-text);
}

/* ==========================================================================
   CRM Grid
   ========================================================================== */

.pdn-crm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

@media (max-width: 1200px) {
  .pdn-crm-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .pdn-crm-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   CRM Card - matches .pdn-card styling
   ========================================================================== */

.pdn-crm-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pdn-crm-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.pdn-crm-card--selected {
  box-shadow: 0 0 0 2px var(--pdn-primary), 0 8px 30px rgba(0, 91, 187, 0.15);
}

/* Card Header */
.pdn-crm-card__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.pdn-crm-card__logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdn-crm-card__logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.pdn-crm-card__title {
  flex: 1;
  min-width: 0;
}

.pdn-crm-card__title h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 4px;
  line-height: 1.3;
}

.pdn-crm-card__tagline {
  font-size: 13px;
  color: var(--pdn-text-secondary);
  margin: 0;
}

/* Pricing */
.pdn-crm-card__pricing {
  background: var(--pdn-light);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}

.pdn-crm-card__price-free {
  font-size: 18px;
  font-weight: 700;
  color: var(--pdn-success);
}

.pdn-crm-card__price-paid {
  font-size: 13px;
  color: var(--pdn-text-secondary);
  margin-top: 4px;
}

.pdn-crm-card__price-main {
  font-size: 18px;
  font-weight: 700;
  color: var(--pdn-accent);
}

.pdn-crm-card__price-user {
  font-size: 13px;
  color: var(--pdn-text-secondary);
  margin-top: 4px;
}

.pdn-crm-card__trial {
  display: inline-block;
  font-size: 12px;
  color: var(--pdn-primary);
  margin-top: 8px;
}

/* Ratings */
.pdn-crm-card__ratings {
  margin-bottom: 16px;
}

.pdn-crm-card__rating-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.pdn-crm-card__rating-item:last-child {
  margin-bottom: 0;
}

.pdn-crm-card__rating-item > span:first-child {
  font-size: 13px;
  color: var(--pdn-text-secondary);
  min-width: 120px;
  flex-shrink: 0;
}

.pdn-crm-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.pdn-crm-rating__bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.pdn-crm-rating__fill {
  height: 100%;
  background: var(--pdn-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Rating color coding */
.pdn-crm-rating--high .pdn-crm-rating__fill {
  background: var(--pdn-success);
}

.pdn-crm-rating--medium .pdn-crm-rating__fill {
  background: #f59e0b;
}

.pdn-crm-rating--low .pdn-crm-rating__fill {
  background: #ef4444;
}

.pdn-crm-rating--high .pdn-crm-rating__value {
  color: var(--pdn-success);
}

.pdn-crm-rating--medium .pdn-crm-rating__value {
  color: #d97706;
}

.pdn-crm-rating--low .pdn-crm-rating__value {
  color: #dc2626;
}

.pdn-crm-rating__value {
  font-size: 12px;
  font-weight: 600;
  color: var(--pdn-text);
  min-width: 32px;
  text-align: right;
}

/* Description */
.pdn-crm-card__description {
  font-size: 14px;
  color: var(--pdn-text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
}

/* Badges */
.pdn-crm-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.pdn-crm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--pdn-light);
  color: var(--pdn-text-secondary);
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
}

.pdn-crm-badge--success {
  background: rgba(30, 107, 39, 0.1);
  color: var(--pdn-success);
}

/* Card Footer */
.pdn-crm-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--pdn-border);
  margin-top: auto;
}

.pdn-crm-card__select {
  padding: 10px 16px;
  background: var(--pdn-light);
  border: 1px solid var(--pdn-border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pdn-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdn-crm-card__select:hover:not(:disabled) {
  border-color: var(--pdn-primary);
  color: var(--pdn-primary);
}

.pdn-crm-card__select--active {
  background: var(--pdn-primary);
  border-color: var(--pdn-primary);
  color: var(--pdn-white);
}

.pdn-crm-card__select--active:hover {
  background: var(--pdn-primary-dark);
  color: var(--pdn-white);
}

.pdn-crm-card__select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pdn-crm-card__link {
  font-size: 13px;
  font-weight: 500;
  color: var(--pdn-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.pdn-crm-card__link:hover {
  color: var(--pdn-primary-dark);
}

/* ==========================================================================
   Comparison Bar (Fixed)
   ========================================================================== */

.pdn-crm-compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--pdn-accent);
  color: var(--pdn-white);
  padding: 14px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.pdn-crm-compare-bar.visible {
  transform: translateY(0);
}

.pdn-crm-compare-bar__text {
  font-size: 14px;
}

.pdn-crm-compare-bar__btn {
  padding: 10px 20px;
  background: var(--pdn-white);
  color: var(--pdn-accent);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdn-crm-compare-bar__btn:hover {
  background: var(--pdn-light);
}

.pdn-crm-compare-bar__btn--secondary {
  background: transparent;
  color: var(--pdn-white);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.pdn-crm-compare-bar__btn--secondary:hover {
  border-color: var(--pdn-white);
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
  .pdn-crm-compare-bar {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }
}

/* ==========================================================================
   Comparison Table
   ========================================================================== */

.pdn-crm-comparison {
  background: var(--pdn-white);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 40px;
}

.pdn-crm-comparison__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--pdn-light);
  border-bottom: 1px solid var(--pdn-border);
}

.pdn-crm-comparison__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--pdn-accent);
  margin: 0;
}

.pdn-crm-comparison__close {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--pdn-border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--pdn-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdn-crm-comparison__close:hover {
  border-color: var(--pdn-text);
  color: var(--pdn-text);
}

.pdn-crm-comparison__wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pdn-crm-comparison__table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.pdn-crm-comparison__table th,
.pdn-crm-comparison__table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--pdn-border);
  vertical-align: middle;
  font-size: 14px;
}

.pdn-crm-comparison__table th:first-child,
.pdn-crm-comparison__table td:first-child {
  width: 160px;
  background: var(--pdn-light);
  font-weight: 500;
  color: var(--pdn-text-secondary);
  position: sticky;
  left: 0;
}

.pdn-crm-comparison__table thead th {
  background: var(--pdn-white);
  font-weight: 600;
  color: var(--pdn-accent);
  text-align: center;
}

.pdn-crm-comparison__table thead th:first-child {
  background: var(--pdn-light);
}

.pdn-crm-comparison__table tbody td {
  text-align: center;
}

.pdn-crm-comparison__table tbody td:first-child {
  text-align: left;
}

.pdn-crm-comparison__table tbody tr:last-child td {
  border-bottom: none;
}

.pdn-crm-comparison__best {
  background: rgba(30, 107, 39, 0.05);
}

.pdn-crm-comparison__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pdn-crm-comparison__logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.pdn-crm-comparison__logo span {
  font-size: 13px;
  font-weight: 600;
}

.pdn-check {
  color: var(--pdn-success);
  font-size: 16px;
}

.pdn-cross {
  color: var(--pdn-gray-light);
  font-size: 16px;
}

/* ==========================================================================
   Comparison Details Section
   ========================================================================== */

.pdn-crm-comparison__details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 24px;
  background: var(--pdn-light);
  border-top: 1px solid var(--pdn-border);
}

.pdn-crm-comparison__detail {
  background: var(--pdn-white);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pdn-crm-comparison__detail h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--pdn-accent);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--pdn-border);
}

.pdn-crm-comparison__pros,
.pdn-crm-comparison__cons {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.pdn-crm-comparison__pros > strong,
.pdn-crm-comparison__cons > strong {
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  width: 20px;
  line-height: 1.4;
}

.pdn-crm-comparison__pros ul,
.pdn-crm-comparison__cons ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pdn-crm-comparison__pros li,
.pdn-crm-comparison__cons li {
  font-size: 13px;
  color: var(--pdn-text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.pdn-crm-comparison__pros li:last-child,
.pdn-crm-comparison__cons li:last-child {
  margin-bottom: 0;
}

.pdn-crm-comparison__bestfor {
  font-size: 13px;
  color: var(--pdn-text);
  margin: 16px 0 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--pdn-border);
}

.pdn-crm-comparison__bestfor strong {
  color: var(--pdn-primary);
}

@media (max-width: 768px) {
  .pdn-crm-comparison__details {
    grid-template-columns: 1fr;
    padding: 16px;
  }
}

/* ==========================================================================
   CTA Section
   ========================================================================== */

.pdn-crm-cta {
  background: linear-gradient(135deg, var(--pdn-accent) 0%, var(--pdn-primary) 100%);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  color: var(--pdn-white);
  margin-bottom: 32px;
}

.pdn-crm-cta__title {
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 700;
  color: var(--pdn-white);
  margin: 0 0 12px 0;
}

.pdn-crm-cta__text {
  font-size: 16px;
  opacity: 0.9;
  margin: 0 0 20px 0;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.pdn-crm-cta__btn {
  display: inline-block;
  padding: 14px 28px;
  background: var(--pdn-white);
  color: var(--pdn-accent);
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.pdn-crm-cta__btn {
  border: none;
  cursor: pointer;
}

.pdn-crm-cta__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  color: var(--pdn-accent);
}

.pdn-crm-cta__trust {
  font-size: 13px;
  opacity: 0.8;
  margin: 16px 0 0 0;
}

@media (max-width: 600px) {
  .pdn-crm-cta {
    padding: 28px 20px;
  }
}

/* ==========================================================================
   Disclaimer
   ========================================================================== */

.pdn-crm-disclaimer {
  font-size: 12px;
  color: var(--pdn-text-secondary);
  line-height: 1.6;
  padding: 16px;
  background: var(--pdn-light);
  border-radius: 8px;
}

.pdn-crm-disclaimer a {
  color: var(--pdn-primary);
}

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */

.pdn-crm-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px;
}

.pdn-crm-loading__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--pdn-light);
  border-top-color: var(--pdn-primary);
  border-radius: 50%;
  animation: pdn-crm-spin 0.8s linear infinite;
}

@keyframes pdn-crm-spin {
  to { transform: rotate(360deg); }
}

.pdn-crm-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--pdn-text-secondary);
}

.pdn-crm-empty__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--pdn-text);
  margin: 0 0 8px;
}

.pdn-crm-empty__text {
  margin: 0;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.pdn-crm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles */
.pdn-crm-tool button:focus-visible,
.pdn-crm-tool select:focus-visible,
.pdn-crm-tool a:focus-visible {
  outline: 2px solid var(--pdn-primary);
  outline-offset: 2px;
}

/* Print */
@media print {
  .pdn-crm-compare-bar,
  .pdn-crm-lang,
  .pdn-crm-card__footer,
  .pdn-crm-cta {
    display: none !important;
  }

  .pdn-crm-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
}
