/* profile.css */
.profile-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 100px 20px 60px;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  animation: fadeIn 0.5s ease;
}

.profile-card h1 {
  font-size: 32px;
  margin-bottom: 30px;
  color: var(--text-main);
}

.profile-section {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border);
}

.profile-section:last-child {
  border-bottom: none;
}

.profile-section h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--text-main);
}

/* Avatar Section */
.avatar-section {
  position: relative;
  width: 100px;
  margin: 0 auto 20px;
}

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  color: var(--accent);
}

.edit-avatar-btn {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.edit-avatar-btn:hover {
  transform: scale(1.1);
}

/* User Details */
.user-details {
  max-width: 400px;
  margin: 0 auto;
}

.detail-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row label {
  width: 120px;
  color: var(--text-muted);
  font-size: 14px;
}

.detail-row p {
  flex: 1;
  color: var(--text-main);
  font-size: 16px;
}

.edit-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.edit-btn:hover {
  opacity: 1;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  text-align: center;
}

.stat-item {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 16px;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  cursor: pointer;
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

/* Logout Button */
.logout-btn {
  width: 100%;
  padding: 16px;
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid rgba(255, 69, 58, 0.3);
  border-radius: 12px;
  color: #ff453a;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  margin-top: 20px;
}

.logout-btn:hover {
  background: rgba(255, 69, 58, 0.2);
  transform: translateY(-2px);
}

/* Toast notification */
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Loading state */
.profile-card.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.profile-card.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ================= EDIT NAME MODAL ================= */
.edit-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.edit-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

.edit-modal-content h3 {
  font-size: 24px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.edit-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 25px;
}

.edit-input-group {
  position: relative;
  margin-bottom: 30px;
}

.edit-input {
  width: 100%;
  padding: 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 16px;
  color: var(--text-main);
  font-size: 16px;
  transition: all 0.3s ease;
}

.edit-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.1);
}

.edit-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.input-char-count {
  position: absolute;
  right: 12px;
  bottom: -22px;
  font-size: 12px;
  color: var(--text-muted);
}

.edit-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.edit-cancel-btn {
  padding: 12px 24px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-cancel-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.edit-save-btn {
  padding: 12px 30px;
  background: var(--accent);
  border: none;
  border-radius: 40px;
  color: #000000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.edit-save-btn:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 159, 28, 0.3);
}

.edit-save-btn i {
  font-size: 14px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Loading state for save button */
.edit-save-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.edit-save-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
/* ================= AVATAR UPLOAD STYLES ================= */
/* ================= AVATAR SECTION ================= */
.avatar-section {
  position: relative;
  width: 120px;
  margin: 0 auto 20px;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;  /* This makes it circular */
  background: var(--bg-secondary);
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 70px;
  color: var(--accent);
  overflow: hidden;  /* Critical for image cropping */
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;  /* Makes image fill circle properly */
  border-radius: 50%;  /* Ensures image is circular */
}

.edit-avatar-btn {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.edit-avatar-btn:hover {
  transform: scale(1.1);
  background: var(--accent-soft);
}

/* Avatar Preview in Modal */
.avatar-preview {
  width: 120px;
  height: 120px;
  margin: 0 auto 10px;
  border-radius: 50%;  /* Circular preview */
  background: var(--bg-secondary);
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 70px;
  color: var(--accent);
  overflow: hidden;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.preview-hint {
  color: var(--text-muted);
  font-size: 12px;
}

.upload-options {
  display: flex;
  gap: 15px;
  margin: 25px 0;
}

.upload-option {
  flex: 1;
  padding: 20px;
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-option:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.upload-option i {
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 10px;
  display: block;
}

.upload-option span {
  font-size: 14px;
  color: var(--text-muted);
}

#remove-avatar:hover {
  border-color: #ff453a;
}

#remove-avatar:hover i {
  color: #ff453a;
}

/* Image Editor */
.image-editor {
  margin: 20px 0;
}

.crop-container {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg-secondary);
  position: relative;
}

#crop-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  transition: transform 0.1s ease;
}

.crop-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: 40px;
}

.crop-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.crop-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

#zoom-slider {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  -webkit-appearance: none;
}

#zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

#zoom-slider::-moz-range-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Upload Progress */
.upload-progress {
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
  display: block;
  text-align: center;
}