/* Edit Profile Page - matches Settings page aesthetics */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #3f51b5;
  --primary-600: #334296;
  --primary-400: #5c6bc0;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --text: #333333;
  --text-muted: #666666;
  --border: #e0e0e0;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

body.dark {
  --surface: #222831;
  --surface-muted: #1a1f26;
  --text: #e7e9ee;
  --text-muted: #b8c0cc;
  --border: #2e3642;
  --shadow: 0 6px 24px rgba(0,0,0,0.35);
}

/* Container */
.edit-profile-page {
  background: var(--surface-muted);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
}

.edit-profile-container {
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  overflow: hidden; /* prevent subtle overflow of children */
}

.edit-profile-container h1 {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Header back link */
.edit-profile-container header a {
  color: #111111; /* black in light mode */
}

body.dark.edit-profile-page .edit-profile-container header a {
  color: #ffffff; /* white in dark mode */
}

/* Profile section */
.profile-section {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.profile-picture-wrapper {
  background: #f0f2ff; /* light mode background */
  border: 2px solid var(--primary); /* brand border in light mode */
  position: relative;
}

/* Dark mode avatar background */
body.dark .profile-picture-wrapper {
  background: #232a33 !important; /* darker background inside avatar */
  border: 2px solid #2e3642; /* match dark button border */
}

.profile-picture-wrapper img {
  display: block;
  position: relative;
  z-index: 0;
}

/* Fallback profile icon overlay */
.profile-picture-wrapper .profile-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 76px; /* larger icon */
  line-height: 1;
  z-index: 1;
}

/* Hide the icon when a non-default image is present */
.profile-picture-wrapper.has-image .profile-icon {
  display: none;
}

/* Hide the <img> when there is no real user image so the dark background + icon show */
.profile-picture-wrapper:not(.has-image) img {
  display: none;
}

/* Buttons */
.btn {
  border-radius: 10px;
  border: 1px solid var(--primary);
  color: var(--primary);
  background: #f0f2ff;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(63,81,181,0.18);
}

.btn-primary {
  border: none;
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-600);
  box-shadow: 0 8px 20px rgba(63,81,181,0.25);
}

/* Secondary (Cancel) */
.btn-secondary {
  background: #232a33;
  color: #e7e9ee;
  border: 1px solid #2e3642;
}

.btn-secondary:hover {
  background: #2a3441;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* Change Photo button: white in light, dark in dark */
#upload-photo-btn {
  background: #ffffff !important;
  color: #111111 !important; /* black text in light mode */
  border-color: #e0e0e0 !important;
}

#upload-photo-btn:hover {
  background: #f7f8fa !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

body.dark #upload-photo-btn {
  background: #232a33 !important;
  color: #e7e9ee !important;
  border-color: #2e3642 !important;
}

body.dark #upload-photo-btn:hover {
  background: #2a3441 !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* Dark-mode: make 'Send verification' and 'Send code' buttons dark with blue text */
body.dark #send-email-token,
body.dark #send-phone-otp {
  background: #232a33 !important; /* dark background */
  color: var(--primary) !important; /* keep blue text like light mode */
  border-color: #2e3642 !important;
}

body.dark #send-email-token:hover,
body.dark #send-phone-otp:hover {
  background: #2a3441 !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* Dark-mode: make 'Unverified' badges dark for visibility */
body.dark #email-verified-badge,
body.dark #phone-verified-badge {
  background: #2a3441 !important;
  color: #e7e9ee !important;
  border: 1px solid #2e3642 !important;
}

/* Form inputs */
.form-section label span,
.account-security label span {
  color: var(--text);
  font-weight: 600;
}

.form-section input,
.form-section textarea,
.account-security input,
.account-security textarea {
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  margin-top: 2px;
}

.form-section input:focus,
.form-section textarea:focus,
.account-security input:focus,
.account-security textarea:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(63,81,181,0.15);
}

.form-section textarea,
.account-security textarea {
  resize: vertical;
  min-height: 120px;
}

/* Increase vertical spacing between stacked fields */
.form-section label + label,
.account-security label + label {
  margin-top: 10px;
}

/* Ensure no child exceeds the card width */
.edit-profile-container *,
.form-section *,
.profile-section * {
  max-width: 100%;
  box-sizing: border-box;
}

/* Modal */
.modal {
  background: rgba(0,0,0,0.6);
}

.modal .modal-content {
  background: var(--surface) !important;
  color: var(--text) !important; /* override inline color:#222 */
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.modal .modal-header {
  border-bottom: 1px solid var(--border);
}

.modal .upload-options .btn,
.modal .current-photo-section .btn {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface-muted);
}

/* Camera */
.camera-view .camera-section video {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* Crop tool */
#crop-canvas {
  border-radius: 10px;
}

#crop-circle {
  border: 2px dashed var(--primary);
}

/* Dark mode: use green/cosmic gradient for title and icons */
body.dark.edit-profile-page .animated-title,
body.dark.edit-profile-page .animated-icon {
  background: linear-gradient(270deg, #35a79c, #209cb3, #1e4a69, #35a79c);
  background-size: 800% 800%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: cosmic-gradient 8s ease infinite;
}

/* Responsive */
@media (max-width: 768px) {
  .edit-profile-container {
    padding: 16px;
    border-radius: 14px;
  }
  .profile-section {
    padding: 12px;
  }
}
