// Card Customizations - SDGA Custom Enhancements
// Following Bootstrap 5.3 recommended practices

// ============================================
// CARD ICON VARIANTS - Using Sass map and @each loop
// ============================================



// ============================================
// EXPANDABLE CARD
// ============================================

.card-expandable {
  cursor: pointer;
  border: 1px solid $gray-200 !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;

  &:hover:not(.disabled),
  &.card-expandable-hover {
    background-color: $gray-50;
  }

  .form-check-input:focus {
    box-shadow: none;
    border-color: $gray-300;
  }

  &.disabled {
    background-color: $gray-100;
    cursor: not-allowed;
    pointer-events: none;

    .dga-featured-icon {
      background-color: $gray-200;

      svg, i {
        fill: $gray-400;
        color: $gray-400;
        stroke: $gray-400;
      }
    }

    .card-subtitle,
    .card-text {
      color: $gray-400 !important;
    }

    .card-expanded-icon {
      color: $gray-400;
    }

    .form-check-input {
      border-color: $gray-300;
      background-color: $gray-200;
    }
  }
}

// ============================================
// SELECT CARD (checkbox selection)
// ============================================

.card-select {
  cursor: pointer;
  border: 1px solid $gray-200 !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;

  .form-check-input:focus {
    box-shadow: none;
    border-color: $gray-300;
  }

  &:hover:not(.disabled),
  &.card-select-hover {
    background-color: $gray-50;
  }

  &.disabled {
    background-color: $gray-100;
    cursor: not-allowed;
    pointer-events: none;

    .dga-featured-icon {
      background-color: $gray-200;

      svg, i {
        fill: $gray-400;
        color: $gray-400;
        stroke: $gray-400;
      }
    }

    .card-subtitle,
    .card-text {
      color: $gray-400 !important;
    }

    .form-check-input {
      border-color: $gray-300;
      background-color: $gray-200;
    }
  }
}

// ============================================
// SELECTABLE CARD
// ============================================

.card-selectable {
  cursor: pointer;
  border: 1px solid $gray-200 !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;

  .card-selectable-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: $radius-full;
    background-color: $primary-50;
    color: $primary;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
  }

  .card-title {
    margin-bottom: 0.25rem;
  }

  .form-check-input:focus {
    box-shadow: none;
    border-color: $gray-300;
  }

  &:hover:not(.disabled),
  &.card-selectable-hover {
    background-color: $gray-50;
  }

  &:focus-visible,
  &.card-selectable-focused {
    outline: none;
    border-color: $gray-900 !important;
    box-shadow: 0 0 0 1px $gray-900 !important;
  }

  &.disabled {
    background-color: $gray-100;
    cursor: not-allowed;
    pointer-events: none;

    .card-selectable-icon {
      background-color: $gray-200;
      color: $gray-400;
    }

    .card-title {
      color: $gray-400;
    }

    .card-text {
      color: $gray-400 !important;
    }

    .form-check-input {
      border-color: $gray-300;
      background-color: $gray-200;
    }
  }
}

// ============================================
// CARD BASE STYLES
// ============================================

.card {
  transition: transform 0.3s ease;
  width: 100%;

  &:focus-visible {
    border-radius: $radius-lg !important;
  }

  &.expanded {
    .card-expanded-icon {
      transform: rotate(180deg);
    }
  }
  .card-expanded-content {
    animation: slideDown 0.3s ease-out;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px) scaleY(0);
      transform-origin: top;
    }
    to {
      opacity: 1;
      transform: translateY(0) scaleY(1);
      transform-origin: top;
    }
  }

  .card-title {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  
  &.disabled {
    background-color: $gray-200;
    cursor: not-allowed;
  }

  .card-title-checked {
    margin-inline-start: auto;
    margin-inline-end: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
  }

  .card-text {
    margin: 0;
  }

  .card-footer {
    margin-top: auto;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-start;

    // Footer variants
    &.card-footer-center {
      justify-content: center;
    }

    &.card-footer-start {
      justify-content: flex-start;
    }

    &.card-footer-between {
      justify-content: space-between;
    }

    .card-expanded-icon {
      margin-inline-start: auto;
      cursor: pointer;
      transition: transform 0.3s ease;

      &:hover {
        opacity: 0.7;
      }
    }
  }
}