/* ═══════════════════════════════════════════════
   Profile Page — Premium Redesign — HabiBayan
   ═══════════════════════════════════════════════ */

/* ─── Loading / Empty States ─── */
.hb-profile-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 80px 20px 40px;
  gap: 16px;
  color: var(--earth, #5A5248);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
}

.hb-profile-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(232, 98, 42, 0.15);
  border-top-color: var(--sunset, #E8622A);
  border-radius: 50%;
  animation: hb-spin 0.7s linear infinite;
}

@keyframes hb-spin { to { transform: rotate(360deg); } }

.hb-profile-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 80px 20px 40px;
  gap: 16px;
  text-align: center;
}

.hb-profile-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--cream, #FDF6EC);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sunset, #E8622A);
}

.hb-profile-empty h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  color: var(--deep, #16213E);
  margin: 0;
}

.hb-profile-empty p {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--earth, #5A5248);
  max-width: 400px;
  margin: 0;
  line-height: 1.6;
}

/* ─── Split Container ─── */
.hb-profile-split {
  display: flex;
  min-height: calc(100vh - 72px);
  margin-top: 72px;
}

/* ─── LEFT PANEL ─── */
.hb-profile-left {
  width: 360px;
  flex-shrink: 0;
  background: linear-gradient(170deg, #0B1A33 0%, var(--deep, #16213E) 40%, #0F3460 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hb-profile-left-decor {
  position: absolute;
  top: -80px;
  right: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(245, 166, 35, 0.06);
  pointer-events: none;
}

.hb-profile-left-decor::after {
  content: '';
  position: absolute;
  bottom: -120px;
  left: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(232, 98, 42, 0.05);
}

.hb-profile-left-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 28px 32px;
  flex: 1;
  justify-content: center;
}

/* Avatar with ring */
.hb-profile-avatar-wrap {
  position: relative;
  margin-bottom: 24px;
}

.hb-profile-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sunset, #E8622A), var(--gold, #F5A623));
  color: #fff;
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(232, 98, 42, 0.3);
  position: relative;
  z-index: 1;
}

.hb-profile-avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(245, 166, 35, 0.25);
  animation: hb-ring-spin 20s linear infinite;
}

@keyframes hb-ring-spin { to { transform: rotate(360deg); } }

/* Name */
.hb-profile-name {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.2;
  color: #fff;
}

/* Location */
.hb-profile-location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 20px;
}

.hb-profile-location svg {
  opacity: 0.5;
  flex-shrink: 0;
}

/* Badge Progress Bar */
.hb-profile-progress-wrap {
  width: 100%;
  max-width: 240px;
  margin-bottom: 24px;
}

.hb-profile-progress-label {
  display: flex;
  justify-content: space-between;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 8px;
}

.hb-profile-progress-label strong {
  color: var(--gold, #F5A623);
}

.hb-profile-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
}

.hb-profile-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sunset, #E8622A), var(--gold, #F5A623));
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Mini badge row in left panel */
.hb-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}

.hb-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(232, 98, 42, 0.12);
  color: var(--gold, #F5A623);
  border: 1px solid rgba(245, 166, 35, 0.15);
}

.hb-profile-badge-gold {
  background: rgba(245, 166, 35, 0.12);
  color: var(--gold, #F5A623);
  border-color: rgba(245, 166, 35, 0.2);
}

.hb-profile-badge-earned {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(46, 204, 113, 0.12);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.2);
}

.hb-profile-badge-earned img {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

/* Left Actions */
.hb-profile-left-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 220px;
}

.hb-btn-glow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--sunset, #E8622A);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(232, 98, 42, 0.35);
}

.hb-btn-glow:hover {
  background: #D4551F;
  box-shadow: 0 6px 28px rgba(232, 98, 42, 0.45);
  transform: translateY(-1px);
}

.hb-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

.hb-btn-ghost:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

/* Tagline */
.hb-profile-left-tagline {
  margin-top: auto;
  padding-top: 24px;
}

.hb-profile-left-tagline p {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.12);
  margin: 0;
}

/* ─── RIGHT PANEL ─── */
.hb-profile-right {
  flex: 1;
  background: #F5F2ED;
  display: flex;
  align-items: stretch;
  overflow-y: auto;
}

.hb-profile-right-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 44px;
  gap: 24px;
}

/* Section Cards */
.hb-profile-section {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.03);
}

.hb-profile-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.hb-profile-section-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(232, 98, 42, 0.08), rgba(245, 166, 35, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sunset, #E8622A);
  flex-shrink: 0;
}

.hb-profile-section-head h2 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--deep, #16213E);
  margin: 0;
}

/* Detail Grid */
.hb-profile-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.hb-detail {
  padding: 12px 14px;
  border-radius: 10px;
  background: #FAFAF8;
  transition: background 0.2s;
}

.hb-detail:hover {
  background: #F5F2ED;
}

.hb-detail-full {
  grid-column: 1 / -1;
}

.hb-detail-label {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--earth, #5A5248);
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.hb-detail-value {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--deep, #16213E);
  word-break: break-word;
}

/* Divider — hidden now since we use card layout */
.hb-profile-divider {
  display: none;
}

/* ─── Merged Full-Width Card ─── */
.hb-profile-section-full {
  padding: 0;
}

.hb-profile-subsection {
  padding: 28px;
}

.hb-profile-section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.06) 20%, rgba(0,0,0,0.06) 80%, transparent);
  margin: 0;
}

