/* css/modules/mobile-profile.css */
/* Mobile Profile Page Styles */

/* ============================================================================
   MOBILE PROFILE PAGE
   ============================================================================ */

.mobile-profile-page {
  padding: 0;
  width: 100%;
  max-width: 100%;
}

/* Profile Section */
.mobile-profile-section {
  background: var(--mobile-bg-primary, white);
  border-bottom: 1px solid var(--mobile-border-color, #ddd);
  padding: 24px 20px;
}

.mobile-profile-section-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--mobile-text-secondary, #666);
  margin-bottom: 16px;
}

.mobile-profile-section-hint {
  font-size: 13px;
  color: var(--mobile-text-secondary, #666);
  margin-top: 12px;
  line-height: 1.4;
}

/* Profile Photo Container */
.mobile-profile-photo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.mobile-profile-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--mobile-bg-secondary, #f5f5f5);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--mobile-border-color, #ddd);
}

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

.mobile-profile-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mobile-text-tertiary, #999);
}

.mobile-profile-photo-placeholder svg {
  opacity: 1;
}

.mobile-profile-photo-button {
  padding: 10px 24px;
  border-radius: 8px;
  border: 2px solid var(--mobile-border-color, #ddd);
  background: var(--mobile-bg-primary, white);
  color: var(--mobile-accent-color, #007AFF);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
  user-select: none;
  min-width: 120px;
}

.mobile-profile-photo-button:active {
  transform: scale(0.98);
  background: var(--mobile-bg-secondary, #f5f5f5);
}

/* Color Section */
.mobile-profile-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--mobile-bg-primary);
  border: 1px solid var(--mobile-border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-profile-menu-item:active {
  transform: scale(0.99);
  background: var(--mobile-bg-secondary);
}

.mobile-profile-menu-label {
  font-size: 15px;
  color: var(--mobile-text-primary);
}

.mobile-profile-chevron {
  font-size: 20px;
  color: var(--mobile-text-tertiary);
}

.mobile-profile-color-indicator {
  flex-shrink: 0;
}

/* Notes Section */
.mobile-profile-notes-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-profile-notes-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--mobile-border-color);
  border-radius: 8px;
  background: var(--mobile-bg-primary);
  color: var(--mobile-text-primary);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.mobile-profile-notes-input:focus {
  outline: none;
  border-color: var(--mobile-accent-color);
}

.mobile-profile-notes-counter {
  text-align: right;
  font-size: 12px;
  color: var(--mobile-text-tertiary);
}

/* Actions */
.mobile-profile-actions {
  padding: 20px;
  background: var(--mobile-bg-primary);
}

.mobile-profile-save-button {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: var(--mobile-accent-color);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-profile-save-button:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.mobile-profile-save-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mobile-profile-save-button--success {
  background: #4CAF50;
}

/* Error State */
.mobile-profile-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.mobile-profile-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.mobile-profile-error-text {
  font-size: 16px;
  color: var(--mobile-text-secondary);
  line-height: 1.5;
}

/* ============================================================================
   COLOR PICKER MODAL
   ============================================================================ */

.color-picker-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.color-picker-modal-overlay--visible {
  opacity: 1;
}

.color-picker-modal-overlay--closing {
  opacity: 0;
}

.color-picker-modal {
  background: var(--mobile-bg-primary);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.color-picker-modal-overlay--visible .color-picker-modal {
  transform: translateY(0);
}

.color-picker-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--mobile-border-color);
}

.color-picker-modal__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--mobile-text-primary);
  margin: 0;
}

.color-picker-modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--mobile-bg-secondary);
  color: var(--mobile-text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.color-picker-modal__close:active {
  transform: scale(0.95);
}

.color-picker-modal__content {
  padding: 20px;
}

.color-picker-modal__hint {
  font-size: 13px;
  color: var(--mobile-text-secondary);
  margin-bottom: 20px;
  text-align: center;
}

.color-picker-modal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
}

.color-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.color-picker-item:active {
  transform: scale(0.95);
  background: var(--mobile-bg-secondary);
}

.color-picker-item--disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.color-picker-item--current {
  background: var(--mobile-bg-secondary);
}

.color-picker-item__swatch {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.color-picker-item:not(.color-picker-item--disabled):active .color-picker-item__swatch {
  transform: scale(1.1);
}

.color-picker-item__check {
  color: white;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.color-picker-item__label {
  font-size: 13px;
  color: var(--mobile-text-primary);
  text-align: center;
  font-weight: 500;
}

.color-picker-item__taken {
  font-size: 11px;
  color: var(--mobile-text-tertiary);
  text-align: center;
}

/* ============================================================================
   PROFILE PHOTO UPLOAD MODAL
   ============================================================================ */

.profile-photo-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.profile-photo-modal-overlay--visible {
  opacity: 1;
}

.profile-photo-modal-overlay--closing {
  opacity: 0;
}

.profile-photo-modal {
  background: var(--mobile-bg-primary);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-photo-modal-overlay--visible .profile-photo-modal {
  transform: translateY(0);
}

.profile-photo-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--mobile-border-color);
  position: sticky;
  top: 0;
  background: var(--mobile-bg-primary);
  z-index: 10;
}

.profile-photo-modal__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--mobile-text-primary);
  margin: 0;
}

