/* ONEMORE SPA - 全局样式优化版 */

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

:root {
  --bg: #F9F5F1;
  --card-bg: #FFFFFF;
  --primary: #7B5E5A;
  --primary-light: #C4A8A2;
  --primary-dark: #5D4845;
  --primary-bg: #F5EDE8;
  --accent: #E8B4B8;
  --accent-green: #A8C9A0;
  --accent-blue: #B8C9E8;
  --accent-purple: #D4B8E8;
  --text: #2D2022;
  --text-light: #9A8C84;
  --text-white: #FFFFFF;
  --border: #EDE4DC;
  --border-light: #F4EDE6;
  --shadow: 0 1px 3px rgba(123, 94, 90, 0.06), 0 1px 2px rgba(123, 94, 90, 0.04);
  --shadow-hover: 0 6px 20px rgba(123, 94, 90, 0.1), 0 2px 6px rgba(123, 94, 90, 0.06);
  --shadow-card: 0 2px 8px rgba(123, 94, 90, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-top: constant(safe-area-inset-top);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 顶部导航 */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--text-white);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* 月份选择器 */
.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.month-nav button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.month-nav button:hover { background: rgba(255,255,255,0.35); }

.month-label {
  color: white;
  font-size: 15px;
  font-weight: 600;
  min-width: 100px;
  text-align: center;
}

/* 当前用户选择 */
.user-selector {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.user-selector option { color: var(--text); }

/* 主容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 视图切换 */
.view-tabs {
  display: flex;
  gap: 2px;
  background: var(--card-bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  width: fit-content;
}

.view-tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-light);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.view-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(123, 94, 90, 0.2);
}

.view-tab:hover:not(.active) {
  background: var(--primary-bg);
  color: var(--primary);
}

/* 卡片 */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 月度概览 */
.overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.overview-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-card);
  text-align: center;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.overview-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.overview-item.has-holiday { border-top: 3px solid var(--accent); }
.overview-item:not(.has-holiday) { border-top: 3px solid var(--primary-light); }

.overview-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.overview-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.overview-holiday-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
  font-weight: 500;
}

/* 日历 */
.calendar {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  overflow-x: auto;
}

/* 固定姓名列 */
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 10;
  box-shadow: 2px 0 6px rgba(0,0,0,0.08);
}

/* 日历网格线 */
.calendar table {
  border-collapse: collapse;
}
.calendar table th,
.calendar table td {
  border: 1px solid #E8E0D8;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 120px repeat(7, 1fr);
  gap: 2px;
  min-width: 700px;
}

.cal-header {
  background: var(--primary-light);
  color: white;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
}

.cal-header.weekend { background: var(--accent); }
.cal-header.staff-name { background: var(--primary); }

.cal-cell {
  padding: 6px 4px;
  text-align: center;
  font-size: 13px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.cal-cell:hover { background: var(--bg); }
.cal-cell.weekend { background: #FFF5F5; }
.cal-cell.holiday { background: #FFF8E8; }
.cal-cell.has-leave { font-weight: 600; }

.leave-full { background: var(--accent); color: white; }
.leave-half { background: var(--accent-blue); color: white; }
.leave-full.shared-store { background: var(--accent-purple); }
.leave-half.shared-store { background: #C8D8F0; }

.cal-cell .leave-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* 人员列表视图 */
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.staff-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  border-left: 4px solid var(--primary);
  transition: box-shadow 0.2s;
}

.staff-card:hover { box-shadow: var(--shadow-hover); }

.staff-card.laohankou { border-left-color: var(--accent); }
.staff-card.youyu { border-left-color: var(--accent-blue); }
.staff-card.shared { border-left-color: var(--accent-purple); }

.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.staff-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.staff-store {
  font-size: 12px;
  color: var(--text-light);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.staff-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-item {
  flex: 1;
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.stat-value { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-light); }

.staff-leaves {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.8;
}

.leave-tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

/* 按钮 */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
  background: #E88B8B;
  color: white;
}

.btn-danger:hover { background: #D67070; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 450px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.modal-body { margin-bottom: 20px; }

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 表单 */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: white;
  color: var(--text);
}

.form-control:focus { border-color: var(--primary); }

.radio-group {
  display: flex;
  gap: 12px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s;
}

.radio-label.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: white;
}

/* 提示框 */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-warning {
  background: #FFF8E8;
  border: 1px solid #FFE0A8;
  color: #8B6D00;
}

.alert-info {
  background: #E8F4FF;
  border: 1px solid #A8D0F0;
  color: #0050A0;
}

.alert-success {
  background: #E8F8E8;
  border: 1px solid #A0D8A0;
  color: #2D6B2D;
}

/* Toast 通知 */
.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  z-index: 2000;
  font-size: 14px;
  max-width: 300px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 当日休假汇总 */
.today-leaves {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}

.today-leaves-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }

/* 图例 */
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-light);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

