/* public/css/work.css */
/* 工时模块样式 - 与日记本主题保持一致 */

:root {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --text-color: #1e293b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  --radius: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ==================== 顶部栏 ==================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-color);
  cursor: pointer;
  transition: 0.15s;
}

.back-btn:hover {
  background: var(--bg-color);
}

.back-btn:active {
  transform: scale(0.96);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

#user-name {
  font-size: 14px;
  font-weight: 500;
}

/* ==================== 容器 ==================== */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

/* ==================== 统计栏 ==================== */
.stats {
  display: flex;
  background: linear-gradient(135deg, #1e293b, #334155);
  border-radius: var(--radius);
  padding: 18px 0;
  margin-bottom: 16px;
  color: #fff;
  box-shadow: var(--shadow);
}

.stats .item {
  flex: 1;
  text-align: center;
}

.stats .num {
  display: block;
  font-size: 24px;
  font-weight: 700;
}

.stats .num.green {
  color: #4ade80;
}

.stats .num.orange {
  color: #fbbf24;
}

.stats .label {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

/* ==================== 卡片 ==================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* ==================== 日历头部 ==================== */
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cal-header span {
  font-size: 18px;
  font-weight: 600;
}

.cal-header button {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-color);
  transition: 0.15s;
}

.cal-header button:hover {
  background: var(--bg-color);
}

.cal-header button:active {
  transform: scale(0.92);
}

/* ==================== 日历网格 ==================== */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-grid .weekday {
  font-size: 12px;
  color: var(--text-light);
  padding: 6px 0;
  text-align: center;
  font-weight: 500;
}

.cal-grid .day {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.1s;
  background: #f8fafc;
  position: relative;
  user-select: none;
}

.cal-grid .day:hover {
  background: #e2e8f0;
}

.cal-grid .day:active {
  transform: scale(0.92);
}

.cal-grid .day.other-month {
  color: #cbd5e1;
  background: transparent;
  cursor: default;
}

.cal-grid .day.other-month:hover {
  background: transparent;
}

.cal-grid .day.today {
  border: 2px solid var(--primary-color);
}

.cal-grid .day.has-record {
  background: #dbeafe;
}

.cal-grid .day.selected {
  background: var(--primary-color);
  color: #fff;
}

.cal-grid .day .badge {
  font-size: 9px;
  background: var(--error-color);
  color: #fff;
  border-radius: 4px;
  padding: 0 4px;
  position: absolute;
  top: 2px;
  right: 2px;
  font-weight: 600;
}

/* ==================== 日详情 ==================== */
.detail-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

#detail-content .empty {
  text-align: center;
  color: var(--text-light);
  padding: 16px 0;
  font-size: 14px;
}

#detail-content .btn-add {
  display: block;
  margin: 12px auto 0;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}

#detail-content .btn-add:hover {
  background: var(--primary-dark);
}

#detail-content .btn-add:active {
  transform: scale(0.96);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.info-row:last-of-type {
  border-bottom: none;
}

.info-row span:first-child {
  color: var(--text-light);
}

.info-row.total {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-color);
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
  padding-top: 12px;
}

.info-row.total span:last-child {
  color: var(--primary-color);
  font-size: 20px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.actions .btn-edit {
  background: var(--primary-color);
  color: #fff;
}

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

.actions .btn-del {
  background: #fee2e2;
  color: var(--error-color);
}

.actions .btn-del:hover {
  background: #fecaca;
}

.actions button:active {
  transform: scale(0.96);
}

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

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

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 400px;
  width: 100%;
  animation: pop 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes pop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal h3 {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
}

.modal .field {
  margin-bottom: 12px;
}

.modal .field label {
  display: block;
  font-size: 14px;
  color: #475569;
  margin-bottom: 4px;
}

.modal .field input,
.modal .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  background: #fafafa;
  transition: border-color 0.2s;
  font-family: inherit;
}

.modal .field input:focus,
.modal .field select:focus {
  border-color: var(--primary-color);
  background: #fff;
}

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

.modal-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.modal-actions .btn-confirm {
  background: var(--primary-color);
  color: #fff;
}

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

.modal-actions .btn-cancel {
  background: #e2e8f0;
  color: #475569;
}

.modal-actions .btn-cancel:hover {
  background: #cbd5e1;
}

.modal-actions button:active {
  transform: scale(0.96);
}

/* ==================== 响应式 ==================== */
@media (max-width: 400px) {
  .stats .num {
    font-size: 20px;
  }
  .container {
    padding: 12px;
  }
  .card {
    padding: 14px 12px;
  }
}