/**
 * User Profile Styles
 * Modal, avatar upload, and form styles
 */

/* Modal Container */
.profile-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
}

.profile-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: profileFadeIn 0.2s ease;
}

@keyframes profileFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Backdrop */
.profile-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

[data-theme="dark"] .profile-modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

/* Modal Content */
.profile-modal-content {
  position: relative;
  background: var(--content-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  animation: profileSlideIn 0.25s ease;
}

@keyframes profileSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.profile-modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--content-text);
}

.profile-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--content-text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.profile-modal-close:hover {
  background: var(--hover-bg);
  color: var(--content-text);
}

/* Form */
.profile-form {
  padding: 1.5rem;
}

/* Avatar Section */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.profile-avatar-container {
  position: relative;
  width: 100px;
  height: 100px;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.profile-avatar-container:hover {
  transform: scale(1.05);
}

.profile-avatar-container.uploading {
  pointer-events: none;
  opacity: 0.7;
}

.profile-avatar-container.uploading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid var(--primary-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.profile-avatar-container.drag-over {
  transform: scale(1.1);
}

.profile-avatar-container.drag-over .profile-avatar-overlay {
  opacity: 1;
}

.profile-avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.profile-avatar-initial {
  font-size: 2.5rem;
  font-weight: 600;
  color: white;
}

.profile-avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.profile-avatar-container:hover .profile-avatar-overlay {
  opacity: 1;
}

.profile-avatar-overlay span {
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Avatar Actions */
.profile-avatar-actions {
  display: flex;
  gap: 0.75rem;
}

.profile-avatar-change-btn,
.profile-avatar-remove-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-avatar-change-btn {
  background: var(--primary-color);
  color: white;
  border: none;
}

.profile-avatar-change-btn:hover {
  background: var(--primary-dark);
}

.profile-avatar-remove-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--content-text-secondary);
}

.profile-avatar-remove-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Form Fields */
.profile-form-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.profile-form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--content-text);
}

.profile-form-group input {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--content-text);
  font-size: 0.9375rem;
  transition: all 0.15s ease;
}

.profile-form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.profile-form-group input::placeholder {
  color: var(--content-text-secondary);
  opacity: 0.7;
}

.profile-form-hint {
  font-size: 0.75rem;
  color: var(--content-text-secondary);
}

/* Form Actions */
.profile-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.profile-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.profile-btn-secondary {
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  color: var(--content-text);
}

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

.profile-btn-primary {
  background: var(--primary-color);
  border: none;
  color: white;
  min-width: 120px;
}

.profile-btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.profile-btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.profile-btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Sidebar User Info - Enhanced Styles */
.sidebar-footer .user-info {
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.sidebar-footer .user-info:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer .user-info:active {
  background: rgba(255, 255, 255, 0.15);
}

/* Avatar hover effect in sidebar */
.user-avatar {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-footer .user-info:hover .user-avatar {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Mobile Adjustments */
@media (max-width: 480px) {
  .profile-modal-content {
    width: 95%;
    max-height: 85vh;
    margin: 0 auto;
  }

  .profile-form {
    padding: 1rem;
  }

  .profile-avatar-container {
    width: 80px;
    height: 80px;
  }

  .profile-avatar-initial {
    font-size: 2rem;
  }

  .profile-form-actions {
    flex-direction: column-reverse;
  }

  .profile-btn {
    width: 100%;
  }
}
