/* ================================
   WORLD-CLASS CARD COMPONENT
   Apple / Stripe / Linear Quality
=================================== */

.card {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  transform: translateZ(0);
  will-change: transform, box-shadow;
  display: flex;
  flex-direction: column;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
}

/* ================================
   Card Hover Effects
=================================== */

.card-hover:hover {
  border-color: rgba(var(--primary-rgb), 0.1);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.08),
    0 8px 16px rgba(0, 0, 0, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.02);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  border-color: rgba(var(--primary-rgb), 0.15);
}

/* ================================
   Card Variants
=================================== */

.card-default {
  /* Default styling already applied */
}

.card-elevated {
  box-shadow: var(--shadow-lg);
  border: none;
}

.card-elevated:hover {
  box-shadow: var(--shadow-2xl);
}

.card-outline {
  background: transparent;
  border: 2px solid var(--border-primary);
  box-shadow: none;
}

.card-outline:hover {
  border-color: rgba(var(--primary-rgb), 0.3);
  background: rgba(var(--primary-rgb), 0.02);
}

.card-glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-gradient {
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.05) 0%,
    rgba(var(--primary-rgb), 0.02) 100%
  );
  border: 1px solid rgba(var(--primary-rgb), 0.1);
}

/* ================================
   Card Sizes
=================================== */

.card-xs {
  border-radius: var(--radius-lg);
}

.card-sm {
  border-radius: var(--radius-xl);
}

.card-md {
  border-radius: var(--radius-2xl);
}

.card-lg {
  border-radius: var(--radius-3xl);
}

.card-xl {
  border-radius: var(--radius-3xl);
}

/* ================================
   Card Backgrounds
=================================== */

.card-bg-primary {
  background: linear-gradient(
    135deg,
    var(--primary-500) 0%,
    var(--primary-600) 100%
  );
  color: white;
  border-color: var(--primary-600);
}

.card-bg-accent {
  background: linear-gradient(
    135deg,
    var(--accent-500) 0%,
    var(--accent-600) 100%
  );
  color: white;
  border-color: var(--accent-600);
}

.card-bg-success {
  background: linear-gradient(
    135deg,
    var(--success-500) 0%,
    var(--success-600) 100%
  );
  color: white;
  border-color: var(--success-600);
}

.card-bg-danger {
  background: linear-gradient(
    135deg,
    var(--error-500) 0%,
    var(--error-600) 100%
  );
  color: white;
  border-color: var(--error-600);
}

/* ================================
   Card Modifiers
=================================== */

.card-no-padding .card-header,
.card-no-padding .card-body,
.card-no-padding .card-footer {
  padding: 0;
}

.card-no-shadow {
  box-shadow: none;
}

.card-no-border {
  border: none;
}

/* ================================
   Card Components
=================================== */

.card-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-primary);
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.02) 0%,
    transparent 100%
  );
}

.card-body {
  padding: var(--space-6);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card__actions {
  margin-top: auto;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.card-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--border-primary);
  background: rgba(var(--gray-50), 0.5);
  margin-top: auto;
}

.card-title {
  margin: 0 0 var(--space-3) 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  line-height: var(--line-height-snug);
}

.card-description {
  margin: 0 0 var(--space-4) 0;
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  font-size: var(--font-size-base);
}

.card-image {
  position: relative;
  overflow: hidden;
  margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) var(--space-4) calc(-1 * var(--space-6));
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-hover:hover .card-image img {
  transform: scale(1.05);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.1) 0%,
    rgba(var(--primary-rgb), 0.05) 100%
  );
  border-radius: var(--radius-2xl);
  margin-bottom: var(--space-4);
  font-size: 24px;
  color: var(--primary-600);
  border: 1px solid rgba(var(--primary-rgb), 0.1);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-hover:hover .card-icon {
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.15) 0%,
    rgba(var(--primary-rgb), 0.08) 100%
  );
  transform: scale(1.1) rotate(5deg);
  border-color: rgba(var(--primary-rgb), 0.2);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-600);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-full);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  margin-bottom: var(--space-3);
}

.card-badge-success {
  background: rgba(5, 150, 105, 0.1);
  color: var(--success-600);
  border-color: rgba(5, 150, 105, 0.2);
}

.card-badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-600);
  border-color: rgba(245, 158, 11, 0.2);
}

.card-badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-600);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ================================
   Service Card Variant
=================================== */

.card-service {
  text-align: center;
  border: 2px solid var(--border-primary);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-service::before {
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-500),
    var(--primary-600),
    var(--primary-700)
  );
}

.card-service:hover {
  border-color: rgba(var(--primary-rgb), 0.3);
  transform: translateY(-8px);
}

