/* ==========================================================================
   life.css — 100-Year Life in Weeks Cyber-Glassmorphism Styles
   Zero External Dependencies • Responsive • Theme Support • Print Mode
   ========================================================================== */

:root {
  --life-bg: #06060c;
  --life-surface: rgba(13, 17, 28, 0.65);
  --life-surface-hover: rgba(20, 27, 45, 0.85);
  --life-border: rgba(56, 189, 248, 0.16);
  --life-border-hover: rgba(56, 189, 248, 0.45);
  --life-cyan: #38bdf8;
  --life-purple: #c084fc;
  --life-green: #34d399;
  --life-amber: #fbbf24;
  --life-red: #f87171;
  --life-indigo: #818cf8;
  --life-glow: rgba(56, 189, 248, 0.25);
  --life-font-mono: 'JetBrains Mono', monospace;
  --life-font-body: 'Plus Jakarta Sans', sans-serif;
}

[data-theme="light"] {
  --life-bg: #f8fafc;
  --life-surface: rgba(255, 255, 255, 0.88);
  --life-surface-hover: rgba(255, 255, 255, 0.98);
  --life-border: rgba(148, 163, 184, 0.35);
  --life-border-hover: rgba(2, 132, 199, 0.5);
  --life-cyan: #0284c7;
  --life-purple: #7c3aed;
  --life-green: #059669;
  --life-amber: #d97706;
  --life-red: #dc2626;
  --life-indigo: #4f46e5;
  --life-glow: rgba(2, 132, 199, 0.15);
}

body.life-page {
  background-color: var(--life-bg);
  color: var(--text-color, #f8fafc);
  font-family: var(--life-font-body);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.life-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 5rem 1.25rem;
}

/* Header — layout handled by .page-header in style.css; override accent colors here */
.life-header {
  border-bottom-color: var(--life-border);
}

.life-breadcrumb,
.page-breadcrumb {
  background: var(--life-surface);
  border-color: var(--life-border);
}

.life-breadcrumb:hover,
.page-breadcrumb:hover {
  border-color: var(--life-cyan);
  color: var(--life-cyan);
}

.btn-life-ctrl,
.btn-page-ctrl {
  background: var(--life-surface);
  border-color: var(--life-border);
  color: var(--text-color, #f8fafc);
  font-family: var(--life-font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-life-ctrl:hover,
.btn-page-ctrl:hover {
  border-color: var(--life-cyan);
  color: var(--life-cyan);
  background: rgba(56, 189, 248, 0.1);
}

.btn-life-ctrl.highlight {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--life-cyan);
  color: var(--life-cyan);
}

.life-title-group h1,
.page-title-group h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}

.life-subtitle,
.page-subtitle {
  color: var(--text-muted, #94a3b8);
  font-size: 0.95rem;
  margin: 0;
}

/* Deep Perspective HUD Card */
.life-hud-card {
  background: var(--life-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--life-border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.life-hud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.hud-stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--life-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hud-stat-label {
  font-family: var(--life-font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
}

.hud-stat-val {
  font-family: var(--life-font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-color, #f8fafc);
  letter-spacing: -0.02em;
}

.hud-stat-val.highlight {
  color: var(--life-cyan);
  text-shadow: 0 0 12px var(--life-glow);
}

.hud-stat-val.accent {
  color: var(--life-amber);
}

.hud-stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}

/* Life Progress Bar */
.life-progress-wrap {
  width: 100%;
}

.life-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--life-border);
}

.life-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #34d399, #fbbf24);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Config Bar (Birthdate & Expectancy) */
.life-config-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--life-border);
}

.life-config-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--life-font-mono);
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}

.life-date-input,
.life-select {
  background: var(--life-surface);
  border: 1px solid var(--life-border);
  color: var(--text-color, #f8fafc);
  font-family: var(--life-font-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.life-date-input:focus,
.life-select:focus {
  border-color: var(--life-cyan);
  box-shadow: 0 0 8px var(--life-glow);
}

.life-beacon-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--life-font-mono);
  font-size: 0.82rem;
  color: var(--life-cyan);
  font-weight: 600;
}

.beacon-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--life-cyan);
  box-shadow: 0 0 8px var(--life-cyan);
  animation: beaconPulse 1.8s infinite;
}

