/* kitchen.css — 厨房显示（KDS）v20260913 含工单打印样式 */
/* 设计：PAD/手机/大屏均可访问，大字号+大按钮，高对比度 */

/* ★ v20261108h：KDS 页内视图切换（厨房出餐 / 传菜上菜）—— 传菜不再单成一页。
   视图条放在 .kds-header 内，避免改变 #page-kitchen 原有高度/滚动布局；
   两个 .kds-view-pane 平分剩余高度，.hidden（全局 display:none!important）负责互斥显隐。 */
.kds-view-tabs {
  display: flex;
  gap: 6px;
  margin-left: 18px;
  margin-right: auto;
  flex: none;
}
.kds-view-tab {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .15s;
}
.kds-view-tab:hover { background: rgba(255,255,255,0.14); }
.kds-view-tab.active {
  background: #1890ff;
  border-color: #1890ff;
  box-shadow: 0 0 12px rgba(24,144,255,.55);
}
.kds-view-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#kdsServeView > #page-serve,
#kdsServeView > #page-serve > #serveContent {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
@media (max-width: 768px) {
  .kds-view-tabs { margin-left: 8px; gap: 4px; }
  .kds-view-tab { padding: 6px 10px; font-size: 12px; }
}

.kds-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1a1d23;
  color: #fff;
  font-family: 'Microsoft YaHei', -apple-system, sans-serif;
  overflow: hidden;
}

.kds-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: linear-gradient(135deg, #2c3e50, #1a1d23);
  border-bottom: 2px solid #e74c3c;
}

.kds-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
}

.kds-icon { font-size: 28px; }
.kds-build { font-size: 12px; color: #999; margin-left: 8px; font-family: monospace; }

.kds-actions { display: flex; gap: 10px; }

.kds-btn {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.kds-btn:hover { background: rgba(255,255,255,0.15); }
.kds-btn.on { background: #27ae60; border-color: #27ae60; }
.kds-btn.off { background: #555; border-color: #555; }

/* 打印设置弹窗（v20260913）*/
.kds-printer-settings { display: flex; flex-direction: column; gap: 12px; }
.kds-ps-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.kds-ps-row label { cursor: pointer; user-select: none; }
.kds-ps-info { font-size: 13px; color: #666; padding: 8px 12px; background: #f5f5f5; border-radius: 4px; }
.kds-ps-actions { display: flex; gap: 8px; margin-top: 4px; }
.kds-ps-actions .kds-btn { background: #3498db; border-color: #3498db; }
.kds-ps-actions .kds-btn:hover { background: #2980b9; }

/* 顶部统计小条 */
.kds-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 14px 24px;
  background: #252a33;
}

.kds-stat-card {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border-left: 4px solid #555;
}
.kds-stat-card.pending  { border-left-color: #e74c3c; }
.kds-stat-card.cooking  { border-left-color: #f39c12; }
.kds-stat-card.ready    { border-left-color: #27ae60; }
.kds-stat-card.total    { border-left-color: #3498db; }

.kds-stat-num {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.kds-stat-card.pending  .kds-stat-num { color: #e74c3c; }
.kds-stat-card.cooking  .kds-stat-num { color: #f39c12; }
.kds-stat-card.ready    .kds-stat-num { color: #27ae60; }
.kds-stat-card.total    .kds-stat-num { color: #3498db; }

.kds-stat-label {
  font-size: 13px;
  color: #aaa;
  margin-top: 4px;
}

.kds-summary-loading, .kds-ticket-loading {
  padding: 16px;
  text-align: center;
  color: #888;
}

/* 工位 tab */
.kds-station-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  background: #2c3e50;
  overflow-x: auto;
  white-space: nowrap;
}

.kds-station-tab {
  background: rgba(255,255,255,0.06);
  border: 2px solid transparent;
  color: #fff;
  padding: 8px 18px;
  border-radius: 22px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  --station-color: #888;
}
.kds-station-tab:hover { background: rgba(255,255,255,0.12); }
.kds-station-tab.active {
  background: var(--station-color);
  border-color: var(--station-color);
  color: #fff;
  box-shadow: 0 0 12px var(--station-color);
}
.kds-station-icon { font-size: 18px; }
.kds-station-count {
  background: rgba(0,0,0,0.3);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 13px;
  margin-left: 4px;
}

/* 工单卡片区 */
.kds-ticket-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.kds-ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.kds-ticket-card {
  background: #2c3e50;
  border-radius: 10px;
  padding: 14px;
  border-left: 5px solid #3498db;
  transition: all 0.2s;
  cursor: default;
}
.kds-ticket-card.age-normal { border-left-color: #3498db; }
.kds-ticket-card.age-orange { border-left-color: #f39c12; background: #34495e; }
.kds-ticket-card.age-red    { border-left-color: #e74c3c; background: #4a2a2a; animation: kdsPulse 1.5s infinite; }
.kds-ticket-card.focused    { outline: 3px solid #f1c40f; outline-offset: 2px; }

@keyframes kdsPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(231,76,60,0); }
}

.kds-ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kds-ticket-no { display: flex; align-items: center; gap: 8px; }
.kds-idx {
  background: rgba(255,255,255,0.15);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}
.kds-order-no {
  font-family: monospace;
  font-size: 14px;
  color: #bdc3c7;
}

.kds-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.kds-status-pending  { background: #e74c3c; color: #fff; }
.kds-status-cooking  { background: #f39c12; color: #fff; }
.kds-status-ready    { background: #27ae60; color: #fff; }
.kds-status-served   { background: #7f8c8d; color: #fff; }
.kds-status-recalled { background: #9b59b6; color: #fff; }

.kds-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.kds-meta-tag {
  background: rgba(255,255,255,0.08);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #ecf0f1;
}

.kds-item-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  border-top: 1px dashed rgba(255,255,255,0.1);
  padding-top: 10px;
}

.kds-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 16px;
}
.kds-item-name { flex: 1; font-weight: 500; }
.kds-item-qty {
  background: #e74c3c;
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  min-width: 36px;
  text-align: center;
}
.kds-item-note {
  font-size: 12px;
  color: #f39c12;
  background: rgba(243,156,18,0.15);
  padding: 1px 6px;
  border-radius: 3px;
}

.kds-ticket-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.kds-action-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.kds-action-btn:hover { opacity: 0.85; }
.kds-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.kds-action-btn.btn-cooking { background: #f39c12; color: #fff; }
.kds-action-btn.btn-ready   { background: #27ae60; color: #fff; }
.kds-action-btn.btn-served  { background: #3498db; color: #fff; }
.kds-action-btn.btn-recall  { background: #9b59b6; color: #fff; }

/* 空状态 */
.kds-empty {
  text-align: center;
  padding: 60px 20px;
  color: #7f8c8d;
}

/* 底部说明 */
.kds-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 12px 24px;
  background: #1a1d23;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  color: #888;
}
.kds-legend b { color: #ecf0f1; }

/* 响应式：手机/小屏 */
@media (max-width: 768px) {
  .kds-header { padding: 10px 14px; flex-direction: column; gap: 10px; align-items: stretch; }
  .kds-title { font-size: 18px; }
  .kds-summary { grid-template-columns: repeat(2, 1fr); padding: 10px 14px; gap: 8px; }
  .kds-stat-num { font-size: 28px; }
  .kds-station-tabs { padding: 8px 14px; }
  .kds-station-tab { padding: 6px 12px; font-size: 13px; }
  .kds-ticket-area { padding: 10px 14px; }
  .kds-ticket-grid { grid-template-columns: 1fr; }
  .kds-legend { display: none; }
}