/* ═══════════════════════════════════════
   竞价分时采集 Web版 — 样式
   与 Tkinter 版 UI 布局保持一致
   ═══════════════════════════════════════ */

body {
  font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.left-panel {
  width: 330px;
  min-width: 330px;
  background: #fff;
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.left-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.right-panel .panel-header {
  padding: 8px 12px;
  border-bottom: 1px solid #dee2e6;
  background: #fafafa;
  display: flex;
  align-items: center;
  gap: 10px;
}

.right-panel .panel-body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.app-title {
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  padding: 8px 0 2px 0;
  color: #212529;
}

.settings-card {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fff;
}

.settings-card .card-title {
  font-size: 11px;
  font-weight: 600;
  color: #616161;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

.date-row {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
}

.date-row .form-control {
  flex: 1;
  font-size: 13px;
  height: 30px;
  padding: 2px 8px;
}

.date-row .btn {
  font-size: 12px;
  height: 30px;
  padding: 2px 8px;
  white-space: nowrap;
}

.btn-row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.btn-row .btn {
  font-size: 12px;
  height: 30px;
  padding: 2px 10px;
}

.collect-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.collect-row label {
  font-size: 12px;
  margin: 0;
  white-space: nowrap;
}

.collect-row .form-control-sm {
  width: 60px;
  font-size: 12px;
  height: 28px;
}

.collect-row .btn {
  font-size: 12px;
  height: 30px;
  padding: 2px 10px;
}

.progress-area {
  margin: 6px 0;
}

.progress-text {
  font-size: 11px;
  color: #616161;
  text-align: center;
}

.progress {
  height: 8px;
  margin-top: 2px;
}

.log-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log-area {
  flex: 1;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 4px;
  overflow-y: auto;
  min-height: 180px;
  max-height: 300px;
  line-height: 1.5;
}

.log-area .log-entry {
  white-space: pre-wrap;
  word-break: break-all;
}

.log-area .log-time {
  color: #6a9955;
}

#stockTable {
  font-size: 12px;
  width: 100% !important;
}

#stockTable thead th {
  background: #f0f0f0;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: relative;
}

#stockTable thead th.sorting:after,
#stockTable thead th.sorting_asc:after,
#stockTable thead th.sorting_desc:after {
  position: absolute;
  right: 4px;
  font-size: 10px;
}

#stockTable tbody td {
  padding: 3px 6px;
  vertical-align: middle;
  font-size: 12px;
}

/* 名称列：防止折行 */
#stockTable tbody td:nth-child(3) {
  white-space: nowrap;
  min-width: 76px;
}

/* 形态列：迷你分时图 + 文字 */
#stockTable tbody td:nth-child(14) {
  white-space: nowrap;
  text-align: center;
  min-width: 90px;
}

.up { color: #d32f2f !important; }
.down { color: #2e7d32 !important; }

.typeA { background-color: #fff0f0 !important; }
.typeB { background-color: #f0fff0 !important; }
.typeC { background-color: #fff8e1 !important; }
.typeD { background-color: #f3e5f5 !important; }
.typeE { background-color: #e3f2fd !important; }
.typeF { background-color: #eceff1 !important; }
.typeG { background-color: #fff3e0 !important; }

.score-high { color: #d32f2f; font-weight: bold; }
.score-mid { color: #e65100; }
.score-low { color: #9e9e9e; }

/* 行点击高亮（联动选中） */
#stockTable tbody tr.row-active {
  background-color: #bbdefb !important;
  outline: 1px solid #1976d2;
}
#stockTable tbody tr.row-active td {
  background-color: transparent !important;
}

.status-bar {
  padding: 4px 12px;
  background: #fafafa;
  border-top: 1px solid #dee2e6;
  font-size: 11px;
  color: #9e9e9e;
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-popup {
  position: fixed;
  z-index: 10000;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 12px;
  width: 310px;
}

.calendar-popup .cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.calendar-popup .cal-header select {
  font-size: 13px;
  padding: 2px 4px;
  margin: 0 2px;
}

.calendar-popup .cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  color: #9e9e9e;
  margin-bottom: 4px;
}

.calendar-popup .cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-popup .cal-day {
  text-align: center;
  padding: 4px 2px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  border: none;
  background: none;
}

.calendar-popup .cal-day:hover {
  background: #e3f2fd;
}

.calendar-popup .cal-day.holiday {
  background: #e53935;
  color: #fff;
}

.calendar-popup .cal-day.workday {
  background: #ff9800;
  color: #fff;
}

.calendar-popup .cal-day.weekend {
  color: #9e9e9e;
}

.calendar-popup .cal-day.today {
  color: #1565c0;
  font-weight: bold;
}

.calendar-popup .cal-day.selected {
  background: #bbdefb;
}

.calendar-popup .cal-legend {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 10px;
  color: #616161;
}

.calendar-popup .cal-legend span { display: flex; align-items: center; gap: 2px; }

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-idle { background: #4caf50; }
.status-loading { background: #ff9800; animation: pulse 1s infinite; }
.status-collecting { background: #2196f3; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.left-panel .panel-body::-webkit-scrollbar,
.right-panel .panel-body::-webkit-scrollbar,
.log-area::-webkit-scrollbar {
  width: 6px;
}

.left-panel .panel-body::-webkit-scrollbar-thumb,
.right-panel .panel-body::-webkit-scrollbar-thumb,
.log-area::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

@media (max-width: 768px) {
  .left-panel { width: 100%; min-width: 100%; border-right: none; border-bottom: 1px solid #dee2e6; }
  .app-container { flex-direction: column; }
}

/* ───── 分时图悬浮浮层（echarts 三图纵向排列）───── */
.hover-chart-panel {
  display: none;
  position: fixed;
  z-index: 10000;
  width: 680px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: hidden;
  pointer-events: auto;
}
.hover-chart-panel.active {
  display: block;
}
.hover-chart-title {
  padding: 6px 12px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  font-size: 13px;
  color: #c9d1d9;
  white-space: nowrap;
}
.hover-chart-body {
  display: flex;
  flex-direction: column;
  height: 440px;
}
.hover-chart-row {
  flex-shrink: 0;
  overflow: hidden;
}
.hover-chart-main {
  flex: 3;
  min-height: 0;
}
.hover-chart-sub {
  flex: 1;
  min-height: 0;
}
.hover-chart-container {
  width: 100%;
  height: 100%;
}

/* ═══ 登录弹窗 ═══ */
#loginOverlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-modal {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 24px;
}
.login-buttons button {
  height: 48px;
  font-size: 16px;
}
#loginError {
  color: #dc3545;
  display: none;
  margin-top: 8px;
  text-align: center;
  font-size: 14px;
}

/* 登录表单 */
.login-form {
  text-align: left;
}
.login-form .form-control-lg {
  height: 48px;
  font-size: 16px;
}
.login-error {
  color: #dc3545;
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
}
#guestLink:hover {
  text-decoration: underline !important;
}

/* 免责声明 */
.disclaimer-box {
  margin: 10px 12px 8px;
  padding: 10px 14px;
  font-size: 11px;
  line-height: 1.6;
  color: #c62828;
  background: linear-gradient(135deg, #fff5f5 0%, #ffeaea 100%);
  border: 1px solid #ef9a9a;
  border-left: 4px solid #e53935;
  border-radius: 6px;
  opacity: 0.85;
}
