/* ============================================
   草本酒坊 - 个人中心样式
   ============================================ */

/* ── 个人中心布局 ── */
.profile-page {
  padding-top: 88px;
  min-height: 100vh;
}

.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-6);
  padding: var(--space-8) 0 var(--space-12);
}

/* ── 侧边栏 ── */
.profile-sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
}

.profile-user-card {
  text-align: center;
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 3px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
  overflow: hidden;
}

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

.profile-avatar-icon {
  color: var(--text-muted);
}

.profile-nickname {
  font-family: var(--font-cn);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.profile-phone {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.profile-join-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

/* ── 侧边菜单 ── */
.profile-menu {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-quart);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.profile-menu-item:hover {
  color: var(--text-primary);
  background: oklch(93% 0.01 80 / 0.06);
}

.profile-menu-item.active {
  color: var(--text-accent);
  background: oklch(75% 0.15 85 / 0.08);
  font-weight: var(--weight-semibold);
}

.profile-menu-item svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.profile-menu-item + .profile-menu-item {
  border-top: 1px solid var(--border-subtle);
}

.profile-menu-item.logout {
  color: var(--color-error);
}

.profile-menu-item.logout:hover {
  background: oklch(55% 0.18 25 / 0.08);
}

/* ── 主内容区 ── */
.profile-content {
  min-height: 400px;
}

.profile-panel {
  display: none;
}

.profile-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.panel-title {
  font-family: var(--font-cn);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* ── 编辑信息表单 ── */
.edit-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.edit-avatar-section {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.edit-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

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

.edit-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.edit-avatar-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.edit-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.edit-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.edit-form-group.full-width {
  grid-column: 1 / -1;
}

.edit-form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.edit-form-input {
  padding: 0.65rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--duration-fast) var(--ease-out-quart);
}

.edit-form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px oklch(75% 0.15 85 / 0.15);
}

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

.edit-form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.edit-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

/* ── 地址管理 ── */
.address-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.address-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration-fast) var(--ease-out-quart);
}

.address-card:hover {
  border-color: var(--border-default);
}

.address-card.default {
  border-color: var(--border-accent);
}

.address-default-badge {
  display: inline-block;
  padding: 1px 6px;
  background: oklch(75% 0.15 85 / 0.15);
  color: var(--text-accent);
  font-size: 11px;
  border-radius: var(--radius-sm);
  margin-left: var(--space-2);
}

.address-info {
  flex: 1;
  min-width: 0;
}

.address-name-phone {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.address-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.address-phone {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.address-detail {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

.address-tag {
  display: inline-block;
  padding: 1px 6px;
  margin-top: var(--space-2);
  background: oklch(45% 0.15 25 / 0.2);
  color: var(--color-primary-light);
  font-size: 11px;
  border-radius: var(--radius-sm);
}

.address-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-shrink: 0;
}

.address-action-btn {
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--duration-fast);
  background: none;
  border: none;
  padding: 2px 0;
}

.address-action-btn:hover {
  color: var(--text-accent);
}

.address-action-btn.danger:hover {
  color: var(--color-error);
}

/* ── 订单列表 ── */
.order-filters {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.order-filter-tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
  background: none;
  border: none;
  position: relative;
}

.order-filter-tab:hover {
  color: var(--text-primary);
}

.order-filter-tab.active {
  color: var(--text-accent);
  font-weight: var(--weight-semibold);
}

.order-filter-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.order-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: oklch(93% 0.01 80 / 0.03);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.order-id {
  font-family: var(--font-mono);
}

.order-status {
  font-weight: var(--weight-semibold);
}

.order-status.status-pending {
  color: var(--color-warning);
}

.order-status.status-shipped {
  color: var(--text-accent);
}

.order-status.status-delivered {
  color: var(--color-success);
}

.order-status.status-cancelled {
  color: var(--text-muted);
}

.order-card-body {
  padding: var(--space-4) var(--space-5);
}

.order-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}

