/* NEXUS Phone — Life Support Surface
 * Phone-first: one-hand, thumb-zone, minimal
 * Three views: Pulse, Capture, Status
 */

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surface Colors (dark) */
  --nx-surface-base: #0F1117;
  --nx-surface-raised: #161922;
  --nx-surface-overlay: #1C2030;
  --nx-surface-elevated: #242838;

  /* Signal Colors */
  --nx-signal-critical: #EF6C6C;
  --nx-signal-warning: #F0B95B;
  --nx-signal-success: #5BC78E;
  --nx-signal-info: #5BADE5;

  /* Text */
  --nx-text-primary: #F1F5F9;
  --nx-text-secondary: #94A3B8;
  --nx-text-muted: #64748B;

  /* Accent */
  --nx-accent: #6C8EEF;

  /* Borders */
  --nx-border-subtle: rgba(255,255,255,0.06);
  --nx-border-default: rgba(255,255,255,0.08);

  /* Typography — phone-optimized */
  --nx-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Touch */
  --nx-touch-min: 48px;
  --nx-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nx-safe-top: env(safe-area-inset-top, 0px);
}

html, body {
  height: 100%;
  font-family: var(--nx-font);
  background: var(--nx-surface-base);
  color: var(--nx-text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  user-select: none;
}

/* === App Shell === */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: var(--nx-safe-top);
}

/* === Status Bar === */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--nx-text-muted);
  flex-shrink: 0;
}

.status-bar__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--nx-text-secondary);
}

.status-bar__logo {
  width: 16px;
  height: 16px;
}

.status-bar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nx-signal-success);
}
.status-bar__dot--offline { background: var(--nx-text-muted); }

/* === View Switcher (top dots) === */
.view-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 0;
  flex-shrink: 0;
}

.view-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nx-text-muted);
  opacity: 0.3;
  transition: all 200ms;
  border: none;
  padding: 0;
  cursor: pointer;
}
.view-dot.active {
  opacity: 1;
  background: var(--nx-accent);
  transform: scale(1.3);
}

/* === Views Container (swipeable) === */
.views {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.views__track {
  display: flex;
  height: 100%;
  transition: transform 300ms ease-out;
  will-change: transform;
}

.view {
  min-width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
  padding-bottom: calc(16px + var(--nx-safe-bottom));
}

/* === PULSE VIEW === */
.pulse-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  text-align: center;
  gap: 16px;
}

.pulse-lamp {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--nx-surface-overlay);
  border: 3px solid var(--nx-border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  transition: all 400ms;
}

.pulse-lamp--green {
  background: rgba(91, 199, 142, 0.15);
  border-color: var(--nx-signal-success);
  box-shadow: 0 0 24px rgba(91, 199, 142, 0.25);
}
.pulse-lamp--yellow {
  background: rgba(240, 185, 91, 0.15);
  border-color: var(--nx-signal-warning);
  box-shadow: 0 0 24px rgba(240, 185, 91, 0.25);
  animation: pulse-glow 2s ease-in-out infinite;
}
.pulse-lamp--red {
  background: rgba(239, 108, 108, 0.15);
  border-color: var(--nx-signal-critical);
  box-shadow: 0 0 24px rgba(239, 108, 108, 0.3);
  animation: pulse-glow 1s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.pulse-label {
  font-size: 20px;
  font-weight: 700;
}
.pulse-label--green { color: var(--nx-signal-success); }
.pulse-label--yellow { color: var(--nx-signal-warning); }
.pulse-label--red { color: var(--nx-signal-critical); }

.pulse-summary {
  font-size: 14px;
  color: var(--nx-text-secondary);
  max-width: 280px;
  line-height: 1.5;
}

/* Deadline chip */
.deadline-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--nx-surface-raised);
  border: 1px solid var(--nx-border-subtle);
  border-radius: 24px;
  margin-top: 8px;
}

.deadline-chip__days {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--nx-text-primary);
}
.deadline-chip--urgent .deadline-chip__days { color: var(--nx-signal-critical); }
.deadline-chip--warning .deadline-chip__days { color: var(--nx-signal-warning); }

.deadline-chip__text {
  font-size: 12px;
  color: var(--nx-text-secondary);
  text-align: left;
  line-height: 1.3;
}

/* Alert cards */
.alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  width: 100%;
}

