/**
 * Feature Comparison Widget Styles
 * 
 * File: assets/css/style.css
 */

/* Wrapper */
.fc-wrapper {
  max-width: 100%;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  margin: 0 auto;
}

/* Header */
.fc-header {
  background: linear-gradient(90deg, #8b5cf6 0%, #ec4899 100%);
  padding: 30px 40px;
  border-radius: 12px 12px 0 0;
}

.fc-header-title {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
}

.fc-header-subtitle {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

/* Table */
.fc-table {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

/* Rows */
.fc-row {
  display: grid;
  /* Use a CSS variable to define number of value columns. The layout will be:
     first column (feature name) = 2fr, then N columns each 1fr. JS sets --fc-value-columns. */
  grid-template-columns: 2fr repeat(var(--fc-value-columns, 2), 1fr);
  gap: 0;
  align-items: stretch;
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 0.2s ease;
}

.fc-row:last-child {
  border-bottom: none;
}

/* Header Row */
.fc-header-row {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.fc-column-header {
  padding: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-right: 1px solid #e5e7eb;
}

.fc-column-header:last-child {
  border-right: none;
}

.fc-column-header.fc-first-column {
  text-align: left;
  justify-content: flex-start;
}

.fc-column-header.fc-highlight {
  color: #8b5cf6;
  font-weight: 700;
}

.fc-column-icon {
  font-size: 18px;
  display: inline-flex;
  align-items: center;
}

/* Category Row */
.fc-category-row {
  background: #fafafa;
  /* Make category row span full width by using a single-column grid and full-width cell */
  grid-template-columns: 1fr;
}

.fc-category-cell {
  padding: 16px 20px;
  grid-column: 1 / -1;
}

.fc-category {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #8b5cf6;
  padding-left: 12px;
  border-left: 3px solid #8b5cf6;
}

/* Feature Row */
.fc-feature-row {
  background: #ffffff;
  transition: background-color 0.15s ease;
}

.fc-feature-row:hover {
  background: #f9fafb;
}

.fc-feature-cell {
  padding: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  border-right: 1px solid #f3f4f6;
}

.fc-feature-cell:last-child {
  border-right: none;
}

.fc-feature-name {
  color: #374151;
  font-weight: 400;
  text-align: left;
  justify-content: flex-start;
}

.fc-feature-value {
  color: #6b7280;
  justify-content: center;
  text-align: center;
}

/* Check Icon Wrapper */
.fc-check-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.fc-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d1fae5;
  color: #10b981;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

/* Badge */
.fc-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #ede9fe;
  color: #7c3aed;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  white-space: nowrap;
}

/* Icon Value */
.fc-icon-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .fc-row {
    grid-template-columns: 1.5fr repeat(auto-fit, minmax(120px, 1fr));
  }

  .fc-header {
    padding: 24px 30px;
  }

  .fc-header-title {
    font-size: 20px;
  }

  .fc-feature-cell,
  .fc-column-header {
    padding: 16px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .fc-wrapper {
    border-radius: 8px;
  }

  .fc-header {
    padding: 20px 24px;
    border-radius: 8px 8px 0 0;
  }

  .fc-header-title {
    font-size: 18px;
  }

  .fc-header-subtitle {
    font-size: 13px;
  }

  .fc-table {
    border-radius: 0 0 8px 8px;
  }

  /* Stack on mobile */
  .fc-row {
    grid-template-columns: 1fr;
  }

  .fc-column-header,
  .fc-feature-cell {
    padding: 14px 20px;
    border-right: none;
    border-bottom: 1px solid #f3f4f6;
  }

  .fc-column-header {
    background: #f3f4f6;
    font-weight: 700;
  }

  .fc-feature-cell {
    justify-content: space-between;
  }

  .fc-feature-name {
    font-weight: 500;
  }

  /* Add labels for mobile */
  .fc-feature-value::before {
    content: attr(data-label);
    font-weight: 600;
    color: #374151;
    margin-right: 8px;
  }

  .fc-header-row {
    display: none;
  }
}

@media (max-width: 480px) {
  .fc-header {
    padding: 16px 20px;
  }

  .fc-header-title {
    font-size: 16px;
  }

  .fc-header-subtitle {
    font-size: 12px;
  }

  .fc-feature-cell,
  .fc-column-header {
    padding: 12px 16px;
    font-size: 12px;
  }

  .fc-badge {
    font-size: 11px;
    padding: 3px 10px;
  }

  .fc-check-icon {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }
}

/* Print Styles */
@media print {
  .fc-wrapper {
    box-shadow: none;
    border: 1px solid #000;
  }

  .fc-feature-row:hover {
    background: #ffffff;
  }

  .fc-header {
    background: #8b5cf6 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* RTL Support */
[dir="rtl"] .fc-category {
  padding-left: 0;
  padding-right: 12px;
  border-left: none;
  border-right: 3px solid #8b5cf6;
}

[dir="rtl"] .fc-column-header.fc-first-column {
  text-align: right;
}

[dir="rtl"] .fc-feature-name {
  text-align: right;
}

/* Accessibility */
.fc-wrapper:focus-within {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

.fc-feature-row:focus-within {
  background: #f0f9ff;
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fc-feature-row {
  animation: fadeIn 0.3s ease forwards;
}

.fc-feature-row:nth-child(1) {
  animation-delay: 0.05s;
}
.fc-feature-row:nth-child(2) {
  animation-delay: 0.1s;
}
.fc-feature-row:nth-child(3) {
  animation-delay: 0.15s;
}
.fc-feature-row:nth-child(4) {
  animation-delay: 0.2s;
}
.fc-feature-row:nth-child(5) {
  animation-delay: 0.25s;
}

/* Loading State */
.fc-wrapper.fc-loading {
  opacity: 0.6;
  pointer-events: none;
}

.fc-wrapper.fc-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