/* 同步状态 */
.sync-status {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============ 欢迎弹窗 ============ */
.welcome-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #8B6F6A 0%, #6B5350 50%, #5A4540 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.welcome-card {
  text-align: center;
  color: white;
  animation: welcomeUp 0.6s ease;
}

.welcome-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: bloom 2s ease infinite alternate;
}

.header-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  padding: 2px;
}

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

.welcome-flower {
  font-size: 64px;
  margin-bottom: 16px;
  animation: bloom 2s ease infinite alternate;
}

@keyframes bloom {
  from { transform: scale(1) rotate(-5deg); }
  to { transform: scale(1.1) rotate(5deg); }
}

.welcome-brand {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.welcome-subtitle {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 6px;
  opacity: 0.9;
  margin-bottom: 24px;
}

.welcome-divider {
  width: 60px;
  height: 2px;
  background: rgba(255,255,255,0.3);
  margin: 0 auto 24px;
}

.welcome-desc {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 32px;
}

.welcome-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 14px 40px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(10px);
}

.welcome-btn:hover {
  background: rgba(255,255,255,0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ============ 手机优化 ============ */
@media (max-width: 768px) {
  .header { padding: 12px; }
  .header-content { gap: 8px; }
  .header-title { font-size: 16px; }
  .header-title span:nth-child(2) { display: none; }
  .header-controls { width: 100%; justify-content: space-between; gap: 6px; }
  .month-nav button { width: 28px; height: 28px; font-size: 14px; }
  .month-label { font-size: 13px; min-width: 80px; }
  .user-selector { font-size: 12px; padding: 6px 8px; max-width: 120px; }
  .container { padding: 10px; }

  .view-tabs { width: 100%; }
  .view-tab { padding: 8px 10px; font-size: 12px; flex: 1; text-align: center; }

  .overview { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .overview-item { padding: 12px 8px; }
  .overview-value { font-size: 22px; }
  .overview-label { font-size: 11px; }

  .card { padding: 12px; margin-bottom: 12px; }
  .calendar { padding: 8px; }
  .calendar table { min-width: 650px; }
  .calendar th { padding: 4px 2px; font-size: 10px; }
  .calendar td { padding: 2px; min-width: 32px; height: 32px; }

  .staff-grid { grid-template-columns: 1fr; gap: 10px; }
  .staff-card { padding: 12px; }
  .staff-name { font-size: 16px; }
  .stat-value { font-size: 18px; }

  .modal { padding: 18px; max-width: 100%; }
  .modal-title { font-size: 16px; }
  .radio-group { flex-direction: column; gap: 8px; }
  .radio-label { justify-content: center; padding: 12px; }
  .form-control { font-size: 16px; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; min-width: 80px; }

  .btn-sm { padding: 6px 10px; font-size: 12px; }
  .alert { font-size: 12px; padding: 10px; }

  .toast { top: 70px; right: 10px; left: 10px; max-width: none; font-size: 13px; }

  .welcome-brand { font-size: 26px; }
  .welcome-subtitle { font-size: 16px; }
  .welcome-logo { width: 72px; height: 72px; padding: 8px; margin-bottom: 14px; }
  .header-logo { width: 24px; height: 24px; }
}

@media (max-width: 380px) {
  .header-title { font-size: 14px; }
  .month-label { font-size: 12px; min-width: 70px; }
  .user-selector { max-width: 100px; font-size: 11px; }
  .overview { grid-template-columns: 1fr 1fr; }
  .view-tab { font-size: 11px; padding: 6px; }
}

/* 全局移除number input的上下箭头 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
