/* ==========================================================================
   Memory Web PWA - Flat 2.0 High-Contrast Accessibility Stylesheet
   Designed specifically for Parkinson's & Cognitive Accessibility
   - Minimum tap target: 64x64px
   - High contrast ratio (WCAG AAA compliant)
   - Zero complex gestures / No pinch-zoom
   - Stationary recording state (No moving soundwaves)
   - Elimination of mandatory vertical scrolling on core views
   ========================================================================== */

:root {
  --bg-app: #0f172a;        /* Deep Slate */
  --bg-card: #1e293b;       /* Surface Slate */
  --bg-card-subtle: #334155;
  --text-main: #f8fafc;     /* 100% Crisp White */
  --text-muted: #cbd5e1;    /* High-contrast off-white */
  --border-strong: #475569;
  --border-focus: #38bdf8;  /* Focus Cyan */
  
  /* Brand / Semantic Accents */
  --accent-gold: #f59e0b;    /* Warm Nostalgia Gold */
  --accent-gold-hover: #d97706;
  --accent-blue: #38bdf8;    /* Interactive Cyan */
  --accent-green: #10b981;   /* Connected Node */
  --accent-purple: #a855f7;  /* Personal Memory */
  --recording-red: #dc2626;  /* Urgent Static Red */
  --recording-red-dark: #991b1b;
  
  --min-tap: 64px;
  --radius-btn: 12px;
  --radius-card: 20px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden; /* Eliminate mandatory scrolling on base layout */
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.45;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation; /* Eliminate 300ms delay & block pinch/zoom */
}

/* ==========================================================================
   Stationary Recording Banner (Tape Deck Mode)
   CRITICAL: Massive, static red banner reading "Currently Recording..."
   No moving soundwaves. Completely stationary for cognitive focus.
   ========================================================================== */
#recording-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 84px;
  background-color: var(--recording-red);
  color: #ffffff;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border-bottom: 4px solid var(--recording-red-dark);
  transition: transform 0.2s ease-in-out;
}

#recording-banner.hidden {
  display: none !important;
  transform: translateY(-100%);
}

.recording-label-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.recording-dot {
  width: 24px;
  height: 24px;
  background-color: #ffffff;
  border-radius: 50%;
  flex-shrink: 0;
  /* Static, NO pulsating animation to prevent visual distraction */
}

.recording-text {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #ffffff;
}

.btn-stop-recording {
  min-width: 140px;
  min-height: var(--min-tap);
  padding: 12px 24px;
  background-color: #ffffff;
  color: #b91c1c;
  font-size: 22px;
  font-weight: 900;
  border: 3px solid #7f1d1d;
  border-radius: var(--radius-btn);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.btn-stop-recording:active {
  background-color: #fee2e2;
  transform: translateY(2px);
}

/* ==========================================================================
   App Shell & Navigation Header
   ========================================================================== */
#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

header.app-header {
  height: 76px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: var(--bg-card);
  border-bottom: 2px solid var(--border-strong);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 32px;
}

.brand-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.view-switcher {
  display: flex;
  gap: 10px;
}

.btn-nav {
  min-width: var(--min-tap);
  min-height: 56px;
  padding: 0 20px;
  font-size: 18px;
  font-weight: 700;
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-btn);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-nav.active {
  background-color: var(--accent-gold);
  color: #0f172a;
  border-color: #fde68a;
}

/* ==========================================================================
   Main View Containers
   ========================================================================== */
main.view-viewport {
  flex: 1;
  position: relative;
  overflow: hidden; /* Keep viewport clean and non-scrolling */
  display: flex;
  flex-direction: column;
}

.view-pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
}

.view-pane.active {
  display: flex;
}

/* ==========================================================================
   Card View: Isolated Memory Card
   Eliminates mandatory vertical scroll: neatly arranged modular sections
   ========================================================================== */
#card-view {
  padding: 16px;
  justify-content: space-between;
}