.alert-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--nx-surface-raised);
  border: 1px solid var(--nx-border-subtle);
  border-radius: 12px;
  border-left: 3px solid var(--nx-text-muted);
}
.alert-card--critical { border-left-color: var(--nx-signal-critical); }
.alert-card--warning { border-left-color: var(--nx-signal-warning); }
.alert-card--info { border-left-color: var(--nx-signal-info); }

.alert-card__icon { font-size: 18px; flex-shrink: 0; }

.alert-card__text {
  font-size: 13px;
  color: var(--nx-text-secondary);
  line-height: 1.4;
}

/* === CAPTURE VIEW === */
.capture-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 16px;
}

.capture-type-tabs {
  display: flex;
  gap: 4px;
  background: var(--nx-surface-raised);
  border-radius: 12px;
  padding: 4px;
}

.capture-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--nx-text-muted);
  font-family: var(--nx-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
  min-height: var(--nx-touch-min);
}
.capture-tab.active {
  background: var(--nx-surface-overlay);
  color: var(--nx-text-primary);
}

.capture-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.capture-textarea {
  flex: 1;
  width: 100%;
  min-height: 120px;
  padding: 16px;
  background: var(--nx-surface-raised);
  border: 1px solid var(--nx-border-default);
  border-radius: 12px;
  color: var(--nx-text-primary);
  font-family: var(--nx-font);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
}
.capture-textarea::placeholder { color: var(--nx-text-muted); }
.capture-textarea:focus {
  outline: none;
  border-color: var(--nx-accent);
}

/* Voice record button */
.record-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--nx-accent);
  border: none;
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  cursor: pointer;
  transition: all 150ms;
  box-shadow: 0 4px 16px rgba(108,142,239,0.3);
}
.record-btn:active { transform: scale(0.92); }
.record-btn.recording {
  background: var(--nx-signal-critical);
  animation: record-pulse 1s ease-in-out infinite;
  box-shadow: 0 4px 24px rgba(239,108,108,0.4);
}

@keyframes record-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.capture-send-btn {
  width: 100%;
  padding: 14px;
  background: var(--nx-accent);
  border: none;
  border-radius: 12px;
  color: white;
  font-family: var(--nx-font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--nx-touch-min);
  transition: opacity 150ms;
}
.capture-send-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.capture-send-btn:active:not(:disabled) { opacity: 0.8; }

.capture-hint {
  text-align: center;
  font-size: 12px;
  color: var(--nx-text-muted);
}

/* Voice view */
.voice-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.voice-status {
  font-size: 14px;
  color: var(--nx-text-secondary);
}

.voice-transcript {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  background: var(--nx-surface-raised);
  border-radius: 12px;
  font-size: 14px;
  color: var(--nx-text-secondary);
  line-height: 1.5;
  overflow-y: auto;
  max-height: 200px;
}

/* === STATUS VIEW === */
.status-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-card {
  background: var(--nx-surface-raised);
  border: 1px solid var(--nx-border-subtle);
  border-radius: 12px;
  padding: 16px;
}

.status-card__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--nx-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--nx-border-subtle);
}
.status-row:last-child { border-bottom: none; }

.status-row__label {
  font-size: 14px;
  color: var(--nx-text-secondary);
}

.status-row__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--nx-text-primary);
  font-variant-numeric: tabular-nums;
}

/* Version footer */
.version-footer {
  text-align: center;
  padding: 24px 0 8px;
  font-size: 11px;
  color: var(--nx-text-muted);
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: calc(24px + var(--nx-safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--nx-surface-elevated);
  color: var(--nx-text-primary);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  border: 1px solid var(--nx-border-default);
  z-index: 1000;
  opacity: 0;
  transition: opacity 200ms;
  pointer-events: none;
}
.toast.visible { opacity: 1; }

/* === Install banner === */
.install-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(108,142,239,0.1);
  border-bottom: 1px solid rgba(108,142,239,0.2);
  font-size: 12px;
  color: var(--nx-text-secondary);
}
.install-bar.visible { display: flex; }

.install-bar__btn {
  padding: 6px 14px;
  background: var(--nx-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--nx-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.install-bar__close {
  background: none;
  border: none;
  color: var(--nx-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  min-width: var(--nx-touch-min);
  min-height: var(--nx-touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Focus visible === */
*:focus-visible {
  outline: 2px solid var(--nx-accent);
  outline-offset: 2px;
}
