.profile-view {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem var(--margin-main) 2rem;
  animation: fadeInUp 0.5s ease-out;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.profile-avatar-circle {
  width: 8rem;
  height: 8rem;
  border-radius: var(--radius-full);
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--surface-container-lowest);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin-bottom: 0.75rem;
}

.profile-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--on-surface);
  text-align: center;
}

.profile-info-cards {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  margin-bottom: 2rem;
}

.profile-info-card {
  background: var(--surface-container-lowest);
  padding: var(--card-padding);
  border-radius: var(--radius-md);
  border: 2px solid var(--surface-container-high);
  box-shadow: var(--shadow-soft);
}

.info-card-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.info-card-value {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--on-surface);
}

.profile-menu {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  margin-bottom: 3rem;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  height: 5rem;
  padding: 0 1.5rem;
  background: var(--surface-container-lowest);
  border: 2px solid var(--surface-container-high);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s;
}

.profile-menu-item:active {
  background: var(--surface-container);
}

.menu-item-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-item-icon--primary {
  background: rgba(0, 69, 13, 0.08);
  color: var(--primary);
}

.menu-item-icon--error {
  background: rgba(186, 26, 26, 0.08);
  color: var(--error);
}

.menu-item-icon--secondary {
  background: rgba(43, 91, 181, 0.08);
  color: var(--secondary);
}

.menu-item-icon--error-outline {
  background: rgba(186, 26, 26, 0.08);
  color: var(--error);
}

.menu-item-label {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--on-surface);
}

.menu-item-chevron {
  color: var(--on-surface-variant);
  flex-shrink: 0;
}

.profile-location-section {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: var(--card-padding);
  margin-bottom: 1.5rem;
}

.profile-location-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--on-surface);
  margin-bottom: 0.25rem;
}

.profile-section-sub {
  font-size: 0.9rem;
  color: var(--on-surface-variant);
  margin-bottom: 1rem;
  line-height: 1.45;
}

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

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

.profile-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  letter-spacing: 0.03em;
}

.profile-field input {
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--on-surface);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  font-family: inherit;
}

.profile-field input:focus {
  border-color: var(--primary);
}

.profile-field input:disabled {
  opacity: 0.6;
}

.profile-field-row {
  display: flex;
  gap: 0.85rem;
}

.profile-helper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-btn-secondary {
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s;
}

.profile-btn-secondary:hover:not(:disabled) {
  background: var(--surface-container);
}

.profile-btn-secondary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.profile-feedback {
  margin: 0;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  line-height: 1.4;
}

.profile-feedback--ok {
  background: rgba(0, 69, 13, 0.08);
  color: var(--primary);
  border: 1px solid rgba(0, 69, 13, 0.2);
}

.profile-feedback--err {
  background: rgba(186, 26, 26, 0.08);
  color: var(--error);
  border: 1px solid rgba(186, 26, 26, 0.2);
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.profile-btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  transition: opacity 0.15s;
}

.profile-btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.profile-btn-primary:disabled {
  opacity: 0.55;
}

.profile-logout-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  height: 5rem;
  padding: 0 1.5rem;
  background: rgba(186, 26, 26, 0.06);
  border: 2px solid rgba(186, 26, 26, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  color: var(--error);
  font-size: 1.125rem;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.15s;
}

.profile-logout-btn:active {
  background: rgba(186, 26, 26, 0.12);
}

@media (max-width: 480px) {
  .profile-view {
    padding: 1rem var(--margin-main) 1rem;
  }

  .profile-menu-item {
    height: auto;
    padding: 0.875rem 1rem;
    min-height: 4rem;
  }

  .menu-item-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .profile-field-row {
    flex-direction: column;
    gap: 0.85rem;
  }

  .profile-avatar-circle {
    width: 6rem;
    height: 6rem;
  }

  .profile-btn-secondary {
    width: 100%;
    justify-content: center;
  }

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

  .profile-actions {
    width: 100%;
  }

  .profile-logout-btn {
    height: auto;
    padding: 0.875rem 1rem;
    min-height: 4rem;
  }
}

/* Profile Avatar Editable */
.profile-avatar-editable {
  cursor: pointer;
  position: relative;
}

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

.profile-avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: white;
}

.profile-avatar-image {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
}

