/* ==========================================================================
   MAERS QuantiLife — 共享基础样式 (base.css)
   两页共用：变量 + Reset + 布局 + Toast
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg-base:        #0a0a0c;
  --bg-card:        rgba(20, 20, 24, 0.85);
  --bg-input:       rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.1);
  --border:         rgba(255, 255, 255, 0.08);
  --border-focus:   rgba(255, 255, 255, 0.2);
  --text-main:  #f0f0f2;
  --text-sub:   #8a8a90;
  --text-dim:   #555560;
  --accent:     #7c6aef;
  --accent-glow:rgba(124, 106, 239, 0.3);
  --success:    #4ade80;
  --warning:    #fbbf24;
  --danger:     #f87171;
  --info:       #60a5fa;
  --radius:     16px;
  --radius-sm:  10px;
  --radius-xs:  6px;
  --shadow-card:0 8px 32px rgba(0,0,0,0.3);
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);

  /* Chart / data colors */
  --c-study:   #a78bfa;
  --c-work:    #60a5fa;
  --c-rest:    #4ade80;
  --c-travel:  #fbbf24;
  --c-exercise:#f87171;
  --c-waste:   #6b7280;
  --c-carb:    #fbbf24;
  --c-protein: #f87171;
  --c-fat:     #60a5fa;
  --c-cal:     #4ade80;
}

html {
  background: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 20% 0%,   rgba(124,106,239,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(78,205,196,0.06)  0%, transparent 50%),
    var(--bg-base);
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}


.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(30,30,35,0.95);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
  z-index: 9999;
  backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === Shared: Segmented Control === */
.segmented-control {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
  font-size: 0.75rem;
}
.segment-label {
  cursor: pointer;
  padding: 4px 14px;
  border-radius: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.segment-label:has(input[type="radio"]:checked) {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.segment-label input[type="radio"] {
  display: none;
}

/* === Shared: Toggle Switch === */
.ui-switch-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 0.75rem;
  color: var(--text-sub);
}
.ui-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  background-color: var(--bg-input);
  border-radius: 18px;
  border: 1px solid var(--border);
  transition: all 0.25s ease;
}
.ui-switch::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  background-color: var(--text-dim);
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input[type="checkbox"]:checked + .ui-switch {
  background-color: var(--accent);
  border-color: var(--accent);
}
input[type="checkbox"]:checked + .ui-switch::after {
  transform: translateX(14px);
  background-color: #fff;
}
.ui-switch-wrapper input[type="checkbox"] {
  display: none;
}

/* === Shared: Bar Chart Inline Text === */
.bar-text-inner {
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  margin-right: 4px;
  display: inline-block;
  white-space: nowrap;
  overflow: visible;
}

/* === Shared: Chart Tooltip === */
.chart-tip {
  position: fixed;
  display: none;
  pointer-events: none;
  z-index: 9999;
  background: rgba(28,28,36,0.95);
  border: 1px solid rgba(255,255,255,0.15);
  color: #f0f0f2;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
}
