/* =========================================================
   style.css - 坐标处理工具 Web版 样式
   主题框架复刻自一机一策（yijiyice），主体配色保持一致
   ========================================================= */

:root {
  --primary: #1565c0;
  --primary-light: #e3f2fd;
  --primary-dark: #0d47a1;
  --success: #2e7d32;
  --warning: #f9a825;
  --danger: #c62828;
  --bg: #eceff1;
  --card: #fff;
  --border: #cfd8dc;
  --text: #263238;
  --text2: #546e7a;
  --radius: 6px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  padding-bottom: 40px; /* 给状态栏留空间 */
}

/* ===== 主容器 ===== */
.wrap { max-width: 1600px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding: 18px; margin-bottom: 14px;
}
.card h2 {
  font-size: 14px; font-weight: 600; margin-bottom: 10px;
  color: var(--text); border-left: 3px solid var(--primary);
  padding-left: 10px;
}

/* ===== 三栏布局 ===== */
.main-layout { display: flex; gap: 12px; align-items: flex-start; }
.main-title {
  font-size: 16px; color: var(--primary); font-weight: 600;
  margin: 0 0 6px 0; padding: 0;
}

.panel { flex: 1; min-width: 0; }
.panel-label {
  font-size: 12px; color: var(--text2); font-weight: 500;
  margin-bottom: 6px; display: flex; justify-content: space-between;
}
.panel-label .count { color: var(--danger); font-weight: 600; }

.panel textarea {
  width: 100%; height: 650px;
  border: 1px solid var(--border); border-radius: 4px;
  padding: 8px; font-size: 13px;
  font-family: 'Consolas', 'Courier New', monospace;
  resize: vertical; box-sizing: border-box;
  white-space: pre; overflow: auto;
}
.panel textarea:focus { border-color: var(--primary); outline: none; }
.panel textarea[readonly] { background: #fafafa; }

/* ===== 中间按钮列 ===== */
.btn-col {
  display: flex; flex-direction: row; gap: 8px;
  min-width: 150px;
  flex-wrap: wrap;flex:0 0 320px;
}
.btn-col hr { width: 100%; border: none; border-top: 1px solid #eee; margin: 4px 0; }

.btn-sub-col {
  display: flex; flex-direction: column; gap: 5px;
  flex: 1; min-width: 0; max-width: 50%;
}
.btn-col-title {
  font-size: 12px; font-weight: 600; color: var(--primary);
  padding-bottom: 3px; margin-bottom: 2px;
  text-align: left;
}
.btn-col-tip {
  font-size: 10px; color: #999; margin: 0; text-align: right;
  line-height: 1.2;
}

.section-title {
  font-size: 11px; color: #666; font-weight: 500;
  padding: 4px 0 2px; border-bottom: 1px dashed #ddd;
  margin-top: 2px;
}

.btn-col .row { display: flex; gap: 4px; align-items: center; }
.btn-col .row input, .btn-col .row select {
  padding: 4px 6px;
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 12px; box-sizing: border-box;
  background: #fafafa; box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.btn-col .row select { cursor: pointer; }
.btn-col .row span { font-size: 11px; color: #666; white-space: nowrap; }

.btn-col button {
  padding: 4px 5px; border: 1px solid var(--border);
  border-radius: 4px; background: #fff; color: #333;
  cursor: pointer; font-size: 12px; transition: all .15s;
  white-space: nowrap; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.btn-col button:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.btn-col button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-col button.primary:hover { background: var(--primary-dark); }
.btn-col button.danger { color: var(--danger); border-color: #ffcdd2; }
.btn-col button.danger:hover { background: #ffebee; }

/* ===== 历史记录面板 ===== */
.history-panel { flex: 0 0 280px; }
.history-panel h3 { font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text2); }

#history-list {
  border: 1px solid var(--border); border-radius: 4px;
  max-height: 620px; overflow-y: auto;
  font-size: 12px; background: #fafafa;
}
#history-list div {
  padding: 6px 10px; border-bottom: 1px solid #eceff1;
  cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
#history-list div:hover { background: var(--primary-light); }
#history-list div:last-child { border-bottom: none; }

/* ===== 空白字符可视化 ===== */
.ws-switch-wrap {
  display: inline-block; position: relative; width: 36px; height: 20px; margin-left: 8px; vertical-align: middle;
}
.ws-switch-wrap input { opacity: 0; width: 0; height: 0; }
.ws-switch-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc; border-radius: 20px; transition: .3s;
}
.ws-switch-slider::before {
  position: absolute; content: ''; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .3s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.ws-switch-wrap input:checked + .ws-switch-slider { background: var(--primary); }
.ws-switch-wrap input:checked + .ws-switch-slider::before { transform: translateX(16px); }
.ws-switch-label { font-size: 11px; color: var(--text2); margin-left: 4px; vertical-align: middle; }

.panel textarea.ws-mode {
  background: #f5f5f5;
  cursor: default;
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .main-layout { flex-direction: column; }
  .btn-col { flex-direction: row; flex-wrap: wrap; padding-top: 0; }
  .btn-col hr { display: none; }
  .history-panel { flex: 1; width: 100%; }
}
@media (max-width: 600px) {
  .main-layout { flex-direction: column; align-items: stretch; }
  .main-layout > * { align-self: auto; }

  .header { padding: 10px 12px; }
  .header h1 { font-size: 16px; }
  .wrap { padding: 8px; }

  .panel { width: 100%; flex: none; align-self: auto; }
  .panel textarea { height: 300px; width: 100%; box-sizing: border-box; }

  .btn-col {
    flex: 0 1 auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 5px;
    width: 100%;
    min-width: unset;
    align-self: auto;
  }
  .btn-sub-col {
    flex: 0 0 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    max-width: 50%;
    min-width: 49%;
    align-self: auto;
  }
  .btn-col button {
    flex: 0 0 auto;
    padding: 6px 8px;
    font-size: 11px;
    white-space: nowrap;
	width:100%;
    min-height: unset;
    align-self: flex-start;
  }
  .btn-col button.primary,
  .btn-col button.danger {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  .btn-col .row {
    flex-basis: 100%;
    display: flex;
    flex-wrap: nowrap;
  }
  .btn-col .row input {
    width: 40px;
    flex: 0 0 40px;
    padding: 4px 2px;
  }
  .btn-col-title {
    flex-basis: 100%;
    font-size: 11px;
    text-align: left;
  }
  .btn-col-tip { text-align: left; }

  .history-panel { width: 100%; flex: none; align-self: auto; }
  .status-bar { padding: 6px 8px; }
}