.order-item + .order-item {
  border-top: 1px solid var(--border-subtle);
}

.order-item-img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-input);
  flex-shrink: 0;
}

.order-item-info {
  flex: 1;
  min-width: 0;
}

.order-item-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-item-spec {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.order-item-price {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  flex-shrink: 0;
}

.order-item-qty {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

.order-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

.order-total {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.order-total strong {
  color: var(--text-accent);
  font-size: var(--text-base);
}

.order-action-btns {
  display: flex;
  gap: var(--space-2);
}

/* ── 我的需求列表 ── */
.request-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.request-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out-quart);
}

.request-item:hover {
  border-color: var(--border-default);
  transform: translateX(4px);
}

.request-type-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: oklch(75% 0.15 85 / 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-accent);
  flex-shrink: 0;
}

.request-item-info {
  flex: 1;
  min-width: 0;
}

.request-item-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.request-item-meta {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

.request-status-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
}

.request-status-badge.status-open {
  background: oklch(55% 0.12 145 / 0.15);
  color: var(--color-success);
}

.request-status-badge.status-quoted {
  background: oklch(75% 0.15 85 / 0.15);
  color: var(--text-accent);
}

.request-status-badge.status-in_progress {
  background: oklch(55% 0.15 75 / 0.15);
  color: var(--color-warning);
}

.request-status-badge.status-completed {
  background: oklch(50% 0.01 60 / 0.3);
  color: var(--text-secondary);
}

/* ── 我的预约 ── */
.appointment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.appointment-card {
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.appointment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.appointment-type {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.appointment-type-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: oklch(75% 0.15 85 / 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-accent);
}

.appointment-status {
  padding: 2px 8px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.appointment-status.confirmed {
  background: oklch(55% 0.12 145 / 0.15);
  color: var(--color-success);
}

.appointment-status.pending {
  background: oklch(55% 0.15 75 / 0.15);
  color: var(--color-warning);
}

.appointment-status.cancelled {
  background: oklch(50% 0.01 60 / 0.3);
  color: var(--text-secondary);
}

.appointment-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.appointment-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.appointment-detail-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.appointment-detail-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.appointment-actions {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

/* ── 空状态 ── */
.profile-empty {
  text-align: center;
  padding: var(--space-16) 0;
  color: var(--text-muted);
}

.profile-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  color: var(--text-muted);
  opacity: 0.5;
}

.profile-empty p {
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

/* ── 模态框 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  font-family: var(--font-cn);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-5);
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.modal-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.modal-form-group.full-width {
  grid-column: 1 / -1;
}

.modal-form-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.modal-form-input {
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.modal-form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px oklch(75% 0.15 85 / 0.15);
}

.modal-form-input::placeholder {
  color: var(--text-muted);
}

.modal-form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* ── 响应式 ── */
@media (max-width: 1024px) {
  .profile-layout {
    grid-template-columns: 220px 1fr;
    gap: var(--space-5);
  }
}

@media (max-width: 768px) {
  .profile-page {
    padding-top: 72px;
  }

  .profile-layout {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .profile-sidebar {
    position: static;
  }

  .profile-user-card {
    padding: var(--space-4);
  }

  .profile-menu {
    display: flex;
    overflow-x: auto;
    border-radius: var(--radius-md);
  }

  .profile-menu-item {
    flex-shrink: 0;
    padding: var(--space-3) var(--space-4);
    border-top: none !important;
    border-right: 1px solid var(--border-subtle);
  }

  .profile-menu-item:last-child {
    border-right: none;
  }

  .profile-menu-item.active {
    border-bottom: 2px solid var(--color-accent);
  }

  .edit-form-grid {
    grid-template-columns: 1fr;
  }

  .edit-avatar-section {
    flex-direction: column;
    text-align: center;
  }

  .appointment-details {
    grid-template-columns: 1fr;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }
}