/* Editable Info Cards */
.info-card-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--on-surface);
  font-size: 1rem;
  font-family: inherit;
  margin-top: 0.5rem;
}

.info-card-input:focus {
  outline: none;
  border-color: var(--primary);
}

.info-card-input:disabled {
  opacity: 0.6;
}

/* Search History */
.profile-search-history {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.5rem;
}

.profile-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--outline-variant);
}

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

.profile-search-address {
  flex: 1;
  font-size: 0.9rem;
  color: var(--on-surface);
}

.profile-search-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--on-surface-variant);
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.profile-search-delete:hover {
  background: rgba(186, 26, 26, 0.1);
  color: var(--error);
}

/* Config Modal */
.profile-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.profile-modal {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.profile-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--on-surface);
}

.profile-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--on-surface-variant);
  padding: 0.25rem;
  line-height: 1;
}

.profile-modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-modal-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  letter-spacing: 0.03em;
}

.profile-modal-field input {
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--on-surface);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.profile-modal-field input:focus {
  border-color: var(--primary);
}

.profile-modal-field input:disabled {
  opacity: 0.6;
}

.profile-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.profile-btn-cancel {
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s;
}

.profile-btn-cancel:hover:not(:disabled) {
  background: var(--surface-container);
}

.profile-btn-cancel:disabled {
  opacity: 0.6;
}

/* Avatar Modal */
.profile-modal-avatar {
  max-width: 32rem;
}

.profile-avatar-tabs {
  display: flex;
  border-bottom: 1px solid var(--outline-variant);
}

.profile-avatar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--on-surface-variant);
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.profile-avatar-tab:hover {
  color: var(--on-surface);
}

.profile-avatar-tab--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.profile-avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.profile-avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: none;
  transition: border-color 0.15s, transform 0.15s;
}

.profile-avatar-option:hover {
  border-color: var(--primary);
  transform: scale(1.03);
}

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

.profile-avatar-upload {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-avatar-upload-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem;
  background: var(--surface);
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s;
}

.profile-avatar-upload-option:hover {
  border-color: var(--primary);
}

.profile-avatar-upload-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--surface-container-low);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.profile-avatar-upload-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--on-surface);
}

.profile-avatar-upload-sub {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

/* Addresses Modal */
.profile-modal-addresses {
  max-width: 32rem;
}

.profile-address-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-address-default-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--on-surface);
  cursor: pointer;
}

.profile-address-default-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.profile-address-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-address-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface);
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.profile-address-item--default {
  border-color: var(--primary);
  background: rgba(0, 69, 13, 0.03);
}

.profile-address-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.profile-address-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-address-text {
  font-size: 0.95rem;
  color: var(--on-surface);
  word-break: break-word;
}

.profile-address-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-address-set-default {
  align-self: flex-start;
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  margin-top: 0.25rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.profile-address-set-default:hover {
  color: var(--on-secondary-container);
}

.profile-address-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.profile-address-btn-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--on-surface-variant);
  transition: background 0.15s, color 0.15s;
}

.profile-address-btn-icon:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

.profile-address-btn-icon--delete:hover {
  background: rgba(186, 26, 26, 0.1);
  color: var(--error);
}

.profile-address-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem;
  margin-top: 0.5rem;
  background: var(--surface);
  border: 2px dashed var(--outline-variant);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.profile-address-add-btn:hover {
  background: rgba(0, 69, 13, 0.04);
  border-color: var(--primary);
}

@media (max-width: 480px) {
  .profile-address-item {
    flex-direction: column;
  }

  .profile-address-item-actions {
    align-self: flex-end;
  }
}

/* Theme Toggle */
.menu-item-theme-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--on-surface-variant);
}

.profile-theme-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-theme-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--on-surface-variant);
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.profile-theme-btn:hover {
  border-color: var(--primary);
  color: var(--on-surface);
}

.profile-theme-btn--active {
  border-color: var(--primary);
  background: var(--primary-faint);
  color: var(--primary);
}

.profile-theme-btn--active .profile-theme-btn-label {
  color: var(--primary);
  font-weight: 700;
}

.profile-theme-btn-label {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--on-surface);
}

.profile-theme-btn-desc {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
}

.profile-modal-theme {
  max-width: 24rem;
}
