/* ============================================================
   Chemistry Made Easy — Profile Page (Premium Design)
   ============================================================ */

/* ── Profile Hero Override ───────────────────────────────────── */

.profile-hero {
  position: relative;
  padding: 4rem 0 3rem;
  background: linear-gradient(135deg, #0c1929 0%, #0f2942 40%, #0d3b4f 70%, #0a4040 100%);
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.profile-hero::after {
  content: '';
  position: absolute;
  bottom: -60%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.profile-hero__inner {
  display: flex;
  align-items: center;
  gap: 2rem;
}

@media (max-width: 768px) {
  .profile-hero__inner {
    flex-direction: column;
    text-align: center;
  }
}


/* ── Premium Avatar ──────────────────────────────────────────── */

.profile-avatar-xl {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar-xl__ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, #14b8a6, #0d9488, #6366f1);
  animation: profAvatarGlow 4s ease-in-out infinite;
}

.profile-avatar-xl__inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  overflow: hidden;
  border: 3px solid #0c1929;
}

.profile-avatar-xl__inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-xl__badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #22c55e;
  border: 3px solid #0c1929;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-xl__badge svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
  stroke-width: 3;
  fill: none;
}

@keyframes profAvatarGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(20, 184, 166, 0.2); }
  50%      { box-shadow: 0 0 35px rgba(20, 184, 166, 0.35); }
}

/* ── Hero Info ────────────────────────────────────────────────── */

.profile-hero__info {
  flex: 1;
  min-width: 0;
}

.profile-hero__name {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.profile-hero__email {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 0.75rem;
}

.profile-hero__meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.profile-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.profile-hero__tag svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.profile-hero__tag--provider {
  background: rgba(20, 184, 166, 0.12);
  color: #5eead4;
  border-color: rgba(20, 184, 166, 0.15);
}

/* Hero Actions */
.profile-hero__actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .profile-hero__actions {
    width: 100%;
    justify-content: center;
  }
}


/* ── Content area ────────────────────────────────────────────── */

.profile-content {
  padding-bottom: 4rem;
}

.profile-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-teal);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}


/* ── Premium Cards ───────────────────────────────────────────── */

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

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

.profile-card {
  position: relative;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  border-radius: var(--radius-lg);
  background: var(--color-glass-card-bg);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  cursor: default;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--color-teal), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.profile-card:hover {
  border-color: rgba(20, 184, 166, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: none;
}

.profile-card:hover::before {
  opacity: 1;
}

.profile-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.profile-card__icon--account {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(20, 184, 166, 0.05));
  color: var(--color-teal);
}

.profile-card__icon--prefs {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.05));
  color: #818cf8;
}

.profile-card__icon--stats {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.05));
  color: #fbbf24;
}

.profile-card__icon--danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.05));
  color: #f87171;
}

.profile-card__title {
  font-size: 1.05rem !important;
  font-weight: 700;
  margin: 0 0 0.2rem !important;
  color: var(--color-navy);
}

.profile-card__subtitle {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-lg);
  max-width: none;
}


/* ── Form Fields (Premium) ───────────────────────────────────── */

.profile-field {
  margin-bottom: var(--space-md);
}

.profile-field:last-child {
  margin-bottom: 0;
}

.profile-field__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.profile-field__input,
.profile-field__select {
  width: 100%;
  padding: 11px 14px;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  outline: none;
  -webkit-appearance: none;
}

.profile-field__input:focus,
.profile-field__select:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
  background: var(--color-surface);
}

.profile-field__input--readonly {
  opacity: 0.55;
  cursor: not-allowed;
}

.profile-field__input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.4;
}

.profile-field__select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.profile-field__text {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
}


/* ── Provider Badge ──────────────────────────────────────────── */

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(20, 184, 166, 0.08);
  color: var(--color-teal);
  border: 1px solid rgba(20, 184, 166, 0.12);
}


/* ── Stats Ring Section ──────────────────────────────────────── */