@keyframes beaconPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px var(--life-cyan); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Quote Card */
.life-quote-card {
  background: var(--life-surface);
  border: 1px solid var(--life-border);
  border-left: 3px solid var(--life-cyan);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.quote-icon {
  font-size: 1.75rem;
  color: var(--life-cyan);
  opacity: 0.6;
}

.quote-content {
  flex: 1;
}

.quote-text {
  font-size: 0.95rem;
  font-style: italic;
  margin: 0 0 0.35rem 0;
  line-height: 1.5;
  color: var(--text-color, #f8fafc);
}

.quote-author {
  font-family: var(--life-font-mono);
  font-size: 0.76rem;
  color: var(--text-muted, #94a3b8);
}

.btn-quote-next {
  background: transparent;
  border: 1px solid var(--life-border);
  color: var(--text-muted, #94a3b8);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.btn-quote-next:hover {
  border-color: var(--life-cyan);
  color: var(--life-cyan);
  transform: rotate(90deg);
}

/* Life Stages Legend */
.life-stages-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
  font-family: var(--life-font-mono);
  font-size: 0.75rem;
}

.legend-label {
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  background: var(--life-surface);
  border: 1px solid var(--life-border);
  border-radius: 6px;
  color: var(--text-muted, #94a3b8);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.stage-child .pill-dot { background: #38bdf8; }
.stage-youth .pill-dot { background: #818cf8; }
.stage-adult .pill-dot { background: #34d399; }
.stage-prime .pill-dot { background: #fbbf24; }
.stage-wisdom .pill-dot { background: #f87171; }
.stage-elder .pill-dot { background: #c084fc; }

/* Canvas Section */
.life-canvas-section {
  background: var(--life-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--life-border);
  border-radius: 14px;
  padding: 1.25rem 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  position: relative;
}

.canvas-header-bar {
  position: relative;
  height: 22px;
  margin: 0 auto 0.4rem auto;
  font-family: var(--life-font-mono);
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
  display: block;
}

.canvas-col-tag {
  position: absolute;
  transform: translateX(-50%);
  top: 0;
  user-select: none;
  color: #94a3b8;
}

[data-theme="light"] .canvas-col-tag,
[data-theme="light"] .canvas-age-tag {
  color: #64748b;
}

.canvas-age-tag {
  position: absolute;
  transform: translateX(-100%);
  top: 0;
  user-select: none;
  font-weight: 700;
  color: #94a3b8;
}

.life-canvas-wrap {
  width: 100%;
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#life-canvas {
  display: block;
  margin: 0 auto;
  cursor: crosshair;
}

/* Tooltip */
.life-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10, 14, 26, 0.95);
  border: 1px solid var(--life-cyan);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-family: var(--life-font-mono);
  font-size: 0.75rem;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px var(--life-glow);
  white-space: nowrap;
  transition: opacity 0.08s ease;
}

[data-theme="light"] .life-tooltip {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
}

/* Expenditure Breakdown Card */
.life-breakdown-card,
.life-timeline-card {
  background: var(--life-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--life-border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.card-section-title {
  font-family: var(--life-font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--life-cyan);
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.card-section-desc {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 1rem 0;
}

.expenditure-master-wrap {
  margin-bottom: 1.5rem;
}

.expenditure-stacked-bar {
  width: 100%;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--life-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.exp-seg {
  height: 100%;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.exp-seg:hover {
  filter: brightness(1.15);
}

.exp-sleep, .exp-sleep-bg { background: #818cf8; }
.exp-work, .exp-work-bg { background: #fbbf24; }
.exp-maintenance, .exp-maintenance-bg { background: #f87171; }
.exp-conscious, .exp-conscious-bg { background: #34d399; }

/* Graphical Expenditure Cards Grid */
.exp-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.exp-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--life-border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.exp-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.35);
}

.exp-card-hero {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.04);
}

.exp-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--life-font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-color, #f8fafc);
}

.exp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

.exp-pct {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

.exp-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exp-stat-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.exp-stat-num {
  font-family: var(--life-font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-color, #f8fafc);
}

.exp-stat-num.lived {
  color: #94a3b8;
}

.exp-stat-num.ahead {
  color: #f8fafc;
}

.exp-stat-num.highlight {
  color: var(--life-cyan);
}

.exp-stat-num.hero-glow {
  color: #34d399;
  text-shadow: 0 0 16px rgba(52, 211, 153, 0.45);
}

.exp-stat-lbl {
  font-family: var(--life-font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
}

.exp-divider {
  width: 1px;
  height: 32px;
  background: var(--life-border);
}

.exp-mini-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.exp-mini-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Milestones Timeline Grid */
.milestones-timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.milestone-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--life-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.milestone-item:hover,
.milestone-item.active {
  border-color: var(--life-cyan);
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-2px);
}

.milestone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.milestone-age {
  font-family: var(--life-font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--life-cyan);
}

.milestone-week-tag {
  font-family: var(--life-font-mono);
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
}

.milestone-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-color, #f8fafc);
}

.milestone-reflection {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  font-style: italic;
  margin: 0;
}

/* Modal Export */
.life-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.life-modal-dialog {
  background: var(--life-surface);
  border: 1px solid var(--life-border);
  border-radius: 14px;
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Print Mode */
@media print {
  body.life-page {
    background: #fff !important;
    color: #000 !important;
  }
  .life-header,
  .life-config-bar,
  .btn-quote-next,
  .btn-life-ctrl,
  .life-modal,
  .life-timeline-card,
  .life-stages-legend {
    display: none !important;
  }
  .life-canvas-section {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
  }
  #life-canvas {
    filter: invert(1);
    max-width: 100% !important;
  }
}
