/* ==========================================================================
   CHRONOX // Futuristic Cyberpunk Gaming HUD Interface Stylesheet
   ========================================================================== */

:root {
  /* Dark Void Cyberpunk Base Palette */
  --bg-void: #030408;
  --bg-primary: #05070e;
  --bg-secondary: #090e18;
  --bg-card: rgba(8, 13, 24, 0.82);
  --bg-card-hover: rgba(12, 19, 34, 0.92);
  --bg-input: rgba(6, 10, 18, 0.95);
  
  /* Primary Accent: Electric Cyan */
  --cyan-bright: #00f0ff;
  --cyan-primary: #00e5ff;
  --cyan-muted: #0ea5e9;
  --cyan-dim: rgba(0, 240, 255, 0.1);
  --cyan-glow: rgba(0, 240, 255, 0.3);
  --cyan-border: rgba(0, 240, 255, 0.28);

  /* Secondary Accents: Subtle Purple & Magenta */
  --purple-bright: #c084fc;
  --purple-primary: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.12);
  --purple-glow: rgba(168, 85, 247, 0.3);
  --purple-border: rgba(168, 85, 247, 0.3);

  --magenta-primary: #d946ef;
  --magenta-dim: rgba(217, 70, 239, 0.12);
  --magenta-glow: rgba(217, 70, 239, 0.25);

  --accent-red: #f43f5e;
  --red-dim: rgba(244, 63, 94, 0.14);

  /* Neutrals & Text Hierarchy */
  --text-pure: #ffffff;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --border-subtle: rgba(255, 255, 255, 0.08);

  /* Typography */
  --font-hud: 'Orbitron', -apple-system, sans-serif;
  --font-heading: 'Rajdhani', -apple-system, sans-serif;
  --font-body: 'Chakra Petch', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* HUD Radii & Geometry */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* Base Reset & Core Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background-color: var(--bg-void);
  color-scheme: dark;
}

body {
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ==========================================================================
   Ambient Cyberpunk Background (Atmospheric Depth & Cyber Grid)
   ========================================================================== */

.cyber-viewport-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Subtle Animated Cyber Grid Plane */
.cyber-grid-plane {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: 
    linear-gradient(to right, rgba(0, 240, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(168, 85, 247, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  transform: perspective(600px) rotateX(25deg);
  transform-origin: center center;
  animation: cyber-grid-drift 40s linear infinite;
}

@keyframes cyber-grid-drift {
  0% { transform: perspective(600px) rotateX(25deg) translateY(0); }
  100% { transform: perspective(600px) rotateX(25deg) translateY(44px); }
}

/* Scanlines overlay for CRT / HUD authenticity */
.cyber-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.2) 3px,
    rgba(0, 0, 0, 0.2) 4px
  );
  opacity: 0.6;
}

/* Ambient Radial Soft Glows */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  pointer-events: none;
  opacity: 0.16;
}

.cyan-ambient {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--cyan-bright) 0%, transparent 70%);
  top: -160px;
  left: -120px;
}

.purple-ambient {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--magenta-primary) 0%, var(--purple-primary) 50%, transparent 70%);
  bottom: -160px;
  right: -120px;
}

/* ==========================================================================
   HUD Layout Architecture
   ========================================================================== */

.app-container {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 36px 20px 60px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* HUD Panels & Corner Brackets */
.hud-panel {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

.hud-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--cyan-bright);
  pointer-events: none;
  opacity: 0.7;
}

.hud-corner.top-left {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--cyan-bright);
  border-left: 2px solid var(--cyan-bright);
}

.hud-corner.top-right {
  top: -1px;
  right: -1px;
  border-top: 2px solid var(--cyan-bright);
  border-right: 2px solid var(--cyan-bright);
}

.hud-corner.bottom-left {
  bottom: -1px;
  left: -1px;
  border-bottom: 2px solid var(--purple-bright);
  border-left: 2px solid var(--purple-bright);
}

.hud-corner.bottom-right {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--purple-bright);
  border-right: 2px solid var(--purple-bright);
}

/* ==========================================================================
   Header & Gaming HUD Telemetry
   ========================================================================== */

.cyber-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  margin-bottom: 24px;
  border-top: 1px solid rgba(0, 240, 255, 0.25);
  border-bottom: 1px solid rgba(168, 85, 247, 0.25);
  flex-wrap: wrap;
  gap: 16px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  font-family: var(--font-hud);
  font-weight: 800;
  font-size: 20px;
  color: var(--cyan-bright);
  display: flex;
  align-items: center;
  letter-spacing: 1px;
}

.hud-bracket {
  color: var(--magenta-primary);
  opacity: 0.9;
  font-weight: 300;
}

