/* ═══════════════════════════════════════════════════════════
 * page-logs.css — 系統日誌
 * 從原 logs.html L7-L425 抽出（共 419 行 inline）
 * 全部硬編碼色 → token；藍紫漸層 → page-accent；綠紅黃 → tag-*
 * ═══════════════════════════════════════════════════════════ */

.page-logs {
  --logs-control-bg: var(--momo-paper);
  --logs-terminal-bg: #1e1e1e;       /* 終端機沿用深色（語意需要）*/
  --logs-terminal-text: #d4d4d4;
  --logs-terminal-track: #2d2d2d;
  padding: 24px 0;
}

/* ---------- Page Header ---------- */
.page-logs .page-header {
  background: var(--logs-control-bg);
  padding: 25px 30px;
  border-radius: 8px;
  box-shadow: var(--momo-shadow-card);
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.page-logs .page-header h4 {
  margin: 0;
  color: var(--momo-ink);
  font-weight: 600;
  font-family: var(--momo-font-display);
}
.page-logs .status-indicators {
  display: flex;
  gap: 20px;
  align-items: center;
}
.page-logs .status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--momo-ink-soft);
}
.page-logs .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--momo-tag-olive);
  animation: logs-pulse 2s ease-in-out infinite;
}
@keyframes logs-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* ---------- Stats Cards ---------- */
.page-logs .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}
.page-logs .stat-card {
  background: var(--logs-control-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--momo-shadow-card);
  display: flex;
  align-items: center;
  gap: 15px;
}
.page-logs .stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.page-logs .stat-card--total .stat-icon {
  background: var(--momo-tag-rust-soft);
  color: var(--momo-tag-rust);
}
.page-logs .stat-card--error .stat-icon {
  background: var(--momo-tag-clay-soft);
  color: var(--momo-tag-clay);
}
.page-logs .stat-card--warning .stat-icon {
  background: var(--momo-tag-honey-soft);
  color: var(--momo-tag-honey);
}
.page-logs .stat-card--info .stat-icon {
  background: var(--momo-tag-sand-soft);
  color: var(--momo-tag-sand);
}
.page-logs .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--momo-ink);
  line-height: 1;
  font-family: var(--momo-font-display);
}
.page-logs .stat-label {
  font-size: 12px;
  color: var(--momo-ink-soft);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 5px;
}

/* ---------- Control Panel ---------- */
.page-logs .control-panel {
  background: var(--logs-control-bg);
  padding: 25px;
  border-radius: 8px;
  box-shadow: var(--momo-shadow-card);
  margin-bottom: 25px;
}
.page-logs .control-section          { margin-bottom: 20px; }
.page-logs .control-section--last    { margin-bottom: 0; }
.page-logs .control-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--momo-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.page-logs .control-buttons,
.page-logs .filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.page-logs .filter-row,
.page-logs .display-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}
.page-logs .display-row { gap: 30px; }
.page-logs .font-size-group {
  display: flex;
  gap: 8px;
  align-items: center;
}
.page-logs .form-hint {
  font-size: 13px;
  color: var(--momo-ink-soft);
  font-weight: 500;
}

/* ---------- Buttons ---------- */
.page-logs .btn-control {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--momo-paper);
}
.page-logs .btn-control:hover {
  transform: translateY(-2px);
  box-shadow: var(--momo-shadow-elev);
}
.page-logs .btn-control--refresh  { background: var(--momo-page-accent); }
.page-logs .btn-control--pause    { background: var(--momo-tag-honey); }
.page-logs .btn-control--resume   { background: var(--momo-tag-olive); }
.page-logs .btn-control--clear    { background: var(--momo-tag-clay); }
.page-logs .btn-control--download { background: var(--momo-tag-rust); }

.page-logs .btn-control.spinning i { animation: logs-spin 1s linear infinite; }
@keyframes logs-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- Filter Buttons ---------- */
.page-logs .btn-filter {
  padding: 8px 16px;
  border: 2px solid var(--momo-rule);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  background: var(--logs-control-bg);
  color: var(--momo-ink-soft);
}
.page-logs .btn-filter:hover {
  border-color: var(--momo-page-accent);
  color: var(--momo-page-accent);
}
.page-logs .btn-filter.is-active                { background: var(--momo-page-accent);  border-color: var(--momo-page-accent);  color: var(--momo-paper); }
.page-logs .btn-filter--error.is-active         { background: var(--momo-tag-clay);     border-color: var(--momo-tag-clay);     color: var(--momo-paper); }
.page-logs .btn-filter--warning.is-active       { background: var(--momo-tag-honey);    border-color: var(--momo-tag-honey);    color: var(--momo-paper); }
.page-logs .btn-filter--info.is-active          { background: var(--momo-tag-sand);     border-color: var(--momo-tag-sand);     color: var(--momo-paper); }

/* ---------- Search ---------- */
.page-logs .search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}
.page-logs .search-box input {
  width: 100%;
  padding: 10px 40px;
  border: 2px solid var(--momo-rule);
  border-radius: 8px;
  font-size: 14px;
  background: var(--logs-control-bg);
  color: var(--momo-ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.page-logs .search-box input:focus {
  outline: none;
  border-color: var(--momo-page-accent);
  box-shadow: 0 0 0 3px var(--momo-page-accent-soft);
}
.page-logs .search-box .search-icon,
.page-logs .search-box .clear-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--momo-ink-mute);
  font-size: 14px;
}
.page-logs .search-box .search-icon { left: 12px; }
.page-logs .search-box .clear-icon  { right: 12px; cursor: pointer; display: none; }
.page-logs .search-box.has-text .clear-icon { display: block; }

