/* ============================================================
   بدنساز هوشمند — Round 7 Styling Upgrade
   Workout logger, leaderboard, progress charts, polish
   ============================================================ */

/* ============================================================
   WORKOUT LOGGER
   ============================================================ */
.log-exercise-card {
  background: var(--surf1); border: 1px solid var(--border); border-radius: var(--r);
  padding: 20px; margin-bottom: 14px; transition: var(--transition);
}
.log-exercise-card:hover { border-color: var(--border2); }
.log-exercise-card.expanded { border-color: rgba(212,168,67,.3); }

.log-ex-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; flex-wrap: wrap;
}
.log-ex-name { font-size: 15px; font-weight: 800; color: var(--gold); }
.log-ex-en { font-size: 11px; color: var(--muted); margin-top: 2px; }
.log-ex-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.log-ex-toggle {
  background: var(--surf3); border: 1px solid var(--border); color: var(--text-2);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px;
  transition: var(--transition); display: flex; align-items: center; justify-content: center;
}
.log-ex-toggle:hover { background: var(--gold-dim); color: var(--gold); border-color: var(--gold); }
.log-ex-toggle.open { transform: rotate(180deg); }

.log-sets-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.log-sets-table th {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--border);
}
.log-sets-table td { padding: 6px; text-align: center; border-bottom: 1px solid rgba(44,44,58,.4); }
.log-sets-input {
  width: 100%; max-width: 80px; padding: 8px 6px; text-align: center;
  background: var(--surf2); border: 1px solid var(--border2); border-radius: 7px;
  color: var(--text); font-size: 14px; font-weight: 700; font-family: inherit;
  transition: var(--transition);
}
.log-sets-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-dim); }
.log-set-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: var(--gold-dim);
  color: var(--gold); font-size: 12px; font-weight: 800;
}
.log-set-remove {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 4px; transition: var(--transition);
}
.log-set-remove:hover { color: var(--danger); }

.log-ex-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.log-add-set-btn {
  background: var(--surf2); border: 1px dashed var(--border2); color: var(--text-2);
  padding: 8px 16px; border-radius: 9px; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: var(--transition); font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
}
.log-add-set-btn:hover { border-color: var(--gold); color: var(--gold); border-style: solid; }

.log-ex-volume {
  font-size: 11px; color: var(--gold); font-weight: 700;
  background: var(--gold-dim); padding: 3px 9px; border-radius: 5px;
}

/* Saved badge */
.log-saved-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(62,188,120,.13); color: var(--success);
  padding: 3px 9px; border-radius: 5px; font-size: 11px; font-weight: 700;
}

