/**
 * Mind Bridge Institute — Canonical Reference Batch Card System
 * File: batch-card.css
 *
 * Single Source of Truth for ALL Batch Cards across:
 * - Home Page (Featured Batches Carousel)
 * - All Batches Page & Dashboard All Batches View
 * - My Batches Page
 */

:root {
  --batch-card-bg: #070b14;
  --batch-card-border: rgba(164, 181, 206, 0.44);
  --batch-card-border-hover: rgba(198, 214, 238, 0.78);
  --batch-card-radius: 36px;
  --batch-card-media-ratio: 2 / 1;
  --batch-card-text: #ffffff;
  --batch-card-text-soft: #e2e8f0;
  --batch-card-muted: rgba(203, 213, 225, 0.62);
  --batch-card-green: #29c76f;
  --batch-card-cta-bg: #ffffff;
  --batch-card-cta-text: #070b14;
  --batch-card-pill-border: rgba(255, 255, 255, 0.44);
}

/* ============================================================
   RESPONSIVE BATCH CARD GRID (ALL BATCHES & MY BATCHES)
============================================================ */
.batch-cards-grid,
.batches-grid,
.my-batches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: clamp(16px, 2.2vw, 28px);
  width: 100%;
  align-items: stretch;
  justify-items: center;
  margin-bottom: 24px;
}

/* ============================================================
   FEATURED BATCHES CAROUSEL INTEGRATION (HOME PAGE)
============================================================ */
#featured .track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0 18px;
  cursor: grab;
  overscroll-behavior-x: contain;
  align-items: stretch;
}

#featured .track::-webkit-scrollbar {
  display: none;
}

#featured .track.drag {
  scroll-snap-type: none;
  cursor: grabbing;
  scroll-behavior: auto;
}

#featured .track .batch-card {
  flex: 0 0 100%;
  width: 100%;
  max-width: 1150px;
  scroll-snap-align: start;
}

@media (min-width: 640px) and (max-width: 1023px) {
  #featured .track .batch-card {
    flex: 0 0 min(82%, 560px);
  }
  #featured .track .batch-card:only-child {
    flex: 0 0 min(100%, 720px);
    margin-inline: auto;
  }
}

/* ============================================================
   CANONICAL BATCH CARD SHELL
============================================================ */
.batch-card {
  --_radius: clamp(22px, 2.6vw, var(--batch-card-radius, 36px));
  width: 100%;
  max-width: 1150px;
  min-width: 0;
  container-type: inline-size;
  container-name: batchcard;
  background: var(--batch-card-bg, #070b14);
  border: 2px solid var(--batch-card-border);
  border-radius: var(--_radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  text-decoration: none;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  transition: transform 240ms ease,
              border-color 240ms ease,
              box-shadow 240ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .batch-card:hover {
    transform: translateY(-4px);
    border-color: var(--batch-card-border-hover);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.68);
  }
}

/* Scroll reveal integration on Home Page */
.batch-card.reveal {
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.65s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 240ms ease,
              box-shadow 240ms ease;
}

.batch-card.reveal.visible.revealed {
  transition: transform 240ms ease,
              border-color 240ms ease,
              box-shadow 240ms ease;
  transition-delay: 0s;
}

@media (hover: hover) and (pointer: fine) {
  .batch-card.reveal.visible:hover {
    transform: translateY(-4px);
    transition-delay: 0s;
  }
}

/* ============================================================
   TOP THUMBNAIL SECTION (ORIGINAL, UNMODIFIED MEDIA)
============================================================ */
.batch-card-media {
  width: 100%;
  aspect-ratio: var(--batch-card-media-ratio, 2 / 1);
  overflow: hidden;
  background: #0b101b;
  position: relative;
  flex-shrink: 0;
  border-radius: calc(var(--_radius) - 2px) calc(var(--_radius) - 2px) 0 0;
}

.batch-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 0;
  filter: none;
  opacity: 1;
}

/* ============================================================
   BOTTOM INFORMATION SECTION
============================================================ */
.batch-card-content {
  background: var(--batch-card-bg, #070b14);
  padding: clamp(14px, 3.2cqw, 38px) clamp(16px, 4.4cqw, 50px) clamp(18px, 4.2cqw, 48px);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

/* Row 1: Right-aligned Language Badge */
.batch-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: clamp(8px, 1.5cqw, 18px);
}

.batch-card-language {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(0.7rem, 2.2cqw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--batch-card-text);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--batch-card-pill-border);
  border-radius: clamp(6px, 0.9cqw, 10px);
  padding: clamp(4px, 0.75cqw, 9px) clamp(11px, 2cqw, 22px);
  line-height: 1.15;
  white-space: nowrap;
}

