@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #ffffff;
  --red-light: #ffffff;
  --red-glow: rgba(255, 255, 255, 0.35);
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface2: #ebebeb;
  --border: rgba(0,0,0,0.08);
  --text: #111111;
  --muted: #888888;

  --accent: rgb(249, 32, 32);
  --accent-glow: rgba(249, 32, 32, 0.35);
}

.profile-root {
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Ambient background blobs */
.profile-root::before {
  content: '';
  position: fixed;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(249,32,32,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.profile-root::after {
  content: '';
  position: fixed;
  bottom: -150px; left: -150px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(249,32,32,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Topbar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px;
  background: rgba(255,255,255,0.90);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  animation: slideDown 0.5s ease forwards;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.topbar-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.topbar-logo span { color: rgb(249, 32, 32); }

.back-link {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text); }
.back-link svg { transition: transform 0.2s; }
.back-link:hover svg { transform: translateX(-3px); }

/* Main layout */
.profile-main {
  position: relative; z-index: 1;
  padding-top: 100px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 60px;
  align-items: start;
}

/* Left sidebar */
.sidebar {
  padding: 40px 24px 40px 0;
  position: sticky;
  top: 100px;
  animation: fadeInLeft 0.7s 0.2s ease both;
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

.avatar-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(249,32,32), #a01010);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 32px; font-weight: 700;
  color: #ffffff;
  margin-bottom: 20px;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px rgba(249,32,32,0.3);
  position: relative;
}
.avatar-ring::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px dashed rgba(249,32,32,0.3);
  animation: spin 12s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sidebar-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
}
.sidebar-role {
  font-size: 12px;
  color: rgb(249, 32, 32);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
  margin-bottom: 32px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 24px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}
.nav-item .nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.2s;
  flex-shrink: 0;
}
.nav-item.active .nav-dot { background: rgb(249, 32, 32); }

.sidebar-logout {
  margin-top: 40px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 10px;
  border: none; background: transparent;
  font-family: var(--font-body);
  transition: all 0.2s;
  width: 100%;
}
.sidebar-logout:hover { color: rgb(249,32,32); background: rgba(249,32,32,0.07); }

/* Right content */
.content {
  padding: 40px 0 40px 40px;
  border-left: 1px solid var(--border);
  animation: fadeInRight 0.7s 0.3s ease both;
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

.content-header {
  margin-bottom: 36px;
}
.content-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgb(249, 32, 32);
  font-weight: 600;
  margin-bottom: 10px;
}
.content-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--text);
}
.content-title em { font-style: italic; color: rgb(249, 32, 32); }

/* Fields grid */
.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
.field-full { grid-column: 1 / -1; }

.field-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}
.field-card:hover {
  border-color: rgba(249,32,32,0.25);
  background: var(--surface2);
}
.field-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgb(249,32,32), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.field-card:hover::before { opacity: 1; }

.field-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.field-value {
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  word-break: break-all;
}
.field-empty { color: var(--muted); font-style: italic; font-size: 14px; }

.field-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  font-family: var(--font-body);
  caret-color: rgb(249, 32, 32);
}
.field-input::placeholder { color: var(--muted); }
.field-card.editing { border-color: rgba(249,32,32,0.4); background: rgba(249,32,32,0.03); }
.field-card.editing::before { opacity: 1; }

/* Action row */
.action-row {
  display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 32px;
  background: rgb(249, 32, 32);
  color: #ffffff;
  border: none;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.btn-primary:hover {
  background: #e8e8e8;
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.btn-secondary:hover { color: var(--text); border-color: rgba(0,0,0,0.2); }

.btn-orders {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.btn-orders:hover { border-color: rgba(249,32,32,0.4); color: rgb(249,32,32); }

/* Stats strip */
.stats-strip {
  display: flex; gap: 16px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 18px;
  font-size: 12px;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.stat-pill strong { color: var(--text); font-weight: 600; }
.stat-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 6px rgba(46,204,113,0.6);
}

/* Loading */
.loading-screen {
  position: fixed; inset: 0;
  background: #ffffff;
}
.loading-logo {
  font-size: 28px; font-weight: 700; color: var(--text);
}
.loading-logo span { color: rgb(249, 32, 32); }
.loading-bar {
  width: 200px; height: 2px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  background: rgb(249, 32, 32);
  border-radius: 2px;
  animation: loadFill 1.4s ease-in-out infinite;
}
@keyframes loadFill {
  0% { width: 0%; margin-left: 0; }
  50% { width: 80%; margin-left: 0; }
  100% { width: 0%; margin-left: 100%; }
}

/* Toast */
.toast {
  position: fixed; bottom: 32px; right: 32px;
  background: var(--surface2);
  border: 1px solid rgba(46,204,113,0.3);
  color: var(--text);
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; flex-shrink: 0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
  .profile-main {
    grid-template-columns: 1fr;
    padding: 16px;
    padding-top: 90px;
  }
  .sidebar { position: static; padding: 24px 0; }
  .content { padding: 24px 0; border-left: none; border-top: 1px solid var(--border); }
  .fields-grid { grid-template-columns: 1fr; }
  .content-title { font-size: 28px; }
  .topbar { padding: 16px 20px; }
}