.logo-core {
  padding: 0 4px;
  color: #fff;
  text-shadow: 0 0 12px var(--cyan-bright);
}

.logo-text-block {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-hud);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 5px;
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
}

.logo-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.8px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.accent-tag {
  color: var(--cyan-bright);
  font-weight: 600;
  margin-right: 4px;
}

.hud-telemetry {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.system-status-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(4, 8, 16, 0.8);
  border: 1px solid var(--cyan-border);
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  color: var(--cyan-bright);
  box-shadow: inset 0 0 8px rgba(0, 240, 255, 0.08);
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--cyan-bright);
  box-shadow: 0 0 10px var(--cyan-bright);
  animation: pulse-hud-dot 2s infinite ease-in-out;
}

@keyframes pulse-hud-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 14px var(--cyan-bright); }
}

.hud-sub-metric {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-dim {
  color: var(--text-muted);
}

.metric-highlight {
  color: var(--purple-bright);
  font-weight: 600;
}

/* ==========================================================================
   Creation Panel
   ========================================================================== */

.creation-panel {
  margin-bottom: 22px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.creation-panel:focus-within {
  border-color: var(--cyan-bright);
  box-shadow: 0 0 20px var(--cyan-dim), inset 0 0 12px var(--cyan-dim);
}

#task-form {
  display: flex;
  gap: 10px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0 16px;
  gap: 12px;
  transition: border-color 0.2s;
}

.input-prefix {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan-bright);
  user-select: none;
  white-space: nowrap;
}

#task-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 13px 0;
  letter-spacing: 0.5px;
}

#task-input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Cyberpunk Buttons
   ========================================================================== */

.cyber-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-hud);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  padding: 12px 22px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
}

.cyber-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Create Button */
.cyber-btn-primary {
  background: rgba(0, 240, 255, 0.08);
  border-color: var(--cyan-bright);
  color: var(--cyan-bright);
  box-shadow: 0 0 12px var(--cyan-dim);
}

.cyber-btn-primary:hover:not(:disabled) {
  background: var(--cyan-bright);
  color: #030509;
  box-shadow: 0 0 20px var(--cyan-glow);
  transform: translateY(-1px);
}

.cyber-btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

/* Action Buttons inside Task Cards */
.btn-action {
  font-size: 12px;
  letter-spacing: 1px;
  padding: 10px 18px;
  font-family: var(--font-hud);
  font-weight: 700;
  border-radius: var(--radius-xs);
  min-height: 42px;
}

.btn-start, .btn-resume {
  background: rgba(0, 240, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.5);
  color: var(--cyan-bright);
}

.btn-start:hover, .btn-resume:hover {
  background: rgba(0, 240, 255, 0.18);
  border-color: var(--cyan-bright);
  box-shadow: 0 0 16px var(--cyan-glow);
  transform: translateY(-1px);
}

.btn-start:active, .btn-resume:active {
  transform: translateY(1px);
}

.btn-pause {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.55);
  color: var(--purple-bright);
}

.btn-pause:hover {
  background: rgba(168, 85, 247, 0.22);
  border-color: var(--purple-bright);
  box-shadow: 0 0 16px var(--purple-glow);
  transform: translateY(-1px);
}

.btn-pause:active {
  transform: translateY(1px);
}

.btn-reset {
  background: rgba(148, 163, 184, 0.05);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-secondary);
}

.btn-reset:hover {
  background: rgba(148, 163, 184, 0.15);
  border-color: #fff;
  color: #fff;
  transform: translateY(-1px);
}

.btn-delete {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  padding: 10px 14px;
  min-height: 42px;
}

.btn-delete:hover {
  color: var(--accent-red);
  background: var(--red-dim);
  border-color: rgba(244, 63, 94, 0.4);
}

/* ==========================================================================
   Task Meta & Telemetry Bar
   ========================================================================== */

.task-meta-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.meta-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.cyan-dot {
  background: var(--cyan-bright);
  box-shadow: 0 0 6px var(--cyan-bright);
}

.active-dot {
  background: var(--purple-bright);
  box-shadow: 0 0 6px var(--purple-bright);
}

.meta-label {
  color: var(--text-muted);
}

.meta-value {
  color: var(--text-secondary);
  font-weight: 700;
}

.cyan-text {
  color: var(--cyan-bright);
}

/* ==========================================================================
   Task Cards Container & HUD Cards
   ========================================================================== */

.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Single Task HUD Card */
.task-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
  transition: all 0.22s ease-in-out;
  position: relative;
  overflow: hidden;
}

.task-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Active Running HUD State */
.task-card.is-running {
  border-left-color: var(--cyan-bright);
  border-top-color: rgba(0, 240, 255, 0.28);
  border-right-color: rgba(0, 240, 255, 0.2);
  border-bottom-color: rgba(0, 240, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.08), inset 0 0 20px rgba(0, 240, 255, 0.02);
}