/* Row 2: Batch Title */
.batch-card-title {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(1.125rem, 4.35cqw, 3.05rem);
  font-weight: 700;
  color: var(--batch-card-text);
  line-height: 1.24;
  letter-spacing: -0.015em;
  margin: 0 0 clamp(14px, 3.5cqw, 40px);
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Row 3: Dynamic Status & Timing Row */
.batch-card-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(6px, 1.2cqw, 14px);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(0.8125rem, 2.55cqw, 1.85rem);
  line-height: 1.35;
  margin-bottom: clamp(20px, 5.8cqw, 68px);
  min-width: 0;
}

.batch-card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 1.1cqw, 14px);
  flex-shrink: 0;
}

.batch-card-status-dot {
  width: clamp(8px, 1.4cqw, 16px);
  height: clamp(8px, 1.4cqw, 16px);
  border-radius: 50%;
  flex-shrink: 0;
  background: #ef4444;
}

.batch-card-status-dot.is-ongoing {
  background: #ef4444;
}

.batch-card-status-dot.is-starting-soon {
  background: #f59e0b;
}

.batch-card-status-dot.is-upcoming {
  background: #38bdf8;
}

.batch-card-status-dot.is-completed {
  background: #22c55e;
}

.batch-card-status-dot.is-coming-soon {
  background: #a855f7;
}

.batch-card-status-label {
  color: var(--batch-card-text);
  font-weight: 500;
}

.batch-card-status-sep {
  color: rgba(226, 232, 240, 0.45);
  font-weight: 400;
}

.batch-card-status-date {
  color: var(--batch-card-text-soft);
  font-weight: 400;
  min-width: 0;
}

/* ============================================================
   ROW 4: FOOTER (PRICING + DISCOUNT | BUY NOW + ARROW)
============================================================ */
.batch-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: clamp(10px, 2cqw, 20px);
  min-width: 0;
}

.batch-card-pricing-wrap {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.7cqw, 8px);
  min-width: 0;
}

.batch-card-pricing {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: clamp(6px, 1.2cqw, 14px);
}

.batch-card-price {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(1.22rem, 4.35cqw, 3.05rem);
  font-weight: 800;
  color: var(--batch-card-text);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.batch-card-price.is-free {
  color: #34d399;
}

.batch-card-mrp {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(0.82rem, 2.55cqw, 1.85rem);
  font-weight: 500;
  color: var(--batch-card-muted);
  text-decoration: line-through;
  line-height: 1.1;
}

.batch-card-discount {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(0.78rem, 2.25cqw, 1.55rem);
  font-weight: 700;
  color: var(--batch-card-green);
  letter-spacing: 0.015em;
  line-height: 1.1;
  text-transform: uppercase;
}

/* CTA Actions */
.batch-card-actions {
  display: flex;
  align-items: stretch;
  gap: clamp(8px, 1.4cqw, 16px);
  flex-shrink: 0;
  margin-left: auto;
  max-width: 100%;
}

.batch-card-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--batch-card-cta-bg, #ffffff);
  color: var(--batch-card-cta-text, #070b14);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(0.84rem, 2.55cqw, 1.85rem);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  text-decoration: none;
  border: 1.5px solid #ffffff;
  border-radius: clamp(10px, 1.65cqw, 20px);
  padding: clamp(10px, 2.1cqw, 26px) clamp(16px, 4.4cqw, 52px);
  cursor: pointer;
  transition: background 220ms ease,
              border-color 220ms ease,
              transform 220ms ease,
              box-shadow 220ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .batch-card-buy:not(:disabled):not(.is-disabled):hover {
    background: #f1f5f9;
    border-color: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.16);
  }
}

.batch-card-buy:active:not(:disabled) {
  transform: scale(0.98);
}

.batch-card-buy.is-disabled,
.batch-card-buy:disabled {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #e2e8f0;
  cursor: not-allowed;
}

.batch-card-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-width: clamp(40px, 8.2cqw, 96px);
  background: transparent;
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.42);
  border-radius: clamp(10px, 1.65cqw, 20px);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 220ms ease,
              border-color 220ms ease,
              transform 220ms ease;
}

.batch-card-arrow svg {
  width: clamp(16px, 3cqw, 34px);
  height: clamp(16px, 3cqw, 34px);
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .batch-card-arrow:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.85);
    transform: translateX(2px);
  }
}

.batch-card-arrow:active {
  transform: scale(0.97);
}

.batch-card-buy:focus-visible,
.batch-card-arrow:focus-visible {
  outline: 2.5px solid #38bdf8;
  outline-offset: 2px;
}

/* ============================================================
   SKELETON PLACEHOLDER STATE
============================================================ */
.batch-card.skeleton-card {
  pointer-events: none;
  cursor: default;
}

