/* ===== 画师工作台 - 全局样式系统 ===== */

/* --- 马卡龙色系主题变量 --- */
:root {
  /* 主色系 */
  --macaron-pink: #FFB6C1;
  --macaron-pink-light: #FFD9DF;
  --macaron-pink-deep: #FF9AAC;
  --macaron-mint: #B5E8D5;
  --macaron-mint-light: #D4F2E8;
  --macaron-mint-deep: #8FD4B8;
  --macaron-purple: #D4C5F9;
  --macaron-purple-light: #E8DFFC;
  --macaron-purple-deep: #B8A0F0;
  --macaron-yellow: #FFE8A3;
  --macaron-yellow-light: #FFF4CC;
  --macaron-yellow-deep: #FFD966;
  --macaron-blue: #B0D8E8;
  --macaron-blue-light: #D4EBF2;
  --macaron-blue-deep: #7FC0D8;

  /* 功能色 */
  --bg-main: #FAF8F5;
  --bg-card: #FFFFFF;
  --bg-soft: #F5F0EE;
  --text-primary: #3D3D3D;
  --text-secondary: #8A8A8A;
  --text-light: #B0B0B0;
  --divider: #F0EBE8;
  --shadow-soft: 0 2px 12px rgba(0,0,0,0.04);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.10);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --warning: #FF8A80;
  --warning-light: #FFCCBC;
  --success: #81C784;
  --danger: #FF6B6B;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* 布局 */
  --nav-height: 64px;
  --header-height: 56px;
  --max-width: 1200px;
}

/* --- Reset --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* --- 滚动条 --- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--macaron-purple);
  border-radius: 10px;
  opacity: 0.5;
}

/* ===== App 容器 ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
  background: var(--bg-main);
}

/* ===== 顶部导航栏 ===== */
.app-header {
  flex-shrink: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(250, 248, 245, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  border-bottom: 0.5px solid var(--divider);
}

.app-header .header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.app-header .header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--macaron-purple-light);
  color: var(--macaron-purple-deep);
  transition: var(--transition);
}
.header-btn:active {
  transform: scale(0.92);
}

/* ===== 主内容区 ===== */
.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.page {
  display: none;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 24px);
  animation: fadeIn 0.3s ease;
}
.page.active {
  display: block;
}

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

/* ===== 底部导航 ===== */
.bottom-nav {
  flex-shrink: 0;
  height: var(--nav-height);
  display: flex;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--divider);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-light);
  transition: var(--transition);
  position: relative;
}

.nav-item .nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .nav-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 500;
}

.nav-item.active {
  color: var(--macaron-purple-deep);
}

.nav-item.active .nav-icon svg {
  stroke-width: 2.2;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--macaron-purple);
}

.nav-item:active {
  transform: scale(0.92);
}

/* ===== 通用组件 ===== */

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  transition: var(--transition);
}

.card-tap {
  cursor: pointer;
}
.card-tap:active {
  transform: scale(0.98);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--macaron-purple-deep);
  color: #fff;
  box-shadow: 0 4px 14px rgba(184, 160, 240, 0.4);
}
.btn-pink {
  background: var(--macaron-pink-deep);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 154, 172, 0.4);
}
.btn-mint {
  background: var(--macaron-mint-deep);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--macaron-purple);
  color: var(--macaron-purple-deep);
}
.btn-ghost {
  background: var(--bg-soft);
  color: var(--text-secondary);
}
.btn-block {
  width: 100%;
}
.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* FAB 浮动按钮 */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-height) + 20px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--macaron-purple-deep);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(184, 160, 240, 0.45);
  z-index: 90;
  transition: var(--transition);
}
.fab:active {
  transform: scale(0.9);
}
.fab svg {
  width: 26px;
  height: 26px;
  stroke-width: 2;
}

/* 标签 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.chip-pink { background: var(--macaron-pink-light); color: var(--macaron-pink-deep); }
.chip-mint { background: var(--macaron-mint-light); color: #5BA88E; }
.chip-purple { background: var(--macaron-purple-light); color: var(--macaron-purple-deep); }
.chip-yellow { background: var(--macaron-yellow-light); color: #C4A030; }
.chip-blue { background: var(--macaron-blue-light); color: #4A90A8; }

/* 输入框 */
.input-group {
  margin-bottom: 16px;
}
.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.input-field {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--divider);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--bg-soft);
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}
.input-field:focus {
  outline: none;
  border-color: var(--macaron-purple);
  background: #fff;
  box-shadow: 0 0 0 3px var(--macaron-purple-light);
}
textarea.input-field {
  resize: none;
  min-height: 80px;
  line-height: 1.6;
}

/* 选择卡片 */
.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.option-chip {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--divider);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: var(--transition);
}
.option-chip.selected {
  background: var(--macaron-purple-light);
  border-color: var(--macaron-purple);
  color: var(--macaron-purple-deep);
}

/* 分段控件 */
.segment {
  display: flex;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}
.segment-item {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}
.segment-item.active {
  background: #fff;
  color: var(--macaron-purple-deep);
  box-shadow: var(--shadow-soft);
}

/* ===== 弹层 / 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60, 50, 70, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: var(--max-width);
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-overlay.show .modal-sheet {
  transform: translateY(0);
}

.modal-sheet .sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--divider);
  margin: 0 auto 16px;
}

.modal-sheet .sheet-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

/* 居中弹窗 */
.modal-center {
  align-items: center;
}
.modal-center .modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: calc(100% - 48px);
  max-width: 360px;
  padding: 24px 20px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.modal-overlay.show .modal-dialog {
  transform: scale(1);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state p {
  font-size: 14px;
}

/* ===== 响应式 ===== */

/* iPad 竖屏 */
@media (min-width: 768px) {
  :root {
    --nav-height: 72px;
    --header-height: 64px;
    font-size: 16px;
  }
  .page {
    padding: 24px;
    padding-bottom: calc(var(--nav-height) + 32px);
  }
  .fab {
    right: 32px;
    bottom: calc(var(--nav-height) + 28px);
    width: 56px;
    height: 56px;
  }
  .modal-sheet {
    max-width: 600px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}

/* iPad 横屏 / Windows 窗口 */
@media (min-width: 1024px) {
  :root {
    font-size: 15px;
  }
  #app {
    border-left: 1px solid var(--divider);
    border-right: 1px solid var(--divider);
  }
  .page {
    padding: 28px 32px;
    padding-bottom: calc(var(--nav-height) + 32px);
  }
  .fab {
    right: calc((100% - var(--max-width)) / 2 + 32px);
  }
}

/* Windows 宽屏 */
@media (min-width: 1400px) {
  :root {
    --max-width: 960px;
  }
}

/* 工具类 */
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-secondary { color: var(--text-secondary); }