/* Paused HUD State */
.task-card.is-paused {
  border-left-color: var(--purple-bright);
  border-top-color: rgba(168, 85, 247, 0.25);
  border-right-color: rgba(168, 85, 247, 0.15);
  border-bottom-color: rgba(168, 85, 247, 0.15);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.06);
}

/* Left: Task Info Block */
.task-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.task-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-status-pill {
  font-family: var(--font-hud);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.task-status-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.task-card.is-running .task-status-pill {
  color: var(--cyan-bright);
  background: var(--cyan-dim);
  border-color: rgba(0, 240, 255, 0.35);
}

.task-card.is-running .task-status-indicator {
  background: var(--cyan-bright);
  box-shadow: 0 0 8px var(--cyan-bright);
  animation: pulse-hud-dot 1.8s infinite ease-in-out;
}

.task-card.is-paused .task-status-pill {
  color: var(--purple-bright);
  background: var(--purple-dim);
  border-color: rgba(168, 85, 247, 0.35);
}

.task-card.is-paused .task-status-indicator {
  background: var(--purple-bright);
  box-shadow: 0 0 6px var(--purple-bright);
}

.task-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Center: Large Futuristic Digital Stopwatch Readout */
.task-time-display {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  font-family: var(--font-mono);
  user-select: none;
  background: rgba(4, 7, 13, 0.85);
  padding: 8px 18px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
  position: relative;
}

.task-card.is-running .task-time-display {
  border-color: rgba(0, 240, 255, 0.3);
  background: rgba(0, 240, 255, 0.03);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.08), inset 0 0 10px rgba(0, 240, 255, 0.03);
}

.time-digits {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.task-card.is-running .time-digits {
  color: #f0fdfa;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
}

.task-card.is-paused .time-digits {
  color: #faf5ff;
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.time-fraction {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}

.task-card.is-running .time-fraction {
  color: var(--cyan-bright);
}

/* Right: Stopwatch Controls */
.task-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  border: 1px dashed rgba(0, 240, 255, 0.15);
  margin-top: 10px;
}

.empty-state.visible {
  display: flex;
}

.empty-icon-frame {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-xs);
  background: var(--purple-dim);
  margin-bottom: 16px;
}

.empty-icon {
  font-size: 26px;
  color: var(--purple-bright);
}

.empty-title {
  font-family: var(--font-hud);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-desc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  max-width: 400px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.cyber-footer {
  margin-top: auto;
  padding-top: 40px;
  text-align: center;
}

.footer-telemetry {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ==========================================================================
   Responsive Mobile Optimization (HUD Touch Controls & Adaptability)
   ========================================================================== */

@media (max-width: 768px) {
  .app-container {
    padding: 16px 12px 32px;
  }

  .cyber-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 14px;
  }

  .logo-title {
    font-size: 22px;
    letter-spacing: 3.5px;
  }

  .hud-telemetry {
    width: 100%;
    justify-content: space-between;
  }

  .creation-panel {
    padding: 6px;
  }

  #task-form {
    flex-direction: column;
  }

  .input-wrapper {
    padding: 0 12px;
  }

  #task-input {
    font-size: 14px;
    padding: 12px 0;
  }

  .cyber-btn-primary {
    width: 100%;
    min-height: 48px;
  }

  .task-meta-bar {
    justify-content: space-between;
    margin-bottom: 12px;
  }

  /* Single Column Card on Mobile */
  .task-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px 14px;
  }

  .task-name {
    font-size: 18px;
  }

  /* Stopwatch digits fluid responsive scale */
  .task-time-display {
    justify-content: center;
    padding: 12px 14px;
    width: 100%;
  }

  .time-digits {
    font-size: clamp(22px, 6.8vw, 32px);
    letter-spacing: 1.2px;
  }

  .time-fraction {
    font-size: clamp(13px, 4vw, 16px);
  }

  /* Mobile Touch-Friendly Controls Grid */
  .task-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .task-controls .cyber-btn {
    flex: 1 1 calc(50% - 6px);
    min-height: 46px;
    font-size: 12px;
    padding: 10px;
    text-align: center;
  }

  .btn-delete {
    flex: 1 1 100% !important;
    min-height: 40px;
  }
}

/* Very narrow devices (e.g. 320px - 360px) */
@media (max-width: 380px) {
  .logo-title {
    font-size: 19px;
    letter-spacing: 2px;
  }

  .time-digits {
    font-size: clamp(19px, 6vw, 24px);
    letter-spacing: 0.8px;
  }

  .task-controls .cyber-btn {
    flex: 1 1 100%;
  }
}
