Newer
Older
vmk-ui-kit / src / scss / components / _cards.scss
/* =========================
   Cards
========================= */

@use "../kit-deps" as *;

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: $neutral-0;
  border: 1px solid $neutral-200;
  border-radius: $radius-xl;
  overflow: hidden;
  transition:
    box-shadow $motion-base $motion-ease,
    border-color $motion-base $motion-ease;

  &:hover {
    border-color: $neutral-300;
  }

  .card-title {
    padding: $space-4 $space-5;
    font-size: 18px;
    font-weight: $font-weight-bold;
    color: $neutral-900;
    border-bottom: 1px solid $neutral-100;
  }

  .card-content {
    flex: 1;
    padding: $space-5;
    color: $neutral-800;
    font-size: 15px;
    line-height: 1.5;
  }

  .card-footer {
    display: flex;
    align-items: center;
    gap: $space-3;
    padding: $space-3 $space-5;
    border-top: 1px solid $neutral-100;
    background-color: $neutral-50;
  }

  // Variants
  &.card-filled {
    background-color: $neutral-50;
    border-color: $neutral-100;
  }

  &.card-outlined {
    background-color: transparent;
    border-color: $neutral-400;
  }

  &.card-primary {
    border-color: $neutral-900;
    background-color: $neutral-900;
    color: $neutral-25;

    .card-title,
    .card-content { color: $neutral-25; }
  }

  &.card-secondary {
    border-color: $mint-300;
    background-color: $mint-300;
  }

  &.card-elevated {
    box-shadow: 0 4px 24px rgba($neutral-900, 0.08);
    border-color: transparent;
  }

  // Sizes
  &.card-sm {
    border-radius: $radius-md;

    .card-title { padding: $space-3 $space-4; font-size: 16px; }
    .card-content { padding: $space-4; }
    .card-footer { padding: $space-2 $space-4; }
  }

  &.card-lg {
    border-radius: $radius-xl;

    .card-title { padding: $space-5 $space-6; font-size: 20px; }
    .card-content { padding: $space-6; }
    .card-footer { padding: $space-4 $space-6; }
  }

  // Action card layout
  &.action-card {
    .action-card-kicker {
      display: block;
      margin-bottom: $space-2;
      font-size: 12px;
      font-weight: $font-weight-semibold;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: $neutral-500;
    }

    .action-card-title {
      margin: 0 0 $space-2;
      font-size: 20px;
      font-weight: $font-weight-bold;
      color: $neutral-900;
    }

    .action-card-text {
      margin: 0 0 $space-4;
      color: $neutral-700;
      font-size: 15px;
      line-height: 1.5;
    }

    .action-card-actions {
      display: flex;
      align-items: center;
      gap: $space-3;
    }
  }

  // Status card
  &.status-card {
    max-width: 220px;
    overflow: hidden;

    .status-icon-container {
      position: relative;

      .status-icon {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        font-size: $icon-size-display;
        height: 108px;
        width: 100%;
        color: $neutral-500;
      }
    }

    .card-title {
      display: flex;
      width: 100%;
      align-items: center;
      justify-content: space-between;
      font-size: $font-size-lg;
      font-weight: $font-weight-bold;
      text-transform: none;
      border-bottom: 0;
    }

    .status-name {
      margin: 0;
      font-size: $font-size-sm;
      line-height: $line-height-normal;
      color: $neutral-700;
    }

    &.card-success { @include state_panel($success-text); .status-icon { color: $success-text; } }
    &.card-warning { @include state_panel($warning-text); .status-icon { color: $warning-text; } }
    &.card-info    { @include state_panel($lavender-600); .status-icon { color: $lavender-600; } }
    &.card-secondary { @include state_panel($mint-600); .status-icon { color: $mint-600; } }
    &.card-danger,
    &.card-error   { @include state_panel($danger-text); .status-icon { color: $danger-text; } }
  }

  // Metric card
  &.metric-card {
    max-width: 320px;
    border-color: $border-color-muted;

    .card-content {
      display: flex;
      flex-direction: column;
      gap: $space-4;
    }

    .metric-card-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: $space-3;
    }

    .metric-card-label {
      margin: 0;
      color: $neutral-500;
      font-size: $font-size-sm;
      font-weight: $font-weight-semibold;
      text-transform: uppercase;
    }

    .metric-card-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: $control-height-md;
      height: $control-height-md;
      color: $neutral-0;
      background: $mint-600;
      font-size: $icon-size-md;
      border-radius: $radius-md;
    }

    .metric-card-value {
      margin: 0;
      color: $neutral-900;
      font-size: $font-size-h2;
      font-weight: $font-weight-bold;
      line-height: $line-height-tight;
    }

    .metric-card-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: $space-2;
      color: $neutral-500;
      font-size: $font-size-sm;
    }

    .metric-card-delta {
      color: $success-text;
      font-weight: $font-weight-bold;

      &.metric-card-delta-negative {
        color: $danger-text;
      }
    }
  }

  // Horizontal card
  &.card-horizontal {
    max-width: none;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;

    .card-media {
      flex: 0 0 20%;
      align-self: stretch;
      min-width: 80px;
      max-width: 160px;
      min-height: 100%;
      overflow: hidden;
      position: relative;
      background: $neutral-100;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
      }
    }

    .card-body {
      flex: 1 1 auto;
      display: flex;
      flex-direction: column;
      padding: $space-4;
      gap: $space-3;
    }

    .card-title {
      padding: 0;
      background: transparent;
      color: $neutral-900;
      font-size: $font-size-lg;
      font-weight: $font-weight-bold;
      text-transform: none;
      line-height: $line-height-snug;
      border-bottom: 0;

      a {
        color: inherit;
        text-decoration: none;

        @include hover_touch {
          text-decoration: underline;
        }
      }
    }

    .card-content {
      padding: 0;
      height: auto;

      p { margin: 0; }
    }

    .card-footer {
      padding: 0;
      background: transparent;
      border-top: 0;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: $space-3;
      color: $neutral-500;
      font-size: $font-size-sm;
    }
  }

  // Login card
  &.login-card {
    max-width: 100%;
    width: 460px;
    border-color: $neutral-900;

    .login-card-header {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: $space-3;
    }

    .login-card-logo {
      display: block;
      width: auto;
      max-height: 40px;
    }

    .login-card-logo-icon {
      font-size: $icon-size-display;
      color: $neutral-900;
    }

    .login-card-title {
      font-size: $font-size-xl;
      font-weight: $font-weight-bold;
      text-transform: uppercase;
    }

    .login-card-form {
      display: flex;
      flex-direction: column;
      gap: $space-4;
    }

    .login-card-submit {
      min-height: 48px;
      padding: $space-3 $space-5;
      font-size: 15px;
      width: max-content;
      margin-top: $space-2;
    }

    .form-group { margin-bottom: 0; }

    .login-card-links {
      display: flex;
      justify-content: space-between;
      gap: $space-3;
      margin-top: $space-2;
      font-size: $font-size-sm;
    }

    .login-card-link {
      color: $neutral-500;
      text-decoration: none;

      @include hover_touch {
        color: $neutral-900;
        text-decoration: underline;
      }
    }

    .login-card-error { margin-bottom: $space-2; }
  }

  // User card
  &.user-card {
    max-width: 320px;

    .user-card-body {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: $space-4;
      padding: $space-5;
      text-align: center;
    }

    .identity {
      flex-direction: column;
      align-items: center;
      gap: $space-4;

      .avatar {
        width: 64px;
        height: 64px;
        font-size: $font-size-xl;
      }

      .identity-content {
        align-items: center;
        text-align: center;
      }
    }

    .user-card-role {
      color: $neutral-500;
      font-size: $font-size-sm;
      margin-top: $space-1;
    }

    .user-card-actions {
      display: flex;
      gap: $space-2;
    }
  }

  &.user-card-compact {
    max-width: none;

    .user-card-body {
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      padding: $space-3 $space-4;
      text-align: left;
    }

    .identity {
      flex-direction: row;
      gap: $space-3;

      .avatar {
        width: 38px;
        height: 38px;
        font-size: $font-size-sm;
      }

      .identity-content {
        align-items: flex-start;
      }
    }

    .user-card-actions {
      display: flex;
      gap: $space-1;

      .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
      }
    }
  }
}