/* ---------- Font Size ---------- */
.page-logs .font-size-controls {
  display: flex;
  gap: 6px;
}
.page-logs .btn-font-size {
  padding: 8px 14px;
  border: 2px solid var(--momo-rule);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  background: var(--logs-control-bg);
  color: var(--momo-ink-soft);
}
.page-logs .btn-font-size:hover {
  border-color: var(--momo-page-accent);
  color: var(--momo-page-accent);
}
.page-logs .btn-font-size.is-active {
  background: var(--momo-page-accent);
  color: var(--momo-paper);
  border-color: var(--momo-page-accent);
}

/* ---------- Toggle Switch ---------- */
.page-logs .toggle-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.page-logs .toggle-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-logs .toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.page-logs .toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.page-logs .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--momo-rule);
  transition: 0.3s;
  border-radius: 999px;
}
.page-logs .slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--momo-paper);
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: var(--momo-shadow-card);
}
.page-logs input:checked + .slider {
  background: var(--momo-tag-olive);
}
.page-logs input:checked + .slider::before {
  transform: translateX(22px);
}
.page-logs .toggle-label {
  font-size: 14px;
  color: var(--momo-ink);
  font-weight: 500;
}

/* ---------- Log Terminal ---------- */
.page-logs .log-container-wrapper {
  background: var(--logs-control-bg);
  border-radius: 8px;
  box-shadow: var(--momo-shadow-card);
  overflow: hidden;
}
.page-logs #log-container {
  background: var(--logs-terminal-bg);
  color: var(--logs-terminal-text);
  font-family: var(--momo-font-mono, 'Consolas', 'Monaco', 'Courier New', monospace);
  padding: 20px;
  height: 65vh;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13px;
  line-height: 1.6;
}
.page-logs #log-container.font-small  { font-size: 11px; }
.page-logs #log-container.font-medium { font-size: 13px; }
.page-logs #log-container.font-large  { font-size: 15px; }

.page-logs #log-container::-webkit-scrollbar       { width: 12px; height: 12px; }
.page-logs #log-container::-webkit-scrollbar-track { background: var(--logs-terminal-track); border-radius: 6px; }
.page-logs #log-container::-webkit-scrollbar-thumb { background: var(--momo-page-accent);    border-radius: 6px; }

/* Log lines */
.page-logs .log-line               { padding: 2px 0; border-radius: 3px; }
.page-logs .log-line.error         { background: rgba(193, 96, 67, 0.15);  border-left: 3px solid var(--momo-tag-clay);  padding-left: 8px; margin: 2px 0; }
.page-logs .log-line.warning       { background: rgba(201, 162, 89, 0.15); border-left: 3px solid var(--momo-tag-honey); padding-left: 8px; margin: 2px 0; }
.page-logs .log-line.info          { border-left: 3px solid var(--momo-tag-sand); padding-left: 8px; margin: 2px 0; }

.page-logs .log-timestamp { color: #9ec59c; font-weight: 600; }
.page-logs .log-error     { color: #e89c8a; font-weight: 600; }
.page-logs .log-warning   { color: #e6c98a; font-weight: 600; }
.page-logs .log-info      { color: #b5c8d4; font-weight: 600; }
.page-logs .highlight     { background: rgba(230, 201, 138, 0.4); padding: 2px 4px; border-radius: 2px; }

.page-logs .log-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--momo-ink-mute);
}
.page-logs .log-empty i { font-size: 64px; color: var(--momo-rule); margin-bottom: 20px; }
.page-logs .log-empty p { font-size: 16px; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .page-logs {
    padding: 0;
  }

  .page-logs .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
    margin-bottom: 12px;
  }

  .page-logs .page-header h4 {
    font-size: 18px;
    line-height: 1.25;
  }

  .page-logs .status-indicators {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .page-logs .status-item {
    font-size: 12px;
  }

  .page-logs .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .page-logs .stat-card {
    min-height: 72px;
    padding: 12px;
    gap: 10px;
  }

  .page-logs .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    font-size: 16px;
    flex: 0 0 auto;
  }

  .page-logs .stat-value {
    font-size: 20px;
  }

  .page-logs .stat-label {
    margin-top: 3px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .page-logs .control-panel {
    padding: 14px;
    margin-bottom: 12px;
  }

  .page-logs .control-section {
    margin-bottom: 14px;
  }

  .page-logs .control-section-title {
    margin-bottom: 8px;
    font-size: 12px;
  }

  .page-logs .control-buttons,
  .page-logs .filter-buttons {
    display: grid;
    gap: 8px;
  }

  .page-logs .control-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .page-logs .filter-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .page-logs .btn-control,
  .page-logs .btn-filter,
  .page-logs .btn-font-size {
    justify-content: center;
    padding: 9px 10px;
    border-radius: 7px;
    font-size: 12px;
  }

  .page-logs .btn-control {
    width: 100%;
    gap: 6px;
    min-height: 38px;
  }

  .page-logs .btn-control span {
    display: none;
  }

  .page-logs .filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .page-logs .display-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .page-logs .search-box {
    width: 100%;
    min-width: 0;
  }

  .page-logs .search-box input {
    padding: 9px 36px;
    font-size: 13px;
  }

  .page-logs .font-size-group {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .page-logs .font-size-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(38px, 1fr));
    gap: 6px;
  }

  .page-logs .toggle-item {
    justify-content: space-between;
    gap: 8px;
  }

  .page-logs #log-container {
    height: 52vh;
    padding: 12px;
    font-size: 12px;
    line-height: 1.55;
  }

  .page-logs .log-empty i {
    font-size: 42px;
    margin-bottom: 12px;
  }
}

@media (max-width: 360px) {
  .page-logs .control-buttons,
  .page-logs .filter-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
