/* ========================================================
   网络备忘录 样式表 (严格兼容 iPad mini 1 / iOS 9.3.5)
   注意：杜绝使用 flex gap，所有间距采用 margin 处理；
   前缀适配 -webkit- 前缀；大触控目标；护眼清爽黑板/白板手绘风格。
   ======================================================== */

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #f4f6fa;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "STHeiti", "Microsoft YaHei", sans-serif;
  color: #2c3e50;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* 主容器：模拟手绘原型图外层红色大圆角线框 */
.memo-container {
  width: 96%;
  max-width: 1100px;
  min-height: 94vh;
  margin: 16px auto;
  padding: 16px;
  border: 3px solid #e74c3c;
  border-radius: 24px;
  background-color: #ffffff;
  -webkit-box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  display: block;
  position: relative;
}

/* 顶部外框区域 (原型图顶部红色框) */
.header-box {
  width: 100%;
  padding: 12px 18px;
  border: 2px solid #e74c3c;
  border-radius: 18px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 16px;
  background-color: #fffaf9;
}

/* 左侧：时间、日期、天气 */
.header-left {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
}

.clock-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: baseline;
  -webkit-align-items: baseline;
  align-items: baseline;
}

.clock-time {
  font-size: 26px;
  font-weight: 700;
  color: #1e3799;
  letter-spacing: 1px;
  font-family: "Courier New", Courier, monospace;
}

.clock-date {
  font-size: 14px;
  color: #576574;
  margin-left: 10px;
  font-weight: 600;
}

.clock-week {
  font-size: 14px;
  color: #e74c3c;
  margin-left: 6px;
  font-weight: 700;
}

.weather-row {
  margin-top: 6px;
  font-size: 13px;
  color: #34495e;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.weather-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background-color: #eef2f7;
  margin-right: 6px;
  font-weight: 500;
}

.weather-tag.city {
  background-color: #e0e8f9;
  color: #1e3799;
  font-weight: 700;
}

.weather-tag.today {
  background-color: #fef5e7;
  color: #d35400;
}

.weather-tag.tomorrow {
  background-color: #edf7ed;
  color: #27ae60;
}

/* 中间大标题 */
.header-center {
  text-align: center;
}

.main-title {
  font-size: 32px;
  font-weight: 800;
  color: #0984e3;
  letter-spacing: 2px;
}

