/* ===== 大棚作物生长可视化看板 - styles.css ===== */
/* 农业办公风：主色调绿/土色系，简洁响应式 */

:root {
  --green-dark: #1b5e20;
  --green-main: #2E7D32;
  --green-mid: #43A047;
  --green-soft: #66BB6A;
  --earth: #8D6E63;
  --earth-dark: #795548;
  --bg: #f3f7f0;
  --card: #ffffff;
  --border: #d7e3d3;
  --danger: #c62828;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: #333;
  min-height: 100vh;
}

/* ---------- 顶部导航 ---------- */
#app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: var(--green-main);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.header-left .logo {
  font-size: 18px;
  font-weight: 600;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.clock {
  font-family: "Consolas", "Menlo", monospace;
  font-size: 13px;
  opacity: 0.95;
}
.user-status {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.18);
  padding: 3px 8px;
  border-radius: 12px;
}

/* ---------- 按钮 ---------- */
.btn {
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  background: #e0e0e0;
  color: #333;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(0.95); }
.btn-primary { background: var(--green-main); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: rgba(255, 255, 255, 0.92); color: var(--green-main); font-weight: 600; }
.btn-enter { background: var(--green-soft); color: #fff; }

/* ---------- 主区域 ---------- */
#app-main {
  padding: 18px;
  max-width: 1280px;
  margin: 0 auto;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--green-dark);
}

/* ---------- 基地列表 ---------- */
.base-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.base-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.base-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.base-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--green-main);
}
.base-meta {
  color: #666;
  font-size: 13px;
  margin: 6px 0 12px;
}
.base-actions {
  display: flex;
  gap: 8px;
}

/* ---------- 大棚看板网格 ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.legend-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #444;
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 4px 10px;
  border-radius: 16px;
}
.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.gh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.gh-card {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 14px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.gh-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.gh-card-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gh-shedno {
  font-weight: 700;
  font-size: 16px;
  color: #333;
}
.gh-del {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 22px;
  cursor: pointer;
  font-size: 14px;
}
.gh-svg {
  width: 100%;
  height: 120px;
  margin: 6px 0;
}
.gh-cropname {
  font-weight: 600;
  font-size: 15px;
  color: var(--green-dark);
}
.gh-cropname.gh-idle {
  color: #888;
  font-weight: 500;
}
.gh-stage {
  margin-top: 4px;
  font-size: 13px;
  color: #444;
}
.gh-elapsed {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
}
.gh-edit {
  margin-top: 10px;
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: var(--green-main);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.gh-card:hover .gh-edit { background: var(--green-dark); }

.empty-tip {
  grid-column: 1 / -1;
  color: #888;
  padding: 24px;
  text-align: center;
  background: #fff;
  border: 1px dashed #ccc;
  border-radius: 10px;
}

/* ---------- 编辑 / 查看面板（右侧抽屉） ---------- */
.edit-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: flex-end;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.edit-panel.open {
  opacity: 1;
  visibility: visible;
}
.edit-panel-content {
  width: 340px;
  max-width: 92%;
  background: #fff;
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  transform: translateX(100%);
  transition: transform .25s ease;
  box-shadow: -2px 0 14px rgba(0, 0, 0, 0.2);
}
.edit-panel.open .edit-panel-content {
  transform: translateX(0);
}
.edit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.edit-head h3 {
  margin: 0;
  color: var(--green-main);
}
.edit-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #888;
  line-height: 1;
}
.readonly-tip {
  background: #FFF8E1;
  color: #8d6e00;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 10px;
}
.field {
  margin-bottom: 12px;
}
.field label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}
.field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.field input[readonly] {
  background: #f5f5f5;
  color: #666;
}
.edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 320px;
  max-width: 90%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.modal-box h3 {
  margin: 0 0 14px;
  color: var(--green-main);
}
.modal-label {
  display: block;
  font-size: 13px;
  color: #555;
  margin: 8px 0 4px;
}
.modal-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ---------- 农事日志（编辑面板内） ---------- */
.log-section {
  border-top: 1px dashed var(--border);
  margin-top: 14px;
  padding-top: 12px;
}
.log-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--green-main);
  margin-bottom: 8px;
}
.log-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.log-tab {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.log-tab:hover { border-color: var(--green-soft); color: var(--green-main); }
.log-tab.active {
  background: var(--green-main);
  color: #fff;
  border-color: var(--green-main);
}
.log-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.log-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafdf8;
  position: relative;
}
.log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.log-cat {
  font-size: 12px;
  background: rgba(46, 125, 50, 0.12);
  color: var(--green-main);
  padding: 1px 8px;
  border-radius: 10px;
}
.log-date {
  font-size: 12px;
  color: #888;
  font-family: "Consolas", "Menlo", monospace;
}
.log-content {
  font-size: 13px;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
}
.log-content-label {
  font-weight: 600;
  color: #555;
  margin-right: 4px;
}
.log-empty-field {
  color: #bbb;
  font-style: italic;
}
.log-del {
  position: static;
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.log-empty {
  font-size: 13px;
  color: #999;
  text-align: center;
  padding: 14px 0;
}
.log-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #eee;
  padding-top: 10px;
}
.log-add .field { margin-bottom: 0; }
.log-add-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.log-add-row .field { flex: 1; }
.log-add-btn {
  white-space: nowrap;
}
.clear-hint {
  font-size: 12px;
  color: var(--earth-dark);
  background: #f1ece7;
  border-left: 3px solid var(--earth);
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 8px;
  line-height: 1.4;
}

/* ---------- 农事日志管理面板（管理员弹窗） ---------- */
.logs-mgr-box {
  width: 920px;
  max-width: 96%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.logs-mgr-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.logs-mgr-head h3 { margin: 0; color: var(--green-main); }
.logs-mgr-body {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.period-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 4px;
}
.period-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #444;
  cursor: pointer;
}
.period-opt input { margin: 0; }

/* ---------- 农事日志实时表格 ---------- */
.logs-table-wrap {
  margin-top: 12px;
  max-height: 560px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
.logs-table th,
.logs-table td {
  border-bottom: 1px solid #eee;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}
.logs-table thead th {
  position: sticky;
  top: 0;
  background: var(--green-main);
  color: #fff;
  font-weight: 600;
  z-index: 1;
}
.logs-table tbody tr:nth-child(even) { background: #f7fbf5; }
.logs-table .col-sel {
  width: 34px;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}
.logs-table .col-sel input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ---------- 后台管理：基地管理员账户 ---------- */
.acct-mgr-box {
  width: 420px;
  max-width: 94%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.acct-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.acct-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fafdf8;
}
.acct-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--green-dark);
}
.acct-add {
  border-top: 1px solid #eee;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.acct-add .modal-label { margin-top: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .base-grid,
  .gh-grid {
    grid-template-columns: 1fr;
  }
  .edit-panel-content {
    width: 100%;
    max-width: 100%;
  }
  #app-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .header-right {
    flex-wrap: wrap;
  }
}

/* ===== 农事日志权限增强样式（Task 6） ===== */
.log-operator {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0;
  font-size: 12px;
  color: #6D4C41;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.masked { color: #999; font-style: italic; }
.log-tip { font-size: 12px; color: #999; font-weight: normal; }
.logs-hint { font-size: 12px; color: #999; margin-bottom: 6px; }