.memory-card {
  flex: 1;
  background-color: var(--bg-card);
  border: 3px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  overflow-y: auto; /* Graceful scroll fallback ONLY if screen is small */
  -webkit-overflow-scrolling: touch;
}

/* Top metadata */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.category-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: var(--accent-blue);
  color: #0f172a;
}

.category-badge.Touchstone { background-color: var(--accent-gold); }
.category-badge.Music { background-color: var(--accent-purple); }
.category-badge.Location { background-color: var(--accent-green); }
.category-badge.Person { background-color: #f43f5e; }

.year-badge {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-muted);
}

.node-main-title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text-main);
}

/* AI Personalized Context Box */
.ai-question-box {
  background-color: rgba(245, 158, 11, 0.12);
  border-left: 6px solid var(--accent-gold);
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.ai-question-box .ai-tag {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-question-box .ai-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: #fef08a; /* Soft readable warm gold */
}

/* Audio Player Container */
.media-embed-container {
  margin-bottom: 16px;
  border-radius: var(--radius-btn);
  overflow: hidden;
  background: #000;
  height: 80px; /* Audio-only compact player */
  border: 2px solid var(--border-strong);
}

.media-embed-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Memory Captured / Recorded View */
.recorded-memory-box {
  background-color: #1e3a5f;
  border: 2px solid #38bdf8;
  border-radius: var(--radius-btn);
  padding: 16px;
  margin-bottom: 16px;
}

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

.recorded-label {
  font-size: 16px;
  font-weight: 800;
  color: #7dd3fc;
  text-transform: uppercase;
}

.transcript-content {
  font-size: 18px;
  font-style: italic;
  line-height: 1.5;
  color: #e0f2fe;
  margin-bottom: 12px;
}

/* Primary Big Recording Action Button */
.card-action-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.btn-big-record {
  min-height: 72px; /* Well above 64px requirement */
  width: 100%;
  padding: 16px 24px;
  background-color: var(--recording-red);
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  border: 3px solid #f87171;
  border-radius: var(--radius-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.4);
  transition: background-color 0.15s;
}

.btn-big-record:active {
  background-color: var(--recording-red-dark);
  transform: translateY(2px);
}

.btn-playback-native {
  min-height: var(--min-tap);
  width: 100%;
  padding: 14px 20px;
  background-color: var(--accent-blue);
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
  border: 2px solid #bae6fd;
  border-radius: var(--radius-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Connected Nodes / Edges (Pill Buttons) */
.connections-section {
  margin-top: 16px;
}

.connections-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.connections-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-btn {
  min-height: 54px; /* Accessible tactile size */
  padding: 8px 18px;
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pill-btn:active {
  background-color: var(--border-strong);
  border-color: var(--accent-blue);
}

/* ==========================================================================
   Web View: Spatial Map Canvas
   ========================================================================== */
#web-view {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

#graph-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.graph-overlay-help {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.9);
  border: 2px solid var(--border-strong);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Admin View & Common Forms
   ========================================================================== */
.admin-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-strong);
}

.admin-section {
  background-color: var(--bg-card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-bottom: 24px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--accent-gold);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  background-color: var(--bg-app);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-btn);
  color: var(--text-main);
  font-size: 18px;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.voice-input-row {
  display: flex;
  gap: 12px;
}

.btn-mic-voice-dictate {
  min-width: 64px;
  min-height: 56px;
  background-color: var(--accent-gold);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  min-height: var(--min-tap);
  padding: 12px 28px;
  background-color: var(--accent-gold);
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
}

/* Telemetry Log Feed */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.log-table th, .log-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
}

.log-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 700;
}

.log-badge-error {
  display: inline-block;
  padding: 3px 8px;
  background-color: #ef4444;
  color: #ffffff;
  border-radius: 4px;
  font-weight: 700;
}

.log-badge-info {
  display: inline-block;
  padding: 3px 8px;
  background-color: #3b82f6;
  color: #ffffff;
  border-radius: 4px;
  font-weight: 700;
}
