@use '../variables' as v;
@use '../mixins' as m;

// ─────────────────────────────────────────────
// Base card
// ─────────────────────────────────────────────
.card {
  @include m.card-base;
  overflow: hidden;
}

.card-header {
  @include m.flex-between;
  padding: 16px 20px;
  border-bottom: 1px solid v.$border-color;
  gap: 12px;

  h3, .card-title {
    font-size: v.$font-size-base;
    font-weight: 600;
    color: v.$gray-800;
  }

  p, .card-subtitle {
    font-size: v.$font-size-xs;
    color: v.$gray-500;
    margin-top: 2px;
  }
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid v.$border-color;
  background: v.$gray-50;
  @include m.flex-between;
  gap: 10px;
}

// ─────────────────────────────────────────────
// Stat card
// ─────────────────────────────────────────────
.stat-card {
  @include m.card-base;
  padding: 20px;
  transition: box-shadow v.$transition-base;

  &:hover { box-shadow: v.$shadow; }
}

.stat-card-header {
  @include m.flex-between;
  margin-bottom: 12px;
}

.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: v.$radius;
  @include m.flex-center;

  svg { width: 18px; height: 18px; }

  &--primary  { background: v.$primary-light;  color: v.$primary;  }
  &--success  { background: v.$success-light;  color: v.$success;  }
  &--warning  { background: v.$warning-light;  color: v.$warning;  }
  &--info     { background: v.$info-light;     color: v.$info;     }
  &--danger   { background: v.$danger-light;   color: v.$danger;   }
}

.stat-card-label {
  font-size: v.$font-size-xs;
  font-weight: 500;
  color: v.$gray-500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: v.$font-size-3xl;
  font-weight: 700;
  color: v.$gray-900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card-meta {
  @include m.flex-start;
  gap: 8px;
  margin-top: 10px;
  font-size: v.$font-size-xs;
  color: v.$gray-500;
}

.stat-card-progress {
  margin-top: 14px;

  &-bar {
    height: 4px;
    background: v.$gray-100;
    border-radius: v.$radius-full;
    overflow: hidden;
    margin-bottom: 6px;

    &-fill {
      height: 100%;
      background: v.$primary;
      border-radius: v.$radius-full;
      transition: width v.$transition-slower;
    }
  }

  &-labels {
    @include m.flex-between;
    font-size: v.$font-size-xs;
    color: v.$gray-400;
  }
}

// ─────────────────────────────────────────────
// Metric card (small 4-up row)
// ─────────────────────────────────────────────
.metric-card {
  @include m.card-base;
  padding: 16px 20px;
  position: relative;
  overflow: visible;

  &-label {
    font-size: v.$font-size-xs;
    color: v.$gray-500;
    margin-bottom: 6px;
    @include m.flex-between;
  }

  &-value {
    font-size: 28px;
    font-weight: 700;
    color: v.$gray-900;
    letter-spacing: -0.02em;
    line-height: 1;
  }

  &-sub {
    font-size: v.$font-size-xs;
    color: v.$gray-400;
    margin-top: 4px;
  }

  &-sparkline {
    position: absolute;
    right: 12px;
    bottom: 10px;
    width: 72px;
    height: 32px;
    opacity: 0.6;
  }
}

// ─────────────────────────────────────────────
// Feature promo card (e.g. welcome banner)
// ─────────────────────────────────────────────
.promo-card {
  @include m.card-base;
  padding: 28px 32px;
  @include m.flex-between;
  gap: 24px;
  overflow: visible;

  &-content { max-width: 480px; }

  h2 {
    font-size: v.$font-size-2xl;
    font-weight: 700;
    color: v.$gray-900;
    margin-bottom: 8px;
  }

  p {
    font-size: v.$font-size-sm;
    color: v.$gray-500;
    line-height: 1.6;
    margin-bottom: 20px;
  }

  &-actions {
    @include m.flex-start;
    gap: 10px;
    flex-wrap: wrap;
  }

  &-illustration {
    flex-shrink: 0;
    width: 140px;
    opacity: 0.9;

    @include m.max-md { display: none; }
  }
}

// ─────────────────────────────────────────────
// Info grid cards (3-up quick-action)
// ─────────────────────────────────────────────
.info-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;

  @include m.max-md { grid-template-columns: 1fr; }
}

.info-card {
  @include m.card-base;
  padding: 18px 20px;
  @include m.flex-start;
  gap: 14px;
  transition: box-shadow v.$transition-base, border-color v.$transition-base;
  cursor: pointer;
  text-decoration: none;
  color: inherit;

  &:hover {
    border-color: v.$primary-border;
    box-shadow: v.$shadow;
    text-decoration: none;
    color: inherit;
  }

  &-icon {
    width: 40px;
    height: 40px;
    background: v.$gray-100;
    border-radius: v.$radius;
    @include m.flex-center;
    flex-shrink: 0;

    svg { width: 18px; height: 18px; color: v.$gray-500; }
  }

  &-title {
    font-size: v.$font-size-base;
    font-weight: 600;
    color: v.$gray-800;
    margin-bottom: 3px;
  }

  &-desc {
    font-size: v.$font-size-xs;
    color: v.$gray-500;
    line-height: 1.5;
  }
}
