/**
 * MyVideoStudio Billing Modal CSS.
 *
 * Pricing modal triggered from the dashboard "Buy credits" button.
 * Theme-aware: inherits data-theme from parent .mvs-dash.
 *
 * Layout: 4 pricing cards (Starter / Pro / Studio / Agency),
 * with Pro highlighted as "Most popular" and Agency as "Best value".
 *
 * @since 1.18.0
 */

/* ====================================================================
   1. OVERLAY
   ==================================================================== */

.mvs-bill {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  animation: mvs-bill-fade 0.3s ease;
}

.mvs-bill--open { display: flex; }

@keyframes mvs-bill-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

[data-theme="dark"] .mvs-bill,
.mvs-bill[data-theme="dark"] {
  background: rgba(0, 0, 0, 0.7);
}

/* ====================================================================
   2. CARD CONTAINER
   ==================================================================== */

.mvs-bill__panel {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  background: #FFFFFF;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 32px 64px -16px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  animation: mvs-bill-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mvs-bill-pop {
  from { opacity: 0; transform: scale(0.94) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

[data-theme="dark"] .mvs-bill__panel,
.mvs-bill[data-theme="dark"] .mvs-bill__panel {
  background: #14141F;
  box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.6);
}

/* ====================================================================
   3. HEADER
   ==================================================================== */

.mvs-bill__header {
  position: relative;
  padding: 32px 32px 16px;
  text-align: center;
}

.mvs-bill__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: rgba(15, 23, 42, 0.05);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #475569;
  transition: all 0.2s ease;
  font-family: inherit;
}

.mvs-bill__close:hover {
  background: rgba(15, 23, 42, 0.1);
  color: #0F172A;
}

[data-theme="dark"] .mvs-bill__close,
.mvs-bill[data-theme="dark"] .mvs-bill__close {
  background: rgba(255, 255, 255, 0.08);
  color: #94A3B8;
}

[data-theme="dark"] .mvs-bill__close:hover,
.mvs-bill[data-theme="dark"] .mvs-bill__close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #F8FAFC;
}

.mvs-bill__title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  color: #0F172A;
  line-height: 1.15;
}

@media (min-width: 640px) {
  .mvs-bill__title { font-size: 32px; }
}

[data-theme="dark"] .mvs-bill__title,
.mvs-bill[data-theme="dark"] .mvs-bill__title {
  color: #F8FAFC;
}

.mvs-bill__subtitle {
  font-size: 14px;
  color: #475569;
  margin: 0 0 12px;
  line-height: 1.5;
}

[data-theme="dark"] .mvs-bill__subtitle,
.mvs-bill[data-theme="dark"] .mvs-bill__subtitle {
  color: #CBD5E1;
}

.mvs-bill__current-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(99, 102, 241, 0.08);
  color: #4338CA;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

[data-theme="dark"] .mvs-bill__current-balance,
.mvs-bill[data-theme="dark"] .mvs-bill__current-balance {
  background: rgba(99, 102, 241, 0.18);
  color: #C7D2FE;
}

.mvs-bill__test-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  background: #F59E0B;
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ====================================================================
   4. PACKAGES GRID
   ==================================================================== */

.mvs-bill__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 32px;
}

@media (min-width: 640px) {
  .mvs-bill__body { padding: 16px 32px 36px; }
}

.mvs-bill__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .mvs-bill__grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (min-width: 1024px) {
  .mvs-bill__grid { grid-template-columns: repeat(4, 1fr); }
}

/* ====================================================================
   5. PACKAGE CARD
   ==================================================================== */

.mvs-bill__pkg {
  position: relative;
  padding: 22px 18px;
  background: #FFFFFF;
  border: 2px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.mvs-bill__pkg:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.12);
}

.mvs-bill__pkg--featured {
  border-color: #6366F1;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.04), transparent 50%);
}

.mvs-bill__pkg--featured:hover {
  border-color: #4F46E5;
  box-shadow: 0 16px 32px -10px rgba(99, 102, 241, 0.35);
}

[data-theme="dark"] .mvs-bill__pkg,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .mvs-bill__pkg:hover,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(129, 140, 248, 0.5);
}

[data-theme="dark"] .mvs-bill__pkg--featured,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg--featured {
  border-color: #818CF8;
  background: linear-gradient(180deg, rgba(129, 140, 248, 0.08), rgba(129, 140, 248, 0.02));
}