.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
  .profile-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.profile-stat-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-lg) var(--space-sm);
  background: var(--color-surface-sunken);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  transition: border-color 0.2s, transform 0.2s;
}

.profile-stat-ring:hover {
  border-color: rgba(20, 184, 166, 0.2);
  transform: translateY(-2px);
}

.profile-stat-ring__circle {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 0.6rem;
}

.profile-stat-ring__circle svg {
  transform: rotate(-90deg);
  width: 64px;
  height: 64px;
}

.profile-stat-ring__circle .ring-bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 4;
}

.profile-stat-ring__circle .ring-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-stat-ring__circle .ring-fill--teal   { stroke: #14b8a6; }
.profile-stat-ring__circle .ring-fill--indigo  { stroke: #818cf8; }
.profile-stat-ring__circle .ring-fill--amber   { stroke: #fbbf24; }
.profile-stat-ring__circle .ring-fill--rose    { stroke: #f472b6; }

.profile-stat-ring__value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-navy);
}

.profile-stat-ring__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* ── Completion Bar ──────────────────────────────────────────── */

.profile-completion {
  padding: var(--space-lg);
  background: var(--color-surface-sunken);
  border-radius: 14px;
  border: 1px solid var(--color-border);
}

.profile-completion__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.profile-completion__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
}

.profile-completion__pct {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-teal);
}

.profile-completion__track {
  height: 10px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.profile-completion__fill {
  height: 100%;
  background: linear-gradient(90deg, #0d9488, #14b8a6, #5eead4);
  border-radius: 999px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.profile-completion__fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}


/* ── Danger Zone ─────────────────────────────────────────────── */

.profile-card--danger {
  border-color: rgba(239, 68, 68, 0.1);
}

.profile-card--danger::before {
  background: linear-gradient(90deg, transparent, #ef4444, transparent);
}

.profile-card--danger:hover {
  border-color: rgba(239, 68, 68, 0.2);
}

.profile-btn--danger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 0.6rem;
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid rgba(239, 68, 68, 0.1);
  border-radius: 10px;
  color: #ef4444;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.profile-btn--danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  transform: translateX(4px);
}

.profile-btn--danger:last-child { margin-bottom: 0; }

.profile-btn--danger svg {
  flex-shrink: 0;
}


/* ── Save Bar ────────────────────────────────────────────────── */

.profile-save {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-strong);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
  padding: var(--space-md) 0;
  animation: profSaveSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.profile-save__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-save__inner > span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-save__inner > span::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  animation: pulse 1.5s ease-in-out infinite;
}

.profile-save__actions {
  display: flex;
  gap: 0.5rem;
}

@keyframes profSaveSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

@media (max-width: 480px) {
  .profile-save__inner {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}


/* ── Dark mode enhancements ──────────────────────────────────── */

[data-theme="dark"] .profile-hero {
  background: linear-gradient(135deg, #0a1220 0%, #0c1e35 40%, #0d2d3f 70%, #0a3333 100%);
}

/* ── New Profile UI Components ───────────────────────────────── */

.profile-grid-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

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

.profile-status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  margin-top: 1rem;
}

.profile-status-box__info {
  display: flex;
  flex-direction: column;
}

.profile-status-box__label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.profile-status-box__value {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-teal);
}

.profile-card__info-text {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* ── Refined Stats ─────────────────────────────────────────── */

.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

@media (max-width: 991px) {
  .profile-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.profile-stat-ring {
  background: var(--color-glass-card-bg);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  padding: 1.5rem 1rem;
}

/* ── Danger Zone Polish ────────────────────────────────────── */

.profile-card--danger {
  border-color: rgba(239, 68, 68, 0.1);
  background: rgba(239, 68, 68, 0.02);
}

[data-theme="dark"] .profile-card--danger {
  background: rgba(239, 68, 68, 0.03);
}

.profile-btn--danger {
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  transition: all 0.2s ease;
}

.profile-btn--danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  transform: translateY(-2px);
  color: #ef4444;
}
