/* ═══════════════════════════════════════════
   PROFILE.CSS — CyberEduc
═══════════════════════════════════════════ */

/* Grid background */
.profile-bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(0,255,136,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,136,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* ══════════════════════════
   PROFILE HEADER
══════════════════════════ */
.profile-header {
  padding: 100px 80px 60px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0,255,136,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.profile-header-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 48px;
  position: relative;
  z-index: 1;
}

/* ── Avatar ── */
.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--green-glow);
}

.avatar-initials {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.02em;
}

.profile-level-ring {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #000;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}

/* ── User info ── */
.profile-info {
  flex: 1;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.profile-name {
  font-size: 32px;
  color: var(--text);
  letter-spacing: -0.03em;
}

.profile-rank {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green);
  background: var(--green-glow-s);
  border: 1px solid rgba(0,255,136,0.2);
  border-radius: 100px;
  padding: 4px 12px;
}

.profile-email {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.profile-joined {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* XP bar */
.profile-xp {
  max-width: 400px;
}

.xp-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.xp-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.xp-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green);
}

.xp-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.xp-next {
  font-size: 12px;
  color: var(--text-dim);
}

.xp-next strong {
  color: var(--text-muted);
}

/* ── Quick actions ── */
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

/* ══════════════════════════
   STATS ROW
══════════════════════════ */
.profile-stats {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 32px 80px;
}

.profile-stats-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.stat-card:last-child {
  border-right: none;
}

.stat-card-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.stat-card-number {
  font-family: var(--font-mono);
  font-size: 32px;
  color: var(--green);
  font-weight: 700;
  line-height: 1;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ══════════════════════════
   SHARED SECTION STYLES
══════════════════════════ */
.profile-section-inner {
  max-width: var(--container);
  margin: 0 auto;
}

.profile-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 40px;
}

.profile-section-title {
  font-size: 28px;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-top: 8px;
}

.badges-count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

/* ══════════════════════════
   BADGES GRID
══════════════════════════ */
.profile-badges {
  padding: 64px 80px;
  border-bottom: 1px solid var(--border);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.badge-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: var(--transition-s);
  position: relative;
  overflow: hidden;
}

/* Earned badge */
.badge-earned {
  border-color: rgba(0,255,136,0.2);
  background: linear-gradient(135deg, var(--bg-2) 0%, rgba(0,255,136,0.03) 100%);
}

.badge-earned:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,255,136,0.3);
}

/* Locked badge */
.badge-locked {
  opacity: 0.45;
  filter: grayscale(0.3);
}

.badge-locked:hover {
  opacity: 0.6;
}

/* Special badge (Human Firewall) */
.badge-special {
  border-color: rgba(255,215,0,0.2);
}

.badge-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.badge-earned .badge-icon-wrap {
  background: var(--green-glow-s);
  border-color: rgba(0,255,136,0.2);
  box-shadow: 0 0 20px var(--green-glow-s);
}

.badge-icon {
  font-size: 28px;
}

.badge-name {
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.badge-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.badge-status {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 100px;
  margin-top: 4px;
}

.badge-status.earned {
  color: var(--green);
  background: var(--green-glow-s);
  border: 1px solid rgba(0,255,136,0.2);
}

.badge-status.locked {
  color: var(--text-dim);
  background: var(--bg-3);
  border: 1px solid var(--border);
}

/* ══════════════════════════
   LESSON PROGRESS LIST
══════════════════════════ */
.profile-lessons {
  padding: 64px 80px;
  border-bottom: 1px solid var(--border);
}

.lessons-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lp-item {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: var(--transition);
}

.lp-item:hover {
  border-color: var(--border-light);
}

.lp-done {
  border-color: rgba(0,255,136,0.1);
}

.lp-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}

.lp-info {
  flex: 1;
}

.lp-title {
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.lp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lp-bar {
  flex: 1;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.lp-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.lp-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
}

.lp-status {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 100px;
}

.lp-status--done {
  color: var(--green);
  background: var(--green-glow-s);
  border: 1px solid rgba(0,255,136,0.2);
}

.lp-status--start {
  color: var(--text);
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  text-decoration: none;
  transition: var(--transition);
}

.lp-status--start:hover {
  color: var(--green);
  border-color: rgba(0,255,136,0.3);
}

/* ══════════════════════════
   EDIT PROFILE MODAL
══════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
}

/* Reuse form styles from auth.css */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text);
  transition: var(--transition);
  outline: none;
  box-sizing: border-box;
}

.form-input::placeholder { color: var(--text-dim); }

.form-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow-s);
}

/* ══════════════════════════
   FOOTER
══════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 64px 80px 32px;
}

.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 64px;
  margin-bottom: 48px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.footer-links { display: flex; gap: 64px; }

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-col h4 {
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.footer-col a {
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
  text-decoration: none;
}

.footer-col a:hover { color: var(--green); }

.footer-bottom {
  max-width: var(--container);
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.footer-bottom p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* ══════════════════════════
   RESPONSIVE
══════════════════════════ */
@media (max-width: 1024px) {
  .profile-header  { padding: 100px 40px 48px; }
  .profile-stats   { padding: 24px 40px; }
  .profile-badges  { padding: 48px 40px; }
  .profile-lessons { padding: 48px 40px; }
  .footer          { padding: 48px 40px 24px; }
  .badges-grid     { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .profile-header       { padding: 90px 24px 40px; }
  .profile-header-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .profile-actions      { flex-direction: row; }
  .profile-stats        { padding: 20px 24px; }
  .profile-stats-inner  { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(2){ border-right: none; }
  .stat-card:nth-child(3){ border-right: 1px solid var(--border); border-top: 1px solid var(--border); }
  .stat-card:nth-child(4){ border-top: 1px solid var(--border); }
  .profile-badges       { padding: 40px 24px; }
  .badges-grid          { grid-template-columns: repeat(2, 1fr); }
  .profile-lessons      { padding: 40px 24px; }
  .footer               { padding: 40px 24px 24px; }
  .footer-inner         { flex-direction: column; gap: 40px; }
  .footer-links         { flex-direction: column; gap: 32px; }
  .lp-item              { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .badges-grid { grid-template-columns: 1fr 1fr; }
}
