/* ============================================
   MY SUBSCRIPTION — Cocopredict (violet theme)
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand:       #8B5CF6;
  --brand-hover: #7C3AED;
  --brand-soft:  #F5F3FF;
  --navy:        #0F172A;
  --navy-2:      #1E293B;
  --green:       #10B981;
  --red:         #EF4444;
  --amber:       #F59E0B;
  --ink-900:     #0F172A;
  --ink-700:     #334155;
  --ink-500:     #64748B;
  --ink-400:     #94A3B8;
  --ink-200:     #E2E8F0;
  --ink-100:     #F1F5F9;
  --ink-50:      #F8FAFC;
  --white:       #FFFFFF;
  --radius:      16px;
  --radius-lg:   24px;
  --shadow:      0 4px 20px rgba(15,23,42,0.06);
  --shadow-lg:   0 20px 40px rgba(15,23,42,0.12);
  --t:           0.22s cubic-bezier(0.4,0,0.2,1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ink-50);
  color: var(--ink-900);
  line-height: 1.5;
  padding-bottom: 60px;
}

/* ---------- HEADER ---------- */
.header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo {
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.logo span { color: var(--brand); }

.nav {
  display: none;
  gap: 4px;
}
@media (min-width: 900px) {
  .nav { display: flex; }
}
.nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  transition: var(--t);
}
.nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }

.header-actions { flex-shrink: 0; }
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.14);
  transition: var(--t);
}
.btn-back:hover { background: rgba(255,255,255,0.18); }

/* ---------- WRAP ---------- */
.sub-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 20px;
}
.section { margin-bottom: 40px; }
.section-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.4px;
  color: var(--ink-900);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.section-title i { color: var(--brand); }

/* ---------- LOADING ---------- */
.loading {
  padding: 40px;
  text-align: center;
  color: var(--ink-400);
  font-weight: 600;
  font-size: 14px;
}
.loading i { color: var(--brand); margin-right: 8px; }

/* ---------- PLANS GRID ---------- */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

/* ---------- PLAN CARD ---------- */
.plan-card {
  background: linear-gradient(135deg, #1F2A44, #2D3A5E);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: var(--t);
}
.plan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 30px -14px rgba(0,0,0,0.35);
}
.plan-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.plan-period {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.plan-price {
  font-size: 22px;
  font-weight: 900;
  color: #C4B5FD;
  margin: 12px 0 6px;
}
.days-left {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(16,185,129,0.18);
  color: #34D399;
  margin-top: 4px;
}
.days-left.warn {
  background: rgba(245,158,11,0.18);
  color: #FBBF24;
}
.plan-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.plan-actions button {
  flex: 1;
  padding: 9px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--t);
}
.btn-cancel {
  background: rgba(239,68,68,0.18);
  color: #F87171;
  border: 1px solid rgba(239,68,68,0.35) !important;
}
.btn-cancel:hover { background: #EF4444; color: #fff; }
.btn-renew {
  background: var(--brand);
  color: #fff;
}
.btn-renew:hover { background: var(--brand-hover); transform: translateY(-1px); }

/* ---------- EMPTY / PENDING BOXES ---------- */
.no-plans {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
}
.no-plans i {
  font-size: 32px;
  color: var(--ink-400);
  display: block;
  margin-bottom: 12px;
}
.no-plans h3 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 6px;
}
.no-plans p {
  color: var(--ink-500);
  font-size: 14px;
  margin-bottom: 18px;
}
.no-plans.pending i { color: var(--amber); }
.btn-upgrade-solid {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 13.5px;
  border: none;
  cursor: pointer;
  transition: var(--t);
}
.btn-upgrade-solid:hover { background: var(--brand-hover); transform: translateY(-1px); }

/* ---------- HISTORY TABS ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink-200);
}
.tab {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--ink-100);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  cursor: pointer;
  transition: var(--t);
}
.tab:hover { background: var(--brand-soft); color: var(--brand); }
.tab.active { background: var(--brand); color: #fff; }

/* ---------- SUBSCRIPTION LIST ---------- */
.subs-list {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink-200);
  overflow: hidden;
}
.sub-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ink-100);
  cursor: pointer;
  transition: var(--t);
}
.sub-item:last-child { border-bottom: none; }
.sub-item:hover { background: var(--ink-50); }

.sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.sub-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-900);
}
.sub-period {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 600;
}
.sub-dates {
  font-size: 12px;
  color: var(--ink-500);
}
.sub-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--brand);
}
.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status.active    { background: #D1FAE5; color: #059669; }
.status.pending   { background: #FEF3C7; color: #D97706; }
.status.expired   { background: #FEE2E2; color: #DC2626; }
.status.cancelled { background: #E2E8F0; color: #475569; }

/* ---------- UPGRADE BANNER ---------- */
.upgrade-banner {
  background: linear-gradient(135deg, #F5F3FF, #EDE9FE);
  border: 1px solid var(--brand);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.banner-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.banner-inner > i {
  font-size: 28px;
  color: var(--brand);
  flex-shrink: 0;
}
.banner-inner > div {
  flex: 1;
  min-width: 200px;
}
.banner-inner h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 2px;
}
.banner-inner p {
  font-size: 13px;
  color: var(--ink-500);
}
.btn-upgrade {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  font-size: 13.5px;
  transition: var(--t);
  flex-shrink: 0;
}
.btn-upgrade:hover { background: var(--brand-hover); transform: translateY(-1px); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0,0,0,0.3);
  animation: pop 0.25s ease;
  will-change: transform;
}
@keyframes pop {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Drag handle — hidden on desktop */
.modal-handle {
  display: none;
  width: 40px;
  height: 4px;
  background: var(--ink-200);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.modal-head {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.modal-x {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: var(--t);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-x:hover { background: rgba(255,255,255,0.28); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ---------- DETAIL ROWS INSIDE MODAL ---------- */
.d-section {
  background: var(--ink-50);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.d-section:last-child { margin-bottom: 0; }
.d-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink-200);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-900);
}
.d-head i { color: var(--brand); }
.d-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  gap: 12px;
}
.d-row + .d-row { border-top: 1px dashed var(--ink-200); }
.d-label { color: var(--ink-500); font-weight: 600; flex-shrink: 0; }
.d-value {
  color: var(--ink-900);
  font-weight: 700;
  text-align: right;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

/* Inline status badge next to plan name (no background, just color + dot) */
.d-status-inline {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: relative;
  padding-left: 12px;
  vertical-align: middle;
}
.d-status-inline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.d-status-inline.status-active    { color: #059669; }
.d-status-inline.status-pending   { color: #D97706; }
.d-status-inline.status-expired   { color: #DC2626; }
.d-status-inline.status-cancelled { color: #64748B; }

/* Legacy standalone badge (hidden if still rendered) */
.d-status { display: none; }

/* ============================================================
   PAYMENT PROOF — File card style
   ============================================================ */
.proof-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--t);
}

.proof-file:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.10);
}

.proof-file:active {
    transform: translateY(0);
}

.proof-file-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: var(--t);
}

.proof-file:hover .proof-file-icon {
    background: var(--brand);
    color: #fff;
}

.proof-file-info {
    flex: 1;
    min-width: 0;
}

.proof-file-name {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--ink-900);
    margin-bottom: 2px;
}

.proof-file-meta {
    font-size: 11.5px;
    color: var(--ink-500);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.proof-file-meta i {
    color: var(--brand);
    font-size: 10.5px;
}

.proof-file-arrow {
    color: var(--ink-400);
    font-size: 12px;
    flex-shrink: 0;
    transition: var(--t);
}

.proof-file:hover .proof-file-arrow {
    color: var(--brand);
    transform: translateX(2px);
}

.proof-missing {
    padding: 20px;
    text-align: center;
    background: var(--ink-50);
    border: 1px dashed var(--ink-200);
    border-radius: 12px;
    color: var(--ink-400);
    font-size: 13px;
    font-weight: 600;
}

/* ---------- Proof lightbox ---------- */
.proof-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: proofFade 0.2s ease;
}
@keyframes proofFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.proof-lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: proofScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes proofScale {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.proof-lightbox-inner img {
  max-width: 90vw;
  max-height: 92vh;
  border-radius: 16px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  background: #fff;
  display: block;
}
.proof-lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  color: var(--ink-900);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.proof-lightbox-close:hover {
  background: var(--brand);
  color: #fff;
  transform: rotate(90deg);
}

/* ---------- TOAST ---------- */
#customToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 9999;
  display: none;
  box-shadow: var(--shadow-lg);
}
#customToast.success { background: var(--green); }
#customToast.error   { background: var(--red); }
#customToast.info    { background: var(--brand); }

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 640px) {
  .sub-wrap { padding: 24px 16px; }
  .section-title { font-size: 17px; }
  .plan-actions { flex-direction: column; }
  .banner-inner { flex-direction: column; align-items: flex-start; text-align: left; }
  .banner-inner > div { text-align: left; }
  .sub-item .sub-row { flex-wrap: wrap; }

  /* ---------- Bottom sheet ---------- */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;   /* ONLY top-left + top-right rounded */
    overflow: hidden;                /* clips header to the rounded shape */
    padding-bottom: env(safe-area-inset-bottom, 0);
    animation: sheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes sheetUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .modal-handle { display: none; }

  .modal-head {
    border-radius: 24px 24px 0 0;   /* match the parent box's top corners */
    padding: 16px 20px;
  }

  .modal-head h3 { font-size: 15.5px; }

  .modal-body { padding: 16px 20px 24px; }

  .d-section { padding: 12px 14px; margin-bottom: 12px; }
  .d-head { font-size: 12.5px; margin-bottom: 8px; padding-bottom: 8px; }
  .d-row { font-size: 12.5px; padding: 5px 0; }

  .proof-lightbox-close {
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
  }
  .proof-lightbox-inner img { border-radius: 12px; }
}