/* Badge (top-right corner) */
.mvs-bill__badge {
  position: absolute;
  top: -10px;
  right: 14px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #6366F1, #C026D3 60%, #EC4899);
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 0 4px 12px -2px rgba(192, 38, 211, 0.4);
}

.mvs-bill__badge--best-value {
  background: linear-gradient(135deg, #10B981, #06B6D4);
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.4);
}

/* Card content */
.mvs-bill__pkg-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6366F1;
  margin: 0 0 8px;
}

[data-theme="dark"] .mvs-bill__pkg-label,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg-label {
  color: #A5B4FC;
}

.mvs-bill__pkg-credits {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #0F172A;
  line-height: 1.1;
  margin: 0 0 2px;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .mvs-bill__pkg-credits,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg-credits {
  color: #F8FAFC;
}

.mvs-bill__pkg-credits-unit {
  font-size: 13px;
  font-weight: 500;
  color: #94A3B8;
  margin-left: 4px;
}

.mvs-bill__pkg-price {
  font-size: 22px;
  font-weight: 700;
  color: #0F172A;
  margin: 8px 0 6px;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .mvs-bill__pkg-price,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg-price {
  color: #F8FAFC;
}

.mvs-bill__pkg-rate {
  font-size: 11px;
  color: #94A3B8;
  margin: 0 0 16px;
}

.mvs-bill__pkg-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  margin: 0 0 16px;
  flex: 1;
}

[data-theme="dark"] .mvs-bill__pkg-desc,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg-desc {
  color: #CBD5E1;
}

.mvs-bill__pkg-btn {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(15, 23, 42, 0.06);
  color: #0F172A;
  letter-spacing: -0.005em;
}

.mvs-bill__pkg-btn:hover {
  background: rgba(15, 23, 42, 0.12);
}

.mvs-bill__pkg--featured .mvs-bill__pkg-btn {
  background: linear-gradient(135deg, #6366F1, #C026D3 55%, #EC4899);
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 6px 18px -6px rgba(192, 38, 211, 0.5);
}

.mvs-bill__pkg--featured .mvs-bill__pkg-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 12px 28px -8px rgba(192, 38, 211, 0.65);
}

[data-theme="dark"] .mvs-bill__pkg-btn,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
}

[data-theme="dark"] .mvs-bill__pkg-btn:hover,
.mvs-bill[data-theme="dark"] .mvs-bill__pkg-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.mvs-bill__pkg-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ====================================================================
   6. FOOTER
   ==================================================================== */

.mvs-bill__footer {
  padding: 14px 32px 22px;
  text-align: center;
  font-size: 12px;
  color: #94A3B8;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] .mvs-bill__footer,
.mvs-bill[data-theme="dark"] .mvs-bill__footer {
  color: #64748B;
  border-top-color: rgba(255, 255, 255, 0.05);
}

.mvs-bill__footer-icons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  opacity: 0.6;
  font-size: 11px;
}

/* ====================================================================
   7. STATES (empty / loading / not-configured)
   ==================================================================== */

.mvs-bill__state {
  padding: 56px 32px;
  text-align: center;
  font-size: 14px;
  color: #475569;
}

.mvs-bill__state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

[data-theme="dark"] .mvs-bill__state,
.mvs-bill[data-theme="dark"] .mvs-bill__state {
  color: #CBD5E1;
}

/* ====================================================================
   8. DASHBOARD HEADER BUTTON
   ==================================================================== */

.mvs-dash__buy-credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  background: linear-gradient(135deg, #6366F1, #C026D3 60%, #EC4899);
  color: white;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 6px 16px -4px rgba(192, 38, 211, 0.3);
  letter-spacing: -0.005em;
}

.mvs-dash__buy-credits:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 10px 22px -6px rgba(192, 38, 211, 0.45);
}

.mvs-dash__buy-credits-icon {
  font-size: 14px;
}

/* ====================================================================
   9. A11Y
   ==================================================================== */

.mvs-bill button:focus-visible {
  outline: 2px solid #6366F1;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .mvs-bill,
  .mvs-bill__panel { animation: none !important; }
  .mvs-bill__pkg:hover,
  .mvs-dash__buy-credits:hover { transform: none !important; }
}
