<template>
  <section class="mb-plans">
    <div class="mb-plans-list">
      <article v-for="plan in plans" :key="plan.name" class="mb-plan-card">
        <header class="card-head">
          <img width="20" height="20" :src="plan.icon" alt="icon" />
          <div class="head-text">
            <div class="plan-name">{{ plan.name }}</div>
            <div class="plan-desc">{{ plan.desc }}</div>
          </div>
        </header>
        <div class="price-row">
          <div class="price">{{ plan.price }}</div>
          <div class="price-meta">
            <del class="old-price">{{ plan.oldPrice }}</del>
            <span class="save-badge">{{ plan.save }}</span>
          </div>
        </div>
        <div class="divider" aria-hidden="true" />
        <ul class="features">
          <li v-for="(feature, idx) in plan.features" :key="idx" class="feature-item">{{ feature }}</li>
        </ul>
      </article>
    </div>
  </section>
</template>
<script setup>
import { plans } from '~/utils/plans'
</script>
<style lang="scss" scoped>
.mb-plans {
  width: 100%;
  box-sizing: border-box;
}

.mb-plans-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mb-plan-card {
  border-radius: 20px;
  border: 2px solid #9579FF;
  background: #1F1543;
  backdrop-filter: blur(20px);
  padding: 12px;
  box-sizing: border-box;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.head-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-name {
  color: #FFF;
  font-size: 20px;
  font-weight: 700;
  line-height: 20px;
}

.plan-desc {
  color: #FFF;
  font-size: 12px;
  font-weight: 400;
  line-height: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.price {
  font-size: 36px;
  font-weight: 700;
  line-height: 40px;
  color: #ffffff;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.price-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.old-price {
  font-size: 12px;
  font-weight: 500;
  line-height: 12px;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.save-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: #7d46ff;
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  line-height: 12px;
  white-space: nowrap;
}

.divider {
  height: 1px;
  width: 100%;
  background: rgba(204, 213, 234, 0.50);
  margin: 12px 0 14px;
}

.features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 10px;
}

.feature-item {
  position: relative;
  padding-left: 20px;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(163, 157, 255, 1);
  }

  &::after {
    content: '✓';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
  }
}
</style>
