/* ═══════════════════════════════════════════════════════════════
   Products Page Styles (Plan-Centric with Image Headers)
   ═══════════════════════════════════════════════════════════════ */

/* ── Page Header ── */
.products-page-header {
  margin-bottom: 32px;
}

.products-page-title {
  font-family: var(--font-serif);
  font-size: 30px;
  color: var(--color-ink);
  font-weight: 700;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.products-page-title .count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--swatch-green-bg);
  color: var(--swatch-green-text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
}

.products-page-subtitle {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-muted);
  margin: 0;
}

.claims-back-link .material-symbols-outlined {
  font-size: 15px;
}

/* ── Section Dividers ── */
.products-section-divider {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

/* ── Grid Layout ── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
}

/* ── Plan Card Base ── */
.plan-card {
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.plan-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

/* ── Card Image Header ── */
.plan-card__img-wrap {
  position: relative;
  height: 300px;
  width: 100%;
  overflow: hidden;
  /* Fallback background if image is missing */
  background-color: var(--surface-muted); 
}

/* Taller variant for withdrawn cards */
.plan-card--withdrawn .plan-card__img-wrap {
  height: 192px;
}

.plan-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.plan-card:hover .plan-card__img {
  transform: scale(1.03);
}

/* Gradient Overlay */
.plan-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  pointer-events: none;
}

/* Text positioned over image */
.plan-card__img-content {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 2;
}

.plan-card__code-badge {
  display: inline-block;
  background: var(--swatch-gold-bg);
  color: var(--swatch-gold-strong);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.plan-card__img-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  margin: 0;
}

/* ── Card Body (Active Plans Only) ── */
.plan-card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plan-card__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-card__label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-subtle);
}

.plan-card__label--exclusion {
  color: var(--swatch-terracotta);
}

.plan-card__text {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-ink);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.plan-card__empty-msg {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-muted);
  font-style: italic;
  padding: 20px 0;
  text-align: center;
}

/* ── Card Footer (Active Plans Only) ── */
.plan-card__footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.plan-card__footer-end {
  text-align: right;
}


/* ── Quick Stats Row (Age, Term, Maturity) ── */
.plan-card__stats {
  display: flex;
  gap: 12px; /* Slightly reduced gap so they have more room to breathe */
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.plan-card__stat {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1; /* THIS is the magic line that forces them to take equal space */
  min-width: 0; /* Prevents long text from breaking out of its equal column */
}

.plan-card__stat-icon {
  font-size: 18px;
  color: var(--color-muted);
  flex-shrink: 0; /* Prevents the icon from shrinking if text gets too long */
}

.plan-card__stat-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin: 0;
  line-height: 1;
}

.plan-card__stat-value {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  margin: 2px 0 0;
  line-height: 1;
  white-space: nowrap; /* Keeps "18 - 60 वर्ष" on one line if possible */
  overflow: hidden;
  text-overflow: ellipsis; /* Adds '...' if it gets squished on tiny screens */
}

/* ── Payment Mode Pills ── */
.plan-card__modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.plan-card__mode-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--color-subtle);
  border: 1px solid var(--color-border);
}

.plan-card__premium-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 2px;
}

.plan-card__premium-value {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-gold-text);
  margin: 0;
}

/* ── Withdrawn State ── */
.plan-card--withdrawn {
  opacity: 0.8;
  filter: grayscale(0.5);
}

.plan-card--withdrawn:hover {
  transform: none; /* Disable hover lift for inactive */
  box-shadow: var(--shadow-card);
}

.plan-card--withdrawn .plan-card__code-badge {
  background: var(--color-border-strong);
  color: var(--color-muted);
}

/* ── Empty States ── */
.products-empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-muted);
}

.products-empty-state__icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  color: var(--color-border-strong);
}

.products-empty-state__text {
  font-family: var(--font-serif-alt);
  font-size: 18px;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .plan-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .products-page-title {
    font-size: 24px;
  }
}


/* ── Title Row (Title + Action Button) ── */
.products-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap; /* Ensures button drops below title cleanly on small screens */
}

.products-title-row .db-btn {
  flex-shrink: 0; /* Prevents button from squishing when space is tight */
}

/* ── Clickable Card ── */
.plan-card--clickable {
  cursor: pointer;
}

/* ── Footer with single item (max sum assured only) ── */
.plan-card__footer--single {
  justify-content: flex-end;
}
/* ═══════════════════════════════════════════════════════════════
   Plan Detail Modal (v2 — inspired by mockup)
   ═══════════════════════════════════════════════════════════════ */
.plan-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, background 0.28s ease, visibility 0s linear 0.28s;
}

.plan-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.55);
  transition: opacity 0.28s ease, background 0.28s ease, visibility 0s linear 0s;
}

.plan-modal {
  background: var(--surface);
  border-radius: var(--radius-xl, var(--radius-md));
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-card-hover);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.plan-modal-overlay.is-open .plan-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .plan-modal-overlay,
  .plan-modal {
    transition: none;
  }
}

/* ── Close Button ── */
.plan-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: var(--surface-muted);
  border: none;
  border-radius: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-ink);
  z-index: 2;
  transition: background 0.15s ease;
}

.plan-modal__close:hover {
  background: var(--color-border);
}

/* ── Header ── */
.plan-modal__header {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--color-border);
  padding: 32px 56px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-modal__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--swatch-gold-bg);
  color: var(--swatch-gold-strong);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.plan-modal__title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-ink);
  margin: 0;
  line-height: 1.3;
}

/* ── Body ── */
.plan-modal__body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.plan-modal__intro {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--color-muted);
  line-height: 1.6;
  margin: 0;
}

.plan-modal__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-modal__section-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary, var(--color-subtle));
  margin: 0;
}

.plan-modal__section-label--exclusion {
  color: var(--swatch-terracotta);
}

.plan-modal__feature-box,
.plan-modal__box {
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px;
  transition: box-shadow 0.2s ease;
}

.plan-modal__feature-box:hover,
.plan-modal__box:hover {
  box-shadow: var(--shadow-card-hover);
}

.plan-modal__box {
  height: 100%;
}

.plan-modal__text {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-ink);
  line-height: 1.6;
  margin: 0;
}

/* ── Two Column Grid (Exclusions / Waiting) ── */
.plan-modal__grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Payment Mode Pills ── */
.plan-modal__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plan-modal__pills .plan-card__mode-pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
}

/* ── Divider ── */
.plan-modal__divider {
  height: 1px;
  width: 100%;
  background: var(--color-border);
}

/* ── Key Metrics ── */
.plan-modal__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  position: relative;
}

.plan-modal__metrics::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 1px;
  background: var(--color-border);
}

.plan-modal__metric {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-modal__metric-icon {
  font-size: 20px;
  color: var(--color-muted);
  flex-shrink: 0;
}

.plan-modal__metric-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.plan-modal__metric-value {
  display: block;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
}

/* ── Footer ── */
.plan-modal__footer {
  background: var(--surface-muted);
  border-top: 1px solid var(--color-border);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: auto;
}

.plan-modal__footer-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-modal__footer-col--end {
  align-items: flex-end;
  text-align: right;
}

.plan-modal__footer-value {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-gold-text);
}

@media (max-width: 640px) {
  .plan-modal__grid-2 {
    grid-template-columns: 1fr;
  }
  .plan-modal__metrics {
    grid-template-columns: 1fr;
  }
  .plan-modal__metrics::before {
    display: none;
  }
  .plan-modal__footer {
    grid-template-columns: 1fr;
  }
  .plan-modal__footer-col--end {
    align-items: flex-start;
    text-align: left;
  }
}