/* per.css — coupon list styles for per module */

.per-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.per-card {
  position: relative;
  min-height: 347px;
  border-radius: 16px;
  border: 1.438px solid #ddd;
  background: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.per-card__badge {
  position: absolute;
  right: 18px;
  top: 16px;
  min-width: 68px;
  height: 25px;
  border-radius: 999px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  color: #fff;
}

.per-card__badge--available {
  background: #28a745;
}

.per-card__badge--new {
  background: linear-gradient(180deg, #ff6b35 0%, #f7931e 100%);
}

.per-card__badge--used {
  background: #666;
}

.per-card__badge--expired {
  background: #999;
}

.per-card__body {
  flex: 1;
  display: grid;
  grid-template-columns: 120px 2px minmax(0, 1fr);
  gap: 20px;
  min-height: 207px;
}

.per-card__value {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-top: 32px;
}

.per-card__gift {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.per-card__gift img {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

.per-card__value strong {
  color: var(--color-primary);
  font-size: 28px;
  line-height: 32px;
  font-weight: 700;
}

.per-card__value em {
  color: #999;
  font-style: normal;
  font-size: 12px;
  line-height: 18px;
}

.per-card__divider {
  width: 2px;
  background: rgba(221, 221, 221, 0.5);
}

.per-card__content {
  display: flex;
  flex-direction: column;
  padding-top: 32px;
}

.per-card__content h3 {
  font-size: 18px;
  color: #1a1a1a;
  line-height: 27px;
  margin-bottom: 8px;
}

.per-card__content p {
  font-size: 13px;
  line-height: 20px;
  color: #666;
  margin-bottom: 11px;
}

.per-card__min {
  align-self: flex-start;
  border-radius: 4px;
  border: 1px solid #ffd700;
  background: #fff9e5;
  color: #f57c00;
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  padding: 8px 8px;
  margin-bottom: 8px;
}

.per-card__scope {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 19px;
  margin-bottom: 16px;
}

.per-card__scope img {
  width: 14px;
  height: 14px;
}

.per-card__meta {
  margin-top: auto;
  border-top: 1px solid #ddd;
  padding-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.per-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #666;
  font-size: 12px;
  line-height: 18px;
}

.per-card__meta img {
  width: 14px;
  height: 14px;
}

.per-card__meta b {
  color: #666;
  font-size: 12px;
  font-weight: 700;
}

.per-card__meta--single {
  justify-content: flex-start;
}

.per-card__action {
  margin-top: 21px;
  height: 48px;
  border-radius: 8px;
  border: 0;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color var(--transition-base);
}

.per-card__action:hover {
  background: var(--color-primary-hover);
}

.per-card__action img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.per-card--available {
  border-color: var(--color-primary);
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%);
}

.per-card--new {
  border-color: #ff9800;
  background: linear-gradient(180deg, #fff8f0 0%, #ffffff 100%);
}

.per-card--used {
  border-color: #ddd;
  background: #f0f0f0;
}

.per-card--expired {
  border-color: #ddd;
  background: #e8e8e8;
}

.per-card--used .per-card__gift,
.per-card--expired .per-card__gift {
  background: #999;
}

.per-card--used .per-card__value strong,
.per-card--expired .per-card__value strong,
.per-card--used .per-card__content h3,
.per-card--expired .per-card__content h3,
.per-card--used .per-card__content p,
.per-card--expired .per-card__content p,
.per-card--used .per-card__scope,
.per-card--expired .per-card__scope,
.per-card--used .per-card__meta span,
.per-card--expired .per-card__meta span,
.per-card--used .per-card__meta b,
.per-card--expired .per-card__meta b {
  color: #999;
}

.per-card--used .per-card__scope img,
.per-card--expired .per-card__scope img,
.per-card--used .per-card__meta img,
.per-card--expired .per-card__meta img {
  opacity: 0.75;
}

.per-card--used .per-card__min,
.per-card--expired .per-card__min {
  border-color: #ccc;
  background: #f5f5f5;
  color: #999;
}

.per-card__action--muted {
  border: 1.438px solid #ddd;
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

.per-card__action--muted:hover {
  background: #f5f5f5;
}

.per-card.is-hidden {
  display: none;
}

.per-history-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.per-history-back {
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.per-history-back img {
  width: 16px;
  height: 16px;
}

.per-history-back:hover {
  background: #f9f9f9;
}

.per-history-title-wrap {
  flex: 1;
  min-width: 0;
}

.per-history-title {
  font-size: 40px;
  line-height: 1.2;
  color: #1a1a1a;
  font-weight: 700;
}

.per-history-view-coupons {
  height: 40px;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  border-radius: 8px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.per-history-view-coupons img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.per-history-view-coupons:hover {
  background: var(--color-primary-hover);
}

.per-history-panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
}

.per-history-panel__title {
  font-size: 20px;
  line-height: 1.5;
  color: #1a1a1a;
  font-weight: 700;
  margin-bottom: 16px;
}

.per-history-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.per-history-item:last-child {
  margin-bottom: 0;
}

.per-history-item__top {
  margin-bottom: 12px;
}

.per-history-item__name-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.per-history-item__name-wrap img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.per-history-item__name-wrap h4 {
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
  font-weight: 600;
}

.per-history-item__code {
  height: 21px;
  border-radius: 4px;
  background: #f5f5f5;
  color: #666;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
}

.per-history-item__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.per-history-item__meta p {
  font-size: 12px;
  line-height: 1.5;
  color: #999;
  margin-bottom: 4px;
  font-weight: 500;
}

.per-history-item__meta strong {
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
  font-weight: 600;
}

.per-history-item__meta .per-history-item__amount {
  color: #28a745;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 700;
}

.per-history-item__meta .per-history-item__time {
  color: #666;
}

@media (max-width: 1400px) {
  .per-grid {
    grid-template-columns: 1fr;
  }

  .per-card {
    min-height: 330px;
  }

  .per-history-title {
    font-size: 34px;
  }
}

@media (max-width: 640px) {
  .per-card {
    padding: 14px;
    min-height: auto;
  }

  .per-card__body {
    gap: 10px;
    grid-template-columns: 92px 1px minmax(0, 1fr);
  }

  .per-card__gift {
    width: 46px;
    height: 46px;
  }

  .per-card__gift img {
    width: 22px;
    height: 22px;
  }

  .per-card__value strong {
    font-size: 24px;
    line-height: 28px;
  }

  .per-card__content h3 {
    font-size: 18px;
    line-height: 24px;
  }

  .per-card__action {
    margin-top: 12px;
  }

  .per-history-head {
    flex-wrap: wrap;
    gap: 10px;
  }

  .per-history-title {
    font-size: 28px;
  }

  .per-history-panel {
    padding: 14px;
  }

  .per-history-item {
    padding: 14px;
  }

  .per-history-item__name-wrap {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .per-history-item__meta {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
