/* ================================================
   USER PROFILE SYSTEM — MAIN STYLES
   Font: Sora (display) + DM Sans (body)
   Theme: Deep dark, teal accent, minimal UI
================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f14;
  --bg2:       #13161e;
  --bg3:       #1a1e2a;
  --card:      #1e2231;
  --border:    #2a2f42;
  --border2:   #353b52;
  --teal:      #2dd4bf;
  --teal-dim:  #1a8a7a;
  --teal-glow: rgba(45, 212, 191, 0.12);
  --text:      #e8eaf0;
  --text2:     #8b90a8;
  --text3:     #555b72;
  --red:       #ff5f6d;
  --green:     #34d399;
  --yellow:    #fbbf24;
  --radius:    12px;
  --radius-lg: 20px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a { color: var(--teal); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

img { display: block; max-width: 100%; }

/* ─── Auth Layout (login / signup) ─── */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  background: var(--bg2);
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45,212,191,0.08) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}

.auth-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45,212,191,0.05) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  pointer-events: none;
}

.auth-brand {
  text-align: center;
  z-index: 1;
}

.auth-brand .logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dim));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 1.5rem;
  box-shadow: 0 0 40px rgba(45,212,191,0.25);
}

.auth-brand h1 {
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.auth-brand p {
  color: var(--text2);
  font-size: 0.95rem;
  max-width: 280px;
}

.auth-tagline {
  margin-top: 3rem;
  z-index: 1;
  text-align: center;
}

.auth-tagline .feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text2);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.auth-tagline .feature span.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h2 {
  font-size: 1.75rem;
  margin-bottom: 0.4rem;
}

.auth-card .subtitle {
  color: var(--text2);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ─── Form Elements ─── */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text3);
}

.form-group textarea {
  resize: vertical;
  min-height: 90px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.85rem 1.5rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--teal);
  color: #0d0f14;
  width: 100%;
  font-weight: 600;
}

.btn-primary:hover {
  background: #27bba8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(45,212,191,0.25);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border2);
  background: var(--card);
}

.btn-danger {
  background: rgba(255, 95, 109, 0.12);
  color: var(--red);
  border: 1px solid rgba(255, 95, 109, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 95, 109, 0.2);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #0d0f14;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 6px;
}

/* ─── Alert / Toast ─── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert.show { display: flex; }

.alert-error {
  background: rgba(255, 95, 109, 0.1);
  border: 1px solid rgba(255, 95, 109, 0.25);
  color: #ff8a94;
}

.alert-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text2);
}

/* ─── Profile Dashboard Layout ─── */
.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 64px 1fr;
}

/* Navbar */
.navbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}

.navbar-brand .logo-sm {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dim));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text2);
  font-size: 0.88rem;
}

.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg3);
  border: 2px solid var(--border);
}

/* Main content */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  width: 100%;
}

/* Profile Header Card */
.profile-header-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

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

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

.profile-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border2);
  background: var(--bg3);
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0; right: 0;
  width: 30px; height: 30px;
  background: var(--teal);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: 2px solid var(--card);
  font-size: 13px;
  transition: all var(--transition);
}

.avatar-upload-btn:hover {
  background: #27bba8;
  transform: scale(1.1);
}

#avatarInput { display: none; }

.profile-info {
  flex: 1;
}

.profile-info h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.profile-info .email-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.2rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 0.75rem;
}

.profile-info .bio-text {
  color: var(--text2);
  font-size: 0.9rem;
  max-width: 500px;
  font-style: italic;
}

.profile-meta {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.83rem;
  color: var(--text3);
}

/* Edit Form Card */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
}

.section-card h3 {
  font-size: 1rem;
  margin-bottom: 1.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-card h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Danger Zone */
.danger-zone {
  border-color: rgba(255, 95, 109, 0.2);
}

.danger-zone h3 { color: var(--red); }
.danger-zone h3::after { background: rgba(255, 95, 109, 0.15); }

/* Upload progress overlay */
.upload-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}

.upload-overlay.show { display: flex; }

.upload-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.upload-overlay p {
  color: var(--text2);
  font-size: 0.9rem;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  transform: translateY(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  max-width: 320px;
}

.toast.show { transform: translateY(0); }
.toast.success { border-color: rgba(52,211,153,0.3); }
.toast.success .toast-icon { color: var(--green); }
.toast.error { border-color: rgba(255,95,109,0.3); }
.toast.error .toast-icon { color: var(--red); }

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease forwards; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .profile-header-card { flex-direction: column; align-items: center; text-align: center; }
  .profile-meta { justify-content: center; }
  .main-content { padding: 1.5rem 1rem; }
}

/* ─── Divider ─── */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--text3);
  font-size: 0.8rem;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