/* 右侧切换按钮 (原型图胶囊按钮) */
.header-right {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.mode-switch-capsule {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  border: 2px solid #0984e3;
  border-radius: 20px;
  overflow: hidden;
  background-color: #ffffff;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #0984e3;
  cursor: pointer;
  outline: none;
  -webkit-transition: all 0.2s ease;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background-color: #0984e3;
  color: #ffffff;
}

.btn-change-pwd {
  margin-left: 8px;
  border: 1px dashed #7f8c8d;
  background: #f8f9fa;
  color: #576574;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 14px;
  cursor: pointer;
}

.btn-lock {
  margin-left: 8px;
  border: 1.5px solid #e74c3c;
  background: #ffffff;
  color: #e74c3c;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 14px;
  cursor: pointer;
  -webkit-transition: all 0.2s ease;
  transition: all 0.2s ease;
}

.btn-lock:active {
  background: #e74c3c;
  color: #ffffff;
}

/* 锁屏防捣乱遮罩 */
.lock-overlay {
  width: 100%;
  min-height: 420px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.lock-card {
  max-width: 360px;
  padding: 30px 24px;
  border: 2px dashed #0984e3;
  border-radius: 20px;
  background-color: #f7faff;
}

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

.lock-title {
  font-size: 20px;
  font-weight: 800;
  color: #2c3e50;
  margin-bottom: 8px;
}

.lock-desc {
  font-size: 14px;
  color: #7f8c8d;
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn-unlock {
  border: none;
  background-color: #0984e3;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 28px;
  border-radius: 12px;
  cursor: pointer;
  -webkit-box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
  box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
}

.btn-unlock:active {
  background-color: #076bbb;
}

/* 下半部分外框 (原型图内容蓝色框) */
.content-box {
  width: 100%;
  padding: 16px;
  border: 2px solid #e74c3c;
  border-radius: 20px;
  background-color: #ffffff;
  min-height: 480px;
}

/* 服务端模式原地添加栏 (方式 A) */
.add-bar {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  margin-bottom: 14px;
  padding: 10px;
  background-color: #f0f7ff;
  border: 2px dashed #0984e3;
  border-radius: 14px;
}

.note-input {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  height: 44px;
  border: 1px solid #74b9ff;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 16px;
  outline: none;
  background-color: #ffffff;
}

.note-input:focus {
  border-color: #0984e3;
  -webkit-box-shadow: 0 0 8px rgba(9, 132, 227, 0.3);
  box-shadow: 0 0 8px rgba(9, 132, 227, 0.3);
}

.btn-add {
  height: 44px;
  margin-left: 10px;
  padding: 0 20px;
  background-color: #0984e3;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-add:active {
  background-color: #076bbb;
}

/* 状态栏 */
.sync-status {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  font-size: 12px;
  color: #7f8c8d;
  margin-bottom: 10px;
  padding-left: 4px;
}

.sync-status .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #e67e22;
  margin-right: 6px;
}

.sync-status.online .dot {
  background-color: #2ecc71;
}

.sync-status.offline .dot {
  background-color: #e74c3c;
}

/* 备忘列表 */
.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 备忘项外层：隐藏右侧超出的删除抽屉 */
.note-item-wrapper {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  border-radius: 12px;
}

/* 滑动抽屉轨道 */
.swipe-track {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  width: 100%;
  margin-right: -86px;
  -webkit-transition: -webkit-transform 0.18s ease-out;
  transition: transform 0.18s ease-out;
}

/* 备忘主卡片 (原型图手绘蓝色圆角卡片) */
.note-item {
  -webkit-box-flex: 1;
  -webkit-flex: 1 0 100%;
  flex: 1 0 100%;
  width: 100%;
  background-color: #ffffff;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  min-height: 58px;
  padding: 10px 14px;
  border: 2px solid #0984e3;
  border-radius: 12px;
  touch-action: pan-y;
  -webkit-transition: border-color 0.2s ease, background-color 0.2s ease;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

/* 置顶事件卡片高亮风格 (温暖金橙手绘边框与底色) */
.note-item.is-pinned {
  border-color: #f39c12;
  background-color: #fffdf5;
  -webkit-box-shadow: 0 3px 10px rgba(243, 156, 18, 0.12);
  box-shadow: 0 3px 10px rgba(243, 156, 18, 0.12);
}

/* 置顶标签小徽章 (多端直观可见) */
.pinned-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 8px;
  background-color: #fef5e7;
  border: 1px solid #f39c12;
  color: #d35400;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  vertical-align: middle;
  line-height: 1.3;
}

/* 服务端专属置顶/取消置顶按钮 */
.btn-pin {
  border: 1.5px solid #dcdde1;
  background: #f8f9fa;
  color: #7f8c8d;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-left: 8px;
  white-space: nowrap;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-transition: all 0.2s ease;
  transition: all 0.2s ease;
}

.btn-pin:hover {
  border-color: #f39c12;
  color: #e67e22;
  background-color: #fefcf5;
}

.btn-pin.active {
  border-color: #f39c12;
  background-color: #fef5e7;
  color: #d35400;
  font-weight: 700;
}

.btn-pin.active:hover {
  background-color: #fdebd0;
  color: #c0392b;
}

/* 左侧圆圈 (原型图绿/蓝色圆圈) */
.note-circle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 2.5px solid #27ae60;
  border-radius: 50%;
  margin-right: 14px;
  cursor: pointer;
  background-color: #ffffff;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-transition: all 0.2s ease;
  transition: all 0.2s ease;
}

.note-circle:hover {
  background-color: #eafaf1;
}

/* 完成打勾状态 */
.note-circle.checked {
  background-color: #27ae60;
  border-color: #27ae60;
}

.note-circle.checked:after {
  content: '✓';
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

/* 备忘文本 */
.note-text {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  font-size: 18px;
  line-height: 1.4;
  color: #2c3e50;
  font-weight: 500;
  word-break: break-all;
  padding: 4px 6px;
  border-radius: 6px;
}

/* 服务端编辑模式下的文本高亮 */
.note-text.editable:hover {
  background-color: #f1f2f6;
  cursor: text;
}

/* 拖拽把手图标 (右侧方便 iPad 手指触摸上下拖动) */
.drag-handle {
  width: 36px;
  height: 36px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  color: #74b9ff;
  font-size: 22px;
  cursor: grab;
  margin-left: 8px;
  touch-action: none;
}

.drag-handle:active {
  cursor: grabbing;
  color: #0984e3;
}

/* 右侧抽屉删除按钮 (平时在屏幕外，向左滑入可视区) */
.swipe-delete-btn {
  width: 80px;
  min-width: 80px;
  margin-left: 6px;
  background-color: #e74c3c;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.swipe-delete-btn:active {
  background-color: #c0392b;
}

/* 拖拽时的动画和镜像占位 */
.note-item-wrapper.dragging {
  opacity: 0.6;
  border: 2px dashed #0984e3;
  -webkit-transform: scale(1.02);
  transform: scale(1.02);
  -webkit-box-shadow: 0 10px 24px rgba(9, 132, 227, 0.25);
  box-shadow: 0 10px 24px rgba(9, 132, 227, 0.25);
  z-index: 100;
  cursor: grabbing;
}

.note-item-wrapper.drag-over {
  border-top: 3px solid #e74c3c;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #95a5a6;
}

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

.empty-text {
  font-size: 18px;
  font-weight: 600;
  color: #7f8c8d;
}

.empty-subtext {
  font-size: 13px;
  margin-top: 6px;
}

/* 已完成折叠收纳区 (选项 B) */
.completed-section {
  margin-top: 24px;
  border-top: 1px dashed #dcdde1;
  padding-top: 14px;
}

.completed-toggle {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #7f8c8d;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  background-color: #f8f9fa;
  margin-bottom: 10px;
}

.completed-toggle .arrow {
  display: inline-block;
  margin-right: 8px;
  font-size: 12px;
  -webkit-transition: -webkit-transform 0.2s ease;
  transition: transform 0.2s ease;
}

.completed-toggle.open .arrow {
  -webkit-transform: rotate(90deg);
  transform: rotate(90deg);
}

.completed-list .note-item {
  border-color: #bdc3c7;
  background-color: #fafafa;
}

.completed-list .note-text {
  color: #95a5a6;
  text-decoration: line-through;
}

/* 九宫格安卓解锁弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  z-index: 9999;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 320px;
  background-color: #ffffff;
  border-radius: 20px;
  padding: 20px;
  -webkit-box-shadow: 0 16px 36px rgba(0,0,0,0.25);
  box-shadow: 0 16px 36px rgba(0,0,0,0.25);
  text-align: center;
}

.modal-header {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-header h3 {
  font-size: 18px;
  color: #2c3e50;
  font-weight: 700;
}

.btn-close-modal {
  border: none;
  background: transparent;
  font-size: 24px;
  color: #95a5a6;
  cursor: pointer;
}

.gesture-tip {
  font-size: 13px;
  color: #e74c3c;
  margin-bottom: 14px;
  min-height: 20px;
  font-weight: 600;
}

.canvas-wrapper {
  width: 280px;
  height: 280px;
  margin: 0 auto;
  position: relative;
  background-color: #f8f9fb;
  border-radius: 16px;
  border: 1px solid #e1e8ed;
}

#gesture-canvas {
  width: 280px;
  height: 280px;
  display: block;
  touch-action: none;
}

.modal-footer {
  margin-top: 14px;
}

.btn-cancel {
  border: 1px solid #dcdde1;
  background: #ffffff;
  padding: 8px 24px;
  border-radius: 12px;
  font-size: 14px;
  color: #576574;
  cursor: pointer;
}

/* 响应式：针对 iPad mini 1 横屏 (1024x768) 与 竖屏 (768x1024) 优化 */
@media screen and (max-width: 860px) {
  .header-box {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
  }
  .header-left, .header-center, .header-right {
    margin-bottom: 8px;
    width: 100%;
    text-align: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
  }
  .clock-row, .weather-row {
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
  }
}
