/* 21车结算系统 - 样式文件 */
/* Version: 2.1.4 */

/* ========== 基础重置 ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========== CSS 变量 - 卡通线条主题 ========== */
:root {
  --bg: #fafafa;
  --card: #ffffff;
  --line: #FFA6C9; /* 主线条颜色-可爱浅粉色 */
  --line2: #B5D8FE; /* 辅助线条颜色-浅蓝 */
  --line3: #C9E7C9; /* 点缀线条颜色-浅绿 */
  --text: #333333; /* 文字颜色 */
  --light-bg: #FFEEF5; /* 浅色背景-浅粉白 */
  --light-bg2: #F5F9FF; /* 浅蓝色背景 */
  --radius: 12px; /* 圆角 */
  --border-width: 2px; /* 边框宽度 */
  --font-cute: "Comic Sans MS", "幼圆", "微软雅黑", sans-serif;
}

/* ========== 页面基础样式 ========== */
html,
body {
  height: auto;
  min-height: 100%;
  background-color: var(--bg);
  /* 卡通网格背景 */
  background-image: 
    linear-gradient(rgba(250, 166, 201, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250, 166, 201, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  font-family: var(--font-cute);
}

/* ========== 应用容器 ========== */
.app {
  max-width: 1200px;
  margin: 10px auto;
  padding: 10px;
}

/* ========== 头部样式 ========== */
header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.logo {
  width: 45px;
  height: 45px;
  border: var(--border-width) solid var(--line);
  border-radius: 50%;
  background-color: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--line);
  font-size: 20px;
}

h1 {
  font-size: 18px;
  color: var(--text);
  border-bottom: var(--border-width) solid var(--line);
  padding-bottom: 3px;
  display: inline-block;
}

/* ========== 主题切换器 ========== */
.theme-switcher {
  margin-left: auto;
  position: relative;
}

.theme-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: var(--border-width) solid var(--line);
  background-color: white;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.04);
}

.theme-btn:hover {
  background-color: var(--light-bg);
}

.theme-panel {
  position: absolute;
  right: 0;
  top: 120%;
  background-color: var(--card);
  border-radius: 12px;
  border: var(--border-width) solid var(--line);
  padding: 8px 10px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.06);
  display: none;
  min-width: 140px;
  z-index: 9999;
}

.theme-panel.open {
  display: block;
}

.theme-title {
  font-size: 11px;
  color: var(--text);
  margin-bottom: 4px;
}

.theme-option {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 4px 2px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-cute);
}

.theme-option:hover {
  background-color: var(--light-bg);
  border-radius: 8px;
}

/* ========== 卡片样式 ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 15px;
  border: var(--border-width) solid var(--line);
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 卡通装饰角标 */
.card::before {
  content: "✿";
  position: absolute;
  top: -8px;
  right: 15px;
  color: var(--line);
  font-size: 16px;
}

/* ========== 网格布局 ========== */
.grid {
  display: grid;
  gap: 5px;
  align-items: center;
  width: 100%;
}

/* ========== 表格样式 ========== */
.col-title {
  font-size: 11px;
  color: var(--text);
  font-weight: bold;
  text-align: center;
  padding: 5px 0;
  background-color: var(--light-bg);
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius);
}

.cell {
  padding: 3px;
}

.cell input,
.cell select {
  width: 100%;
  padding: 6px 3px;
  border-radius: var(--radius);
  border: var(--border-width) solid var(--line);
  background-color: white;
  color: var(--text);
  text-align: center;
  font-size: 12px;
  min-height: 30px;
  font-family: var(--font-cute);
  appearance: none;
}

/* ========== 输入框样式 ========== */
.input-label {
  font-size: 11px;
  color: var(--text);
  font-weight: bold;
  white-space: nowrap;
}

/* 只读样式 */
.cell .readonly {
  background-color: var(--light-bg);
  border: var(--border-width) dashed var(--line);
}