/* ─── BADGE SHOWCASE ─── */
.hb-badge-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.hb-badge-progress-header span {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--earth, #5A5248);
}

.hb-badge-progress-header strong {
  color: var(--sunset, #E8622A);
}

.hb-badge-progress-track {
  flex: 1;
  max-width: 180px;
  height: 5px;
  background: #F0EDE8;
  border-radius: 100px;
  overflow: hidden;
  margin-left: 16px;
}

.hb-badge-progress-track-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sunset, #E8622A), var(--gold, #F5A623));
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.hb-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.hb-badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 12px 18px;
  border-radius: 16px;
  background: #FAFAF8;
  border: 1.5px solid transparent;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.hb-badge-card.earned {
  background: #fff;
  border-color: rgba(232, 98, 42, 0.12);
  box-shadow: 0 4px 20px rgba(232, 98, 42, 0.06);
}

.hb-badge-card.earned:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(232, 98, 42, 0.12);
  border-color: rgba(232, 98, 42, 0.2);
}

.hb-badge-card.earned::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sunset, #E8622A), var(--gold, #F5A623));
}

.hb-badge-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.hb-badge-card.locked:hover {
  opacity: 0.65;
}

/* Badge image circle */
.hb-badge-card-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: contain;
  margin-bottom: 12px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.hb-badge-card-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(232, 98, 42, 0.1), rgba(245, 166, 35, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--sunset, #E8622A);
}

.hb-badge-card.locked .hb-badge-card-placeholder {
  background: rgba(0,0,0,0.04);
  color: #999;
}

.hb-badge-card-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--deep, #16213E);
  margin-bottom: 2px;
  line-height: 1.3;
}

.hb-badge-card-circle {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--earth, #5A5248);
  opacity: 0.5;
}

/* Earned checkmark */
.hb-badge-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(46, 204, 113, 0.3);
}

.hb-badge-card-check svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
  stroke-width: 3;
  fill: none;
}

/* Lock icon */
.hb-badge-card-lock {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hb-badge-card-lock svg {
  width: 10px;
  height: 10px;
  stroke: #999;
  stroke-width: 2;
  fill: none;
}

/* ─── Buttons ─── */
.hb-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 28px;
  background: var(--sunset, #E8622A);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.hb-btn-primary:hover {
  background: #D4551F;
  transform: translateY(-1px);
}

.hb-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 28px;
  background: var(--cream, #FDF6EC);
  color: var(--earth, #5A5248);
  border: 1px solid rgba(90, 82, 72, 0.1);
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.hb-btn-secondary:hover {
  background: #F5EDE0;
}

/* ─── Modal ─── */
.hb-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(11, 26, 51, 0.5);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hb-modal-content {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(11, 26, 51, 0.2);
  animation: hb-modal-in 0.3s ease-out;
}

@keyframes hb-modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.hb-modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--deep, #16213E);
  margin: 0;
}

.hb-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--cream, #FDF6EC);
  border-radius: 10px;
  font-size: 20px;
  color: var(--earth, #5A5248);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.hb-modal-close:hover {
  background: #F0E6D6;
}

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

.hb-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.hb-modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hb-modal-field label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--earth, #5A5248);
}

.hb-modal-field input,
.hb-modal-field select {
  padding: 10px 14px;
  border: 1.5px solid rgba(22, 33, 62, 0.1);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--deep, #16213E);
  background: var(--warm-white, #FFFDF9);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.hb-modal-field input:focus,
.hb-modal-field select:focus {
  border-color: var(--sunset, #E8622A);
  box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.08);
}

.hb-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 28px 24px;
}

/* ─── RESPONSIVE ─── */

@media (max-width: 960px) {
  .hb-profile-split {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 72px);
    overflow: visible;
  }

  .hb-profile-left {
    width: 100%;
  }

  .hb-profile-left-inner {
    padding: 36px 28px 28px;
    justify-content: flex-start;
  }

  .hb-profile-avatar {
    width: 80px;
    height: 80px;
    font-size: 34px;
  }

  .hb-profile-name {
    font-size: 22px;
  }

  .hb-profile-left-tagline {
    display: none;
  }

  .hb-profile-left-actions {
    flex-direction: row;
    max-width: 100%;
    justify-content: center;
  }

  .hb-profile-right {
    min-height: auto;
  }

  .hb-profile-right-inner {
    padding: 24px 20px;
  }
}

@media (max-width: 600px) {
  .hb-profile-split {
    margin-top: 60px;
  }

  .hb-profile-left-inner {
    padding: 28px 20px 24px;
  }

  .hb-profile-avatar {
    width: 68px;
    height: 68px;
    font-size: 28px;
  }

  .hb-profile-name {
    font-size: 20px;
  }

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

  .hb-profile-right-inner {
    padding: 16px 14px;
    gap: 16px;
  }

  .hb-profile-section {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .hb-profile-subsection {
    padding: 20px 16px;
  }

  .hb-profile-section-head h2 {
    font-size: 16px;
  }

  .hb-profile-detail-grid {
    grid-template-columns: 1fr;
  }

  .hb-badge-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }

  .hb-badge-card {
    padding: 18px 8px 14px;
  }

  .hb-modal-row {
    grid-template-columns: 1fr;
  }

  .hb-modal-header,
  .hb-modal-body,
  .hb-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}
