/* =========================
   DEFAULT HIDDEN STATES
========================= */
#profileLoader,
#notLoggedIn,
#profileContent {
  display: none;
}

/* =========================
   WRAPPER
========================= */
.profile-container {
  max-width: 1000px;
  margin: calc(var(--nav-h) + 32px) auto 60px;
  padding: 0 18px;
  font-family: var(--font-body);
}

/* =========================
   LOADER
========================= */
#profileLoader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50vh;
  flex-direction: column;
  gap: 12px;
  color: var(--text-secondary);
}

.spinner-ring {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =========================
   GRID
========================= */
#profileContent {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
}

/* =========================
   CARDS
========================= */
.profile-card,
.purchases-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.profile-card:hover,
.purchases-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

/* =========================
   HEADINGS
========================= */
.profile-card h2,
.purchases-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================
   INFO ROW
========================= */
.info-row {
  display: grid;
  grid-template-columns: 20px 80px 1fr;
  gap: 10px;
  align-items: center;

  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row i {
  font-size: 13px;
  color: var(--accent);
}

.info-label {
  font-size: 13px;
  color: var(--text-muted);
}

.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================
   ACTION BUTTONS
========================= */
.profile-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-btn,
.danger-btn,
.btn-disabled {
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s ease;
}

/* secondary */
.secondary-btn {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* danger */
.danger-btn {
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
}

.danger-btn:hover {
  background: #b91c1c;
  color: #fff;
}

/* disabled */
.btn-disabled {
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* =========================
   PURCHASE LIST
========================= */
.purchases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ITEM */
.purchase-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-section);

  transition: 0.2s ease;
}

.purchase-item:hover {
  border-color: var(--accent-border);
  background: var(--bg-alt);
}

/* info */
.purchase-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.purchase-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.purchase-price {
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================
   DOWNLOAD BUTTON (UPGRADED)
========================= */
.purchase-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;

  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-pill);

  display: inline-flex;
  align-items: center;
  gap: 6px;

  cursor: pointer;
  transition: all 0.2s ease;
}

.purchase-btn:hover {
  background: var(--accent-mid);
  border-color: var(--accent-mid);
}

.purchase-btn:active {
  transform: scale(0.95);
}

/* =========================
   NOT LOGGED IN (IMPORTANT)
========================= */
#notLoggedIn {
  max-width: 420px;
  margin: 80px auto;
  text-align: center;
}

#notLoggedIn h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

#notLoggedIn p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* login button */
.exppr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  padding: 10px 16px;
  border-radius: var(--radius-pill);

  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;

  transition: 0.2s ease;
}

.exppr:hover {
  background: var(--accent-mid);
}

/* =========================
   EMPTY STATE
========================= */
.empty-state {
  text-align: center;
  padding: 26px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--text-secondary);
}

.empty-state.small {
  padding: 18px;
  font-size: 13px;
}

/* =========================
   TOTAL BOX
========================= */
.total-box {
  margin-top: 14px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
}

/* =========================
   ANIMATION
========================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
  #profileContent {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .profile-card,
  .purchases-card {
    padding: 16px;
  }

  .info-row {
    grid-template-columns: 18px 70px 1fr;
  }

  .purchase-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .purchase-btn {
    width: 100%;
    justify-content: center;
  }

  .profile-actions {
    flex-direction: column;
  }

  .secondary-btn,
  .danger-btn,
  .btn-disabled {
    justify-content: center;
  }

  #notLoggedIn {
    margin: 60px auto;
    padding: 0 10px;
  }
}