/* =========================================================
   VANNY DESIGN — downloads.css
   Styles for the Downloads page (downloads.html) — the offline/cached
   media library view. Built on style.css's existing theme tokens so
   light/dark mode and the brand blue accent work automatically.
========================================================= */

.downloads-page {
  padding-bottom: 90px; /* clears the fixed bottom-nav-bar */
}

.downloads-header {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 16px 16px 0;
}

.downloads-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.downloads-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------
   TABS — "Downloaded Movies" / "Downloaded Games"
--------------------------------------------------------- */
.downloads-tabs {
  display: flex;
  gap: 8px;
  max-width: var(--container-max);
  margin: 16px auto 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--header-border);
}

.downloads-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}

.downloads-tab-btn .icon {
  width: 16px;
  height: 16px;
}

.downloads-tab-btn.is-active {
  color: var(--royal-blue);
  border-bottom-color: var(--royal-blue);
}

.downloads-tab-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--header-chip-bg);
  color: var(--header-text-muted);
}

.downloads-tab-btn.is-active .downloads-tab-count {
  background: var(--royal-blue);
  color: #ffffff;
}

/* ---------------------------------------------------------
   DOWNLOAD LIST
--------------------------------------------------------- */
.downloads-panel {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 14px 16px 0;
}

.downloads-panel[hidden] {
  display: none;
}

.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.download-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}

.download-item-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background-image: linear-gradient(150deg, #2563eb, #0f172a);
  background-size: cover;
  background-position: center;
}

.download-item-info {
  flex: 1;
  min-width: 0;
}

.download-item-title {
  margin: 0 0 3px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.download-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.download-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.download-action-btn .icon {
  width: 18px;
  height: 18px;
}

.download-play-btn {
  background: rgba(37, 99, 235, 0.12);
  color: var(--royal-blue);
}

.download-play-btn:hover {
  background: rgba(37, 99, 235, 0.2);
}

.download-delete-btn {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.download-delete-btn:hover {
  background: rgba(220, 38, 38, 0.18);
}

/* ---------------------------------------------------------
   EMPTY STATE
--------------------------------------------------------- */
.downloads-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.downloads-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--header-chip-bg);
  color: var(--text-muted);
  margin-bottom: 14px;
}

.downloads-empty-icon .icon {
  width: 26px;
  height: 26px;
}

.downloads-empty-title {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.downloads-empty-desc {
  margin: 0;
  font-size: 13px;
  max-width: 280px;
}

/* Account login/register modal (account-gated checkout) + its shared
   .cpm-* classes — same component as index.html/mod-details.html, see
   showAccountAuthModal()/initAccountAuthModal() in app.js. Styled here
   (downloads.html's own stylesheet) instead of inline, matching this
   page's convention of using external CSS rather than a per-page
   <style> block. */
.cpm-panel {
  position: relative; z-index: 1; width: 100%; max-width: 440px;
  background: #0f172a; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; overflow: hidden;
}
.cpm-header { background: #2563eb; padding: 20px 24px 18px; display: flex; align-items: flex-start; justify-content: space-between; }
.cpm-header-left { display: flex; flex-direction: column; gap: 4px; }
.cpm-header-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.75); }
.cpm-header-title { font-size: 1.05rem; font-weight: 700; color: #ffffff; }
.cpm-body { padding: 24px; }
.cpm-label { display: block; font-size: 0.8rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.cpm-status { margin-top: 12px; font-size: 0.88rem; line-height: 1.5; min-height: 20px; display: flex; align-items: center; }
.cpm-status-error { color: #f87171; }
.cpm-status-pending { color: #94a3b8; }
.cpm-status-success { color: #4ade80; font-weight: 600; }

#account-auth-modal {
  position: fixed; inset: 0; z-index: 4100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#account-auth-modal[hidden] { display: none; }
#aam-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.88); backdrop-filter: blur(6px); }
#aam-phone, #aam-password, #aam-name {
  width: 100%; padding: 13px 16px; margin-bottom: 14px;
  background: rgba(255,255,255,0.05); border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 10px; color: #f1f5f9; font-size: 1rem; font-family: inherit;
  outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
#aam-phone:focus, #aam-password:focus, #aam-name:focus { border-color: #16a34a; }
#aam-submit {
  width: 100%; margin-top: 2px; padding: 14px; background: #2563eb; color: #fff;
  font-size: 1rem; font-weight: 700; border: none; border-radius: 10px; cursor: pointer;
}
#aam-submit:hover { background: #1d4ed8; }
#aam-submit:disabled { opacity: 0.6; cursor: not-allowed; }
#aam-close {
  background: rgba(255,255,255,0.15); border: none; border-radius: 50%; width: 32px; height: 32px;
  color: #fff; font-size: 18px; line-height: 1; cursor: pointer; flex-shrink: 0;
}
#aam-name-field[hidden] { display: none; }
#aam-password-field[hidden] { display: none; }

/* "Mods Zangu" purchase cards — reuses .download-item's layout shape but
   with a server-fetched download button instead of play/delete. */
.my-purchase-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--card-bg, #121826); border: 1px solid var(--card-border, #232b3d);
  border-radius: 12px; margin-bottom: 10px;
}
.my-purchase-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #1e293b; }
.my-purchase-info { flex: 1; min-width: 0; }
.my-purchase-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-purchase-meta { margin: 0; font-size: 12px; color: var(--text-secondary); }
.my-purchase-download-btn {
  flex-shrink: 0; padding: 8px 14px; background: #2563eb; color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.my-purchase-download-btn:disabled { opacity: 0.6; cursor: not-allowed; }
