/* ============================================================
   PROJECT MANHATTAN — profile.css
   Font: DM Sans | Primary: #1a6fdb
   ============================================================ */

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

body {
  font-family: 'Poppins', 'DM Sans', sans-serif;
  background: #f4f6fb;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.topbar-project { font-size: 9px; font-weight: 700; letter-spacing: 2px; color: #9aa0b4; }
.topbar-manhattan { font-size: 15px; font-weight: 800; color: #1a1a2e; }

.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1.5px solid #e0e3ed;
  background: #fff;
  transition: border-color 0.2s, color 0.2s;
}
.topbar-back:hover { border-color: #1a6fdb; color: #1a6fdb; }

/* ── LAYOUT ──────────────────────────────────────────────── */
.profile-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 56px);
}

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

/* ── SIDEBAR ─────────────────────────────────────────────── */
.profile-sidebar {
  background: #fff;
  border-right: 1px solid #e8eaf0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f4f6fb;
  border-radius: 10px;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1a6fdb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 11px;
  color: #9aa0b4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 20px; }

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

.sidebar-nav-label {
  font-size: 10px;
  font-weight: 700;
  color: #9aa0b4;
  letter-spacing: 1px;
  padding: 0 10px;
  margin-bottom: 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, color 0.2s;
  width: 100%;
}
.sidebar-nav-item:hover { background: #f4f6fb; color: #1a1a2e; }
.sidebar-nav-item.active { background: #eef4fd; color: #1a6fdb; font-weight: 600; }
.sidebar-nav-item.signout { color: #e63946; }
.sidebar-nav-item.signout:hover { background: #fff0f1; }

/* ── CONTENT ─────────────────────────────────────────────── */
.profile-content {
  padding: 32px;
  max-width: 720px;
}

.profile-section { display: none; }
.profile-section.active { display: block; }

.section-header {
  margin-bottom: 24px;
}
.section-header h1 {
  font-size: 20px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 4px;
}
.section-header p {
  font-size: 13px;
  color: #9aa0b4;
}

/* ── PROFILE CARD ────────────────────────────────────────── */
.profile-card {
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.danger-card { border-color: #fecdd3; background: #fff8f8; }

.card-subtitle {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
}

/* Photo Row */
.photo-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.photo-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #1a6fdb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

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

.photo-info h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.photo-info p {
  font-size: 12px;
  color: #9aa0b4;
  margin-bottom: 10px;
}

.btn-upload-photo {
  padding: 7px 16px;
  background: #fff;
  border: 1.5px solid #e0e3ed;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #4a4e69;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-upload-photo:hover { border-color: #1a6fdb; color: #1a6fdb; }

/* Form */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #4a4e69;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid #e0e3ed;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 13px;
  color: #1a1a2e;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #1a6fdb;
  box-shadow: 0 0 0 3px rgba(26,111,219,0.10);
}

.form-group select {
  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='%239aa0b4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

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

/* Info Row */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.info-row label {
  font-size: 12px;
  font-weight: 600;
  color: #4a4e69;
  display: block;
  margin-bottom: 4px;
}

.info-value {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a2e;
}

.info-hint {
  font-size: 12px;
  color: #9aa0b4;
}

.info-actions { display: flex; gap: 8px; }

/* Role Badge */
.role-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: #eef4fd;
  color: #1a6fdb;
  border: 1px solid #c7dcf8;
  text-transform: capitalize;
  white-space: nowrap;
}

.role-badge.admin { background: #fef3c7; color: #d97706; border-color: #fde68a; }
.role-badge.operator { background: #f3f0ff; color: #7c3aed; border-color: #ddd6fe; }
.role-badge.developer { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.role-badge.buyer { background: #fff0f1; color: #e63946; border-color: #fecdd3; }
.role-badge.partner { background: #f0fdf4; color: #059669; border-color: #a7f3d0; }

/* Buttons */
.btn-save-section {
  align-self: flex-start;
  padding: 9px 24px;
  background: #1a6fdb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-save-section:hover { background: #1560c4; }

.btn-verify {
  padding: 7px 16px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn-verify:hover { background: #d97706; }

.btn-outline {
  padding: 7px 16px;
  background: #fff;
  border: 1.5px solid #e0e3ed;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #4a4e69;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn-outline:hover { border-color: #1a6fdb; color: #1a6fdb; }

.btn-danger {
  padding: 9px 20px;
  background: #e63946;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn-danger:hover { background: #c1121f; }

/* ── COLOR PICKER ────────────────────────────────────────── */
.color-picker-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #1a1a2e; transform: scale(1.15); }

.avatar-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.avatar-preview {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1a6fdb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

/* ── THEME ───────────────────────────────────────────────── */
.theme-options {
  display: flex;
  gap: 16px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.theme-option span {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.theme-option.active span { color: #1a6fdb; }

.theme-preview {
  width: 80px;
  height: 56px;
  border-radius: 8px;
  border: 2px solid #e0e3ed;
  overflow: hidden;
  transition: border-color 0.2s;
}

.theme-option.active .theme-preview { border-color: #1a6fdb; }

.light-preview { background: #f4f6fb; }
.light-preview .theme-preview-nav {
  height: 12px;
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
}
.light-preview .theme-preview-content {
  height: 44px;
  background: #f4f6fb;
}

.dark-preview { background: #1a1a2e; }
.dark-preview .theme-preview-nav {
  height: 12px;
  background: #0f0f1e;
  border-bottom: 1px solid #2a2a4a;
}
.dark-preview .theme-preview-content {
  height: 44px;
  background: #1a1a2e;
}

/* ── PLAN ────────────────────────────────────────────────── */
.plan-card { align-items: flex-start; }

.plan-badge {
  font-size: 10px;
  font-weight: 700;
  color: #1a6fdb;
  background: #eef4fd;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #c7dcf8;
}

.plan-name {
  font-size: 28px;
  font-weight: 800;
  color: #1a1a2e;
}

.plan-desc { font-size: 13px; color: #6b7280; }

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-features li { font-size: 13px; color: #4a4e69; }

.btn-upgrade {
  padding: 10px 28px;
  background: linear-gradient(135deg, #1a6fdb, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-upgrade:hover { opacity: 0.9; }

/* ── SECURITY ────────────────────────────────────────────── */
.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafc;
  border-radius: 8px;
  border: 1px solid #e8eaf0;
}

.session-device { font-size: 13px; font-weight: 600; color: #1a1a2e; }

.session-active {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
  background: #dcfce7;
  padding: 3px 8px;
  border-radius: 20px;
}

/* ── ACTIVITIES ──────────────────────────────────────────── */
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f2f8;
}
.activity-row:last-of-type { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a6fdb;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-title { font-size: 13px; font-weight: 600; color: #1a1a2e; }

/* ── API KEY ─────────────────────────────────────────────── */
.api-key-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.api-key-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid #e0e3ed;
  border-radius: 8px;
  font-family: monospace;
  font-size: 13px;
  color: #4a4e69;
  background: #f9fafc;
  outline: none;
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,20,40,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.15);
  text-align: center;
  animation: modalPop 0.25s ease;
}

@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-icon {
  width: 56px;
  height: 56px;
  background: #eef4fd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-icon.danger { background: #fff0f1; }

.modal-title { font-size: 16px; font-weight: 700; color: #1a1a2e; }
.modal-body { font-size: 13px; color: #6b7280; line-height: 1.6; }

.modal-actions { display: flex; gap: 10px; width: 100%; }

.modal-cancel-btn {
  flex: 1;
  padding: 9px;
  background: #fff;
  border: 1.5px solid #e0e3ed;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #4a4e69;
  cursor: pointer;
}
.modal-cancel-btn:hover { border-color: #1a6fdb; color: #1a6fdb; }

.modal-ok-btn {
  padding: 9px 32px;
  background: #1a6fdb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-ok-btn:hover { background: #1560c4; }

/* ── TOAST ───────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── UTILITIES ───────────────────────────────────────────── */
.hidden { display: none !important; }