.profile-photo-modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--mobile-bg-secondary);
  color: var(--mobile-text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.profile-photo-modal__close:active {
  transform: scale(0.95);
}

.profile-photo-modal__content {
  padding: 20px;
}

/* Upload Options */
.profile-photo-upload-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-photo-file-input {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  visibility: hidden;
}

.profile-photo-option-button {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 2px solid var(--mobile-border-color, #ddd);
  border-radius: 12px;
  background: var(--mobile-bg-primary, white);
  color: var(--mobile-text-primary, #333);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
  user-select: none;
  min-height: 60px;
}

.profile-photo-option-button:active {
  transform: scale(0.98);
  background: var(--mobile-bg-secondary, #f5f5f5);
}

.profile-photo-option-button svg {
  flex-shrink: 0;
  color: var(--mobile-accent-color, #007AFF);
}

.profile-photo-option-button span {
  flex: 1;
}

.profile-photo-option-button--danger {
  color: var(--error-color, #ff3b30);
  border-color: var(--error-color, #ff3b30);
}

.profile-photo-option-button--danger svg {
  color: var(--error-color, #ff3b30);
}

/* Crop Editor */
.profile-photo-crop-editor {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-photo-preview-container {
  width: 100%;
  aspect-ratio: 1;
  background: var(--mobile-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.profile-photo-preview-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.profile-photo-preview-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  cursor: move;
  user-select: none;
  -webkit-user-drag: none;
}

.profile-photo-crop-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  border: 3px solid white;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

/* Zoom Control */
.profile-photo-zoom-control {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 12px;
  background: var(--mobile-bg-secondary, #f5f5f5);
  border-radius: 12px;
  margin-top: 24px;
  margin-bottom: 24px;
}

.profile-photo-zoom-label {
  color: var(--mobile-text-primary, #333);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.profile-photo-zoom-label svg {
  width: 24px;
  height: 24px;
}

.profile-photo-zoom-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.profile-photo-zoom-slider::-webkit-slider-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #bbb 0%, #ddd 100%);
  border: 2px solid #aaa;
}

.profile-photo-zoom-slider::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #bbb 0%, #ddd 100%);
  border: 2px solid #aaa;
}

.profile-photo-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mobile-accent-color, #007AFF);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-top: -14px; /* Center on track: (32px thumb - 8px track + 4px border) / 2 */
}

.profile-photo-zoom-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mobile-accent-color, #007AFF);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Crop Actions */
.profile-photo-crop-actions {
  display: flex;
  gap: 12px;
}

.profile-photo-action-button {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
  user-select: none;
}

.profile-photo-action-button:active {
  transform: scale(0.98);
}

.profile-photo-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-photo-action-button--secondary {
  background: var(--mobile-bg-secondary, #f5f5f5);
  color: var(--mobile-text-primary, #333);
  border: 1px solid var(--mobile-border-color, #ddd);
}

.profile-photo-action-button--primary {
  background: var(--mobile-accent-color, #007AFF);
  color: white;
  border: none;
}

/* ============================================================================
   MEMBER SELECTION (for dashboard owners)
   ============================================================================ */

/* Header with back button */
.mobile-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--mobile-bg-primary, white);
  border-bottom: 1px solid var(--mobile-border-color, #ddd);
}

.mobile-profile-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: var(--mobile-bg-secondary, #f5f5f5);
  color: var(--mobile-accent-color, #007AFF);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-profile-back-btn:active {
  transform: scale(0.98);
  background: var(--mobile-border-color, #ddd);
}

.mobile-profile-back-icon {
  font-size: 20px;
  font-weight: 300;
}

.mobile-profile-header-name {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--mobile-text-primary, #333);
  text-align: center;
  padding-right: 70px; /* Balance the back button width */
}

/* Member selection list */
.mobile-profile-member-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--mobile-border-color, #ddd);
}

.mobile-profile-member-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--mobile-bg-primary, white);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-profile-member-item:active {
  background: var(--mobile-bg-secondary, #f5f5f5);
}

.mobile-profile-member-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}

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

.mobile-profile-member-avatar span {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.mobile-profile-member-info {
  flex: 1;
  min-width: 0;
}

.mobile-profile-member-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--mobile-text-primary, #333);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-profile-member-relationship {
  font-size: 14px;
  color: var(--mobile-text-secondary, #666);
  text-transform: capitalize;
  margin-top: 2px;
}

/* ============================================================================
   LINKED GOOGLE ACCOUNT SECTION
   ============================================================================ */

.mobile-profile-linked-account {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--mobile-bg-secondary, #f5f5f5);
  border-radius: 12px;
  border: 1px solid var(--mobile-border-color, #ddd);
}

.mobile-profile-linked-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-profile-linked-email {
  font-size: 15px;
  color: var(--mobile-text-primary, #333);
  font-weight: 500;
  word-break: break-all;
  flex: 1;
}

.mobile-profile-linked-status {
  font-size: 12px;
  font-weight: 600;
  color: #4CAF50;
  padding: 4px 10px;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 12px;
  flex-shrink: 0;
}

.mobile-profile-unlink-button {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid var(--error-color, #ff3b30);
  background: transparent;
  color: var(--error-color, #ff3b30);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
  user-select: none;
}

.mobile-profile-unlink-button:active {
  transform: scale(0.98);
  background: rgba(255, 59, 48, 0.1);
}

.mobile-profile-unlink-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
