/* ===== 选片网站全局样式 ===== */
:root {
  --cream: #FFF9F0;
  --mint: #7FD8BE;
  --mint-dark: #5CC4A5;
  --peach: #FFB7B2;
  --peach-dark: #FF9E98;
  --lemon: #FFEAA7;
  --sky: #A8D8EA;
  --gray: #4A4A4A;
  --gray-light: #C0C0C0;
  --white: #FFFFFF;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 28px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --font: "PingFang SC", "Microsoft YaHei", "DM Sans", "Poppins", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--gray);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

/* ===== 入口页 ===== */
.entry-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #FFF9F0 0%, #E8F8F0 50%, #FFF0EE 100%);
}

.entry-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  text-align: center;
}

.entry-card .logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--mint-dark);
  margin-bottom: 8px;
}

.entry-card .subtitle {
  font-size: 14px;
  color: var(--gray-light);
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
  background: var(--white);
}

.form-group input:focus {
  border-color: var(--mint);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn-peach {
  background: var(--peach);
  color: var(--white);
}

.btn-peach:hover {
  background: var(--peach-dark);
}

.btn-mint {
  background: var(--mint);
  color: var(--white);
}

.btn-mint:hover {
  background: var(--mint-dark);
}

.btn-gray {
  background: var(--gray-light);
  color: var(--white);
  cursor: default;
}

.error-msg {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
}

/* ===== 选片页 ===== */
.pick-page {
  min-height: 100vh;
  padding-bottom: 100px;
}

.pick-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pick-header .album-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray);
}

.pick-header .selected-count {
  font-size: 14px;
  color: var(--mint-dark);
  font-weight: 600;
}

.photo-grid {
  display: grid;
  gap: 8px;
  padding: 8px;
}

/* 手机单列 */
@media (max-width: 480px) {
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

/* 平板双列 */
@media (min-width: 481px) and (max-width: 768px) {
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 桌面 3 列 */
@media (min-width: 769px) and (max-width: 1024px) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 大屏 4 列 */
@media (min-width: 1025px) {
  .photo-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.photo-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: #F5EDE0;
  transition: transform 0.15s ease;
  border: 3px solid transparent;
}

.photo-card:active {
  transform: scale(0.97);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.photo-card.selected {
  border-color: var(--mint);
  transform: scale(0.98);
}

.photo-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: var(--peach);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  0% { transform: scale(0); }
  80% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* 底部浮条 */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  padding: 12px 16px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  /* iPhone 安全区 */
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.bottom-bar .count-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray);
}

.bottom-bar .btn {
  width: auto;
  padding: 12px 24px;
  font-size: 15px;
}

.bottom-bar .btn.finished {
  background: var(--gray-light);
}

/* 确认弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-box h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

.modal-box p {
  font-size: 14px;
  color: var(--gray-light);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

.btn-outline {
  background: var(--white);
  color: var(--gray);
  border: 2px solid var(--gray-light);
}

.btn-outline:hover {
  background: #f5f5f5;
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--lemon);
  color: var(--gray);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* 网络异常小红点 */
.error-dot {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 10px;
  height: 10px;
  background: #e74c3c;
  border-radius: 50%;
  z-index: 150;
  animation: pulse 1s ease infinite;
}

.error-dot.hidden {
  display: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== 管理后台 ===== */
.admin-page {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: var(--white);
  padding: 24px 0;
  box-shadow: 2px 0 8px rgba(0,0,0,0.04);
  flex-shrink: 0;
}

.admin-sidebar .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--mint-dark);
  text-align: center;
  margin-bottom: 32px;
  padding: 0 16px;
}

.admin-sidebar nav a {
  display: block;
  padding: 12px 24px;
  color: var(--gray);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
  background: rgba(127, 216, 190, 0.15);
  color: var(--mint-dark);
  border-left: 3px solid var(--mint);
}

.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-main h1 {
  font-size: 24px;
  margin-bottom: 24px;
}

/* 相册卡片 */
.album-card {
  background: var(--white);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.album-card .info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.album-card .info p {
  font-size: 13px;
  color: var(--gray-light);
}

.album-card .actions {
  display: flex;
  gap: 8px;
}

.album-card .actions .btn {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--gray-light);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--mint);
  border-style: solid;
}

.upload-zone p {
  color: var(--gray-light);
  font-size: 14px;
}

.upload-zone .icon {
  font-size: 40px;
  margin-bottom: 12px;
}

/* 选片结果表 */
.selection-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.selection-table th,
.selection-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.selection-table th {
  background: #fafafa;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray);
}

.selection-table td {
  font-size: 14px;
}

.status-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-tag.done {
  background: rgba(127, 216, 190, 0.2);
  color: var(--mint-dark);
}

.status-tag.pending {
  background: rgba(255, 234, 167, 0.4);
  color: #b8860b;
}

/* 创建相册弹窗 */
.create-form {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
}

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFF9F0 0%, #E8F8F0 50%, #FFF0EE 100%);
  padding: 20px;
}

/* 进度条 */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--mint);
  z-index: 200;
  transition: width 0.3s;
}

/* 移动端管理后台适配 */
@media (max-width: 768px) {
  .admin-sidebar {
    display: none;
  }
  .admin-main {
    padding: 16px;
  }
  .album-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