/* Logger summary */
.log-summary {
  background: linear-gradient(135deg, var(--surf1), var(--surf2));
  border: 1px solid var(--border2); border-radius: var(--r);
  padding: 22px; margin-bottom: 22px;
}
.log-summary h3 { font-size: 16px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.log-summary-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
.log-sum-stat { text-align: center; }
.log-sum-stat .v { font-size: 24px; font-weight: 900; color: var(--gold); }
.log-sum-stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   EXERCISE PROGRESS CHART (mini, per exercise)
   ============================================================ */
.ex-progress-chart { width: 100%; height: 80px; margin-top: 10px; }
.ex-progress-chart .line { stroke: var(--gold); stroke-width: 2; fill: none; stroke-linecap: round; }
.ex-progress-chart .area { fill: url(#exAreaGrad); opacity: .3; }
.ex-progress-chart .point { fill: var(--gold); stroke: var(--bg); stroke-width: 2; }
.ex-progress-chart .axis { stroke: var(--border); stroke-width: 1; }
.ex-progress-chart .label { fill: var(--muted); font-size: 9px; }

/* ============================================================
   LEADERBOARD
   ============================================================ */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
  padding: 14px 12px; text-align: center; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.lb-table td { padding: 14px 12px; text-align: center; border-bottom: 1px solid rgba(44,44,58,.4); }
.lb-table tbody tr { transition: background .15s; }
.lb-table tbody tr:hover { background: rgba(212,168,67,.04); }
.lb-table tbody tr.me { background: var(--gold-dim); }
.lb-table tbody tr.me:hover { background: rgba(212,168,67,.15); }

.lb-rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; font-weight: 900; font-size: 14px;
}
.lb-rank.r1 { background: linear-gradient(135deg, #ffd700, #ffa500); color: #4a2c00; box-shadow: 0 4px 12px rgba(255,165,0,.3); }
.lb-rank.r2 { background: linear-gradient(135deg, #e0e0e0, #b0b0b0); color: #333; box-shadow: 0 4px 12px rgba(176,176,176,.2); }
.lb-rank.r3 { background: linear-gradient(135deg, #cd7f32, #a0522d); color: #fff; box-shadow: 0 4px 12px rgba(205,127,50,.3); }
.lb-rank.other { background: var(--surf3); color: var(--muted); }

.lb-user { display: flex; align-items: center; gap: 10px; justify-content: flex-start; }
.lb-ava {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), var(--core));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #1a1208; font-size: 14px;
}
.lb-name { font-weight: 700; font-size: 13.5px; text-align: right; }
.lb-streak-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700;
}

.lb-filter {
  display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap;
}
.lb-filter button {
  padding: 8px 16px; border-radius: 10px; font-size: 12.5px; font-weight: 700;
  background: var(--surf2); border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.lb-filter button:hover { border-color: var(--gold); color: var(--gold); }
.lb-filter button.active { background: var(--gold); color: #1a1208; border-color: var(--gold); }

.lb-optin-banner {
  background: var(--gold-dim); border: 1px solid rgba(212,168,67,.25);
  border-radius: var(--r); padding: 16px 20px; margin-bottom: 22px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.lb-optin-banner .ic { font-size: 28px; }
.lb-optin-banner .tx { flex: 1; min-width: 200px; }
.lb-optin-banner .tx h4 { font-size: 14px; font-weight: 800; color: var(--gold); margin-bottom: 3px; }
.lb-optin-banner .tx p { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }

/* ============================================================
   IMPROVED BUTTON VARIANTS
   ============================================================ */
.btn-success {
  background: linear-gradient(135deg, var(--success), #2da55c);
  color: #fff; box-shadow: 0 4px 14px -2px rgba(62,188,120,.35);
}
.btn-success:hover {
  box-shadow: 0 8px 24px -2px rgba(62,188,120,.5); transform: translateY(-2px);
}

/* ============================================================
   PROGRESS RING (large, for stats)
   ============================================================ */
.big-ring-wrap { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.big-ring { transform: rotate(-90deg); }
.big-ring circle { fill: none; stroke-width: 10; }
.big-ring .bg { stroke: var(--surf3); }
.big-ring .fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.7,.2,1); }
.big-ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.big-ring-center .v { font-size: 26px; font-weight: 900; color: var(--gold); }
.big-ring-center .l { font-size: 10px; color: var(--muted); }

/* ============================================================
   MOBILE POLISH
   ============================================================ */
@media (max-width: 640px) {
  .log-sets-table th:nth-child(4), .log-sets-table td:nth-child(4) { display: none; }
  .log-ex-meta { gap: 6px; }
  .lb-table th, .lb-table td { padding: 10px 6px; font-size: 12px; }
  .lb-name { font-size: 12px; }
}

/* ============================================================
   TOAST IMPROVEMENT (slide in from bottom on mobile)
   ============================================================ */
@media (max-width: 640px) {
  .toast-wrap { top: auto; bottom: 16px; left: 16px; right: 16px; transform: none; }
  .toast { width: 100%; min-width: 0; animation: slideInUp .3s ease; }
  @keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ============================================================
   CARD HOVER GLOW
   ============================================================ */
.card-hover-glow { position: relative; transition: var(--transition); }
.card-hover-glow::after {
  content: ''; position: absolute; inset: -1px; border-radius: var(--r);
  background: linear-gradient(135deg, var(--gold-dim), transparent 50%);
  opacity: 0; transition: opacity .3s; pointer-events: none; z-index: -1;
}
.card-hover-glow:hover::after { opacity: 1; }

/* ============================================================
   IMPROVED TIMELINE (activity feed)
   ============================================================ */
.timeline { position: relative; padding-right: 24px; }
.timeline::before {
  content: ''; position: absolute; top: 0; bottom: 0; right: 11px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding: 14px 0; }
.timeline-item .ti-dot {
  position: absolute; right: 4px; top: 18px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surf3); border: 3px solid var(--bg); z-index: 1;
}
.timeline-item .ti-dot.gold { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.timeline-item .ti-dot.green { background: var(--success); box-shadow: 0 0 0 3px rgba(62,188,120,.15); }
.timeline-item .ti-dot.red { background: var(--push); box-shadow: 0 0 0 3px rgba(224,92,74,.15); }
.timeline-item .ti-content { padding-right: 28px; }
.timeline-item .ti-time { font-size: 11px; color: var(--muted); }
.timeline-item .ti-text { font-size: 13.5px; color: var(--text-2); margin-top: 2px; line-height: 1.6; }