.service-features {
  list-style: none;
  margin: var(--space-6) 0;
  padding: 0;
  text-align: left;
}

.service-features li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.feature-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: linear-gradient(
    135deg,
    var(--success-500),
    var(--success-600)
  );
  color: white;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.service-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-1);
  margin: var(--space-6) 0;
  padding: var(--space-4);
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.05) 0%,
    rgba(var(--primary-rgb), 0.02) 100%
  );
  border-radius: var(--radius-xl);
  border: 1px solid rgba(var(--primary-rgb), 0.1);
}

.price-currency {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.price-amount {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary-600);
}

.price-period {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

/* ================================
   Feature Card Variant
=================================== */

.card-feature {
  text-align: center;
  padding: var(--space-8);
  border: 1px solid var(--border-primary);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(248, 250, 252, 0.6) 100%
  );
}

.card-feature:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.8) 100%
  );
}

.card-feature .card-icon {
  margin: 0 auto var(--space-6);
  width: 72px;
  height: 72px;
  font-size: 28px;
}

/* ================================
   Testimonial Card Variant
=================================== */

.card-testimonial {
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.02) 0%,
    rgba(var(--primary-rgb), 0.01) 100%
  );
  border: 1px solid rgba(var(--primary-rgb), 0.1);
}

.testimonial-rating {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  justify-content: center;
}

.star {
  font-size: 16px;
  transition: all 0.2s ease;
}

.star-filled {
  opacity: 1;
}

.star-empty {
  opacity: 0.3;
}

.testimonial-quote {
  font-size: var(--font-size-lg);
  font-style: italic;
  color: var(--text-primary);
  margin: 0 0 var(--space-6) 0;
  line-height: var(--line-height-relaxed);
  position: relative;
}

.testimonial-quote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: -20px;
  font-size: 48px;
  color: rgba(var(--primary-rgb), 0.2);
  font-family: serif;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid rgba(var(--primary-rgb), 0.1);
}

.author-info {
  flex: 1;
  text-align: left;
}

.author-name {
  display: block;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  font-style: normal;
  margin-bottom: var(--space-1);
}

.author-role {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ================================
   Stats Card Variant
=================================== */

.card-stats {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(248, 250, 252, 0.8) 100%
  );
  border: 1px solid rgba(var(--primary-rgb), 0.1);
  text-align: center;
}

.card-stats:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.9) 100%
  );
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.stats-value {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary-600);
  line-height: 1;
}

.stats-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-2);
}

.stats-trend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.stats-trend-up {
  color: var(--success-600);
}

.stats-trend-down {
  color: var(--error-600);
}

.trend-arrow {
  font-size: 16px;
}

/* ================================
   Card Responsive Design
=================================== */

@media (max-width: 768px) {
  .card-header,
  .card-body,
  .card-footer {
    padding: var(--space-4);
  }

  .card-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-2);
  }

  .card-icon {
    width: 56px;
    height: 56px;
    font-size: 20px;
    margin-bottom: var(--space-3);
  }

  .card-feature {
    padding: var(--space-6);
  }

  .service-price {
    margin: var(--space-4) 0;
    padding: var(--space-3);
  }

  .price-amount {
    font-size: var(--font-size-3xl);
  }

  .stats-value {
    font-size: var(--font-size-3xl);
  }
}

@media (max-width: 480px) {
  .card-header,
  .card-body,
  .card-footer {
    padding: var(--space-3);
  }

  .card-title {
    font-size: var(--font-size-base);
  }

  .card-description {
    font-size: var(--font-size-sm);
  }

  .card-icon {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .testimonial-author {
    flex-direction: column;
    text-align: center;
    gap: var(--space-2);
  }

  .author-info {
    text-align: center;
  }

  .stats-value {
    font-size: var(--font-size-2xl);
  }
}

/* ================================
   Accessibility & Performance
=================================== */

@media (prefers-reduced-motion: reduce) {
  .card,
  .card-icon,
  .card-image img {
    transition: none !important;
    animation: none !important;
  }

  .card-hover:hover {
    transform: none !important;
  }
}

@media (prefers-contrast: high) {
  .card {
    border-width: 2px;
    border-color: var(--gray-600);
  }

  .card-icon {
    border-width: 2px;
  }

  .card-badge {
    border-width: 2px;
  }
}

/* Focus visible for better keyboard navigation */
.card:focus-visible {
  outline: 3px solid rgba(var(--primary-rgb), 0.5);
  outline-offset: 2px;
}

/* Performance optimizations */
.card {
  transform: translateZ(0);
}

.card * {
  transform: translateZ(0);
}