/* 同步/跟随输入 - 锁定态样式 */
.cell .sync-input {
  background-color: var(--state-bg);
  border: 2px dashed var(--state-line);
  color: var(--state-text, #999999);
  font-weight: 500;
}

/* ========== 下拉选择框 ========== */
.inline-select {
  width: auto;
  padding: 4px 24px 4px 8px;
  font-size: 12px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  position: relative;
  background-image: none;
}

select {
  padding: 6px 28px 6px 10px;
  border-radius: var(--radius);
  border: var(--border-width) solid var(--line);
  background-color: white;
  color: var(--text);
  font-family: var(--font-cute);
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: all 0.2s ease;
  min-width: 80px;
  /* 下拉箭头 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23666666' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px 14px;
}

.inline-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23666666' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px 14px;
}

select:hover {
  background-color: var(--light-bg);
  transform: translate(-2px, -2px);
  box-shadow: 2px 2px 0 var(--line);
  border-color: var(--line);
}

select:focus {
  outline: none;
  background-color: var(--light-bg);
  border-color: var(--line);
  box-shadow: 0 0 0 2px rgba(255, 166, 201, 0.2), 2px 2px 0 var(--line);
}

select:active {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0 var(--line);
}

select option {
  padding: 8px 12px;
  background-color: white;
  color: var(--text);
  font-family: var(--font-cute);
}

select option:hover {
  background-color: var(--light-bg);
}

select option:checked {
  background-color: var(--line);
  color: white;
  font-weight: bold;
}

/* ========== 辅助样式 ========== */
.muted {
  color: #888;
  font-size: 11px;
}

/* ========== 合计行 ========== */
.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: var(--border-width) dashed var(--line);
}

.sum {
  font-size: 14px;
  font-weight: bold;
  color: var(--line);
}

/* ========== 按钮样式 ========== */
.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  padding: 8px 15px;
  border-radius: var(--radius);
  border: var(--border-width) solid var(--line);
  background-color: white;
  font-weight: bold;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-cute);
  transition: all 0.2s;
}

.btn:hover {
  background-color: var(--light-bg);
  transform: translate(-2px, -2px);
  box-shadow: 2px 2px 0 var(--line);
}

.btn.ghost {
  background-color: transparent;
  border: var(--border-width) dashed var(--line);
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--card);
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  width: min(420px, 90vw);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.08);
}

.modal h3 {
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--text);
}

.modal ul {
  padding-left: 18px;
  margin: 0 0 10px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

.modal .muted {
  color: #888;
  font-size: 11px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ========== 分区标题 ========== */
.section-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title:before {
  content: "";
  width: 8px;
  height: 18px;
  background-color: var(--line);
  border-radius: 4px;
}

/* ========== 页脚 ========== */
footer {
  margin-top: 20px;
  color: #888;
  font-size: 11px;
  text-align: center;
  padding-top: 10px;
  border-top: var(--border-width) dashed #eee;
}

/* ========== 移动端优化 ========== */
@media (max-width: 768px) {
  .app {
    padding: 8px;
    margin: 5px auto;
  }

  .cell input,
  .cell select {
    padding: 4px 2px;
    font-size: 11px;
    min-height: 26px;
    border-width: 1.5px;
  }

  .col-title {
    font-size: 10px;
    padding: 4px 0;
    border-width: 1.5px;
  }

  header {
    gap: 8px;
    margin-bottom: 12px;
  }

  .logo {
    width: 40px;
    height: 40px;
    font-size: 18px;
    border-width: 1.5px;
  }

  h1 {
    font-size: 16px;
    border-width: 1.5px;
  }

  .card {
    padding: 12px;
    margin-bottom: 12px;
    border-width: 1.5px;
  }

  .sum-row {
    flex-direction: column;
    gap: 5px;
    align-items: stretch;
    border-width: 1.5px;
  }

  .sum-row > div {
    display: flex;
    justify-content: space-between;
  }

  select.inline-select,
  select {
    padding: 4px 24px 4px 8px;
    font-size: 11px;
    background-size: 10px;
    background-position: right 6px center;
    min-width: 70px;
  }
}