.batch-card-skeleton-block {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: batchCardShimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

.batch-card-media.batch-card-skeleton-block {
  border-radius: calc(var(--_radius) - 2px) calc(var(--_radius) - 2px) 0 0;
}

@keyframes batchCardShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   MOBILE BALANCED COMPACT SIZING (< 640px ONLY)
   Keeps tablet (640-1023px) & desktop (>= 1024px) unchanged.
============================================================ */
@media (max-width: 639px) {
  .batch-cards-grid,
  .batches-grid,
  .my-batches-grid {
    gap: 16px;
  }

  #featured .track {
    gap: 16px;
  }

  #featured .track .batch-card {
    flex: 0 0 min(100%, 372px);
    max-width: 372px;
  }

  #featured .track .batch-card:only-child {
    margin-inline: auto;
  }

  .batch-card {
    --_radius: 21px;
    max-width: 372px;
  }

  .batch-card-content {
    padding: 13px 15px 16px;
  }

  .batch-card-header {
    margin-bottom: 6px;
  }

  .batch-card-language {
    font-size: 0.68rem;
    padding: 3.5px 9px;
    border-radius: 7px;
  }

  .batch-card-title {
    font-size: 1.09rem;
    line-height: 1.24;
    margin-bottom: 10px;
  }

  .batch-card-status {
    font-size: 0.79rem;
    gap: 6px;
    margin-bottom: 16px;
  }

  .batch-card-status-badge {
    gap: 6px;
  }

  .batch-card-status-dot {
    width: 8.5px;
    height: 8.5px;
  }

  .batch-card-footer {
    gap: 8px;
  }

  .batch-card-pricing-wrap {
    gap: 3px;
  }

  .batch-card-pricing {
    gap: 6px;
  }

  .batch-card-price {
    font-size: 1.17rem;
  }

  .batch-card-mrp {
    font-size: 0.79rem;
  }

  .batch-card-discount {
    font-size: 0.74rem;
  }

  .batch-card-actions {
    gap: 6px;
  }

  .batch-card-buy {
    font-size: 0.78rem;
    padding: 9px 12px;
    border-radius: 9px;
  }

  .batch-card-arrow {
    min-width: 35px;
    border-radius: 9px;
  }

  .batch-card-arrow svg {
    width: 15px;
    height: 15px;
  }
}

/* ============================================================
   DESKTOP / PC COMPACT BALANCED SIZING (>= 1024px ONLY)
   Placed after base card rules so desktop tokens cleanly win.
   Keeps mobile (<768px) & tablet (768-1023px) completely unchanged.
============================================================ */
@media (min-width: 1024px) {
  .batch-cards-grid,
  .batches-grid,
  .my-batches-grid {
    grid-template-columns: repeat(auto-fill, minmax(335px, 1fr));
    gap: 20px;
    justify-items: start;
  }

  #featured .track .batch-card {
    flex: 0 0 clamp(335px, calc((100% - 48px) / 3), 384px);
    max-width: 384px;
  }

  #featured .track .batch-card:only-child {
    flex: 0 0 min(100%, 384px);
    margin-inline: auto;
  }

  .batch-card {
    --_radius: 22px;
    max-width: 385px;
  }

  .batch-card-content {
    padding: 12px 15px 15px;
  }

  .batch-card-header {
    margin-bottom: 6px;
  }

  .batch-card-language {
    font-size: 0.68rem;
    padding: 3.5px 9px;
    border-radius: 7px;
  }

  .batch-card-title {
    font-size: 1.08rem;
    margin-bottom: 10px;
  }

  .batch-card-status {
    font-size: 0.78rem;
    gap: 6px;
    margin-bottom: 16px;
  }

  .batch-card-status-badge {
    gap: 6px;
  }

  .batch-card-status-dot {
    width: 8px;
    height: 8px;
  }

  .batch-card-footer {
    gap: 8px;
  }

  .batch-card-pricing-wrap {
    gap: 3px;
  }

  .batch-card-pricing {
    gap: 5px;
  }

  .batch-card-price {
    font-size: 1.15rem;
  }

  .batch-card-mrp {
    font-size: 0.78rem;
  }

  .batch-card-discount {
    font-size: 0.74rem;
  }

  .batch-card-actions {
    gap: 6px;
  }

  .batch-card-buy {
    font-size: 0.78rem;
    padding: 8.5px 12px;
    border-radius: 9px;
  }

  .batch-card-arrow {
    min-width: 34px;
    border-radius: 9px;
  }

  .batch-card-arrow svg {
    width: 15px;
    height: 15px;
  }
}

/* ============================================================
   REDUCED MOTION ACCESSIBILITY
============================================================ */
@media (prefers-reduced-motion: reduce) {
  .batch-card,
  .batch-card.reveal,
  .batch-card-buy,
  .batch-card-arrow {
    transition: none !important;
    transform: none !important;
  }
  .batch-card-skeleton-block {
    animation: none !important;
  }
}
