@import url("animations.css");

:root {
  --green: #34c759;
  --amber: #ff9f0a;
  --red: #ff453a;
  --ios-blue: #0a84ff;
  --bg-dark: #0a0a0a;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-secondary: #8e8e93;
  --tile-size: 80px;
  --gap: 12px;
}

body {
  background: var(--bg-dark);
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Squircle cards */
.card {
  border-radius: 24px;
  background: var(--card-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--card-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s ease;
}

.card:active {
  transform: scale(0.96);
}

/* Status colors */
.status-green { color: var(--green); }
.status-amber { color: var(--amber); }
.status-red { color: var(--red); }
.status-blue { color: var(--ios-blue); }

/* Context % chip */
.context-chip {
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.context-chip::before {
  content: '<>';
  margin-right: 2px;
  font-size: 9px;
  opacity: 0.8;
}

.context-chip.green {
  background: linear-gradient(135deg, #34c759, #248a3d);
  color: white;
}

.context-chip.amber {
  background: linear-gradient(135deg, #ff9f0a, #b36f07);
  color: white;
}

.context-chip.red {
  background: linear-gradient(135deg, #ff453a, #b33028);
  color: white;
}

/* Status dot */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.green { background-color: var(--green); }
.status-dot.amber { background-color: var(--amber); }
.status-dot.grey { background-color: #48484a; }

.asterisk {
  animation: pulse 1s infinite;
  color: #ff9f0a;
}

/* Sessions Grid Layout */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), 1fr));
  gap: var(--gap);
  padding: 12px;
  padding-bottom: 120px;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Big Widget Tile (2x2) */
.tile.big {
  grid-column: span 2;
  grid-row: span 2;
  height: 170px;
  justify-content: space-between;
}

@media (max-width: 400px) {
  :root { --tile-size: 72px; --gap: 10px; }
}

.tile.big .session-name {
  font-size: 17px;
  font-weight: 700;
  margin-right: 20px;
  line-height: 1.2;
}

.tile.big .status-dot {
  position: absolute;
  top: 16px;
  right: 16px;
}

.tile.big .type-pill {
  position: absolute;
  top: 50px;
  left: 16px;
}

.tile.big .session-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 35px;
}

.tile.big .session-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}

.tile.big .context-chip {
  position: absolute;
  bottom: 16px;
  right: 16px;
}

/* Small App-Icon Tile (1x1) */
.tile.small {
  height: 80px;
  width: 80px;
  padding: 10px;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 18px; /* iOS icon radius */
}

.tile.small .session-name {
  font-size: 11px;
  font-weight: 600;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 8px;
}

.tile.small .status-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
}

.tile.small .type-icon {
  font-size: 24px;
  margin-top: 4px;
}

.tile.small .sprite {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  margin: 8px auto;
}
.tile.small .sprite svg {
  width: 100%;
  height: 100%;
  shape-rendering: crispEdges;
}

.sprite .frame { opacity: 0; }
.sprite-jules .f1 { animation: jules-f1-show 1.4s steps(1) infinite; }
.sprite-jules .f2 { animation: jules-f2-show 1.4s steps(1) infinite; }
.sprite-jules .f3 { animation: jules-f3-show 1.4s steps(1) infinite; }
.sprite-jules .f4 { animation: jules-f4-show 1.4s steps(1) infinite; }
.sprite-jules .f5 { animation: jules-f5-show 1.4s steps(1) infinite; }
.sprite-jules .f6 { animation: jules-f6-show 1.4s steps(1) infinite; }
.sprite-jules .f7 { animation: jules-f7-show 1.4s steps(1) infinite; }

.sprite-tmux .f1 { animation: tmux-f1-show 1.6s steps(1) infinite; }
.sprite-tmux .f2 { animation: tmux-f2-show 1.6s steps(1) infinite; }
.sprite-tmux .f3 { animation: tmux-f3-show 1.6s steps(1) infinite; }
.sprite-tmux .f4 { animation: tmux-f4-show 1.6s steps(1) infinite; }
.sprite-tmux .f5 { animation: tmux-f5-show 1.6s steps(1) infinite; }
.sprite-tmux .f6 { animation: tmux-f6-show 1.6s steps(1) infinite; }
.sprite-tmux .f7 { animation: tmux-f7-show 1.6s steps(1) infinite; }
.sprite-tmux .f8 { animation: tmux-f8-show 1.6s steps(1) infinite; }

.sprite-agy .f1 { animation: agy-f1-show 1.2s steps(1) infinite; }
.sprite-agy .f2 { animation: agy-f2-show 1.2s steps(1) infinite; }
.sprite-agy .f3 { animation: agy-f3-show 1.2s steps(1) infinite; }
.sprite-agy .f4 { animation: agy-f4-show 1.2s steps(1) infinite; }
.sprite-agy .f5 { animation: agy-f5-show 1.2s steps(1) infinite; }
.sprite-agy .f6 { animation: agy-f6-show 1.2s steps(1) infinite; }

.sprite-warm .f1 { animation: warm-f1-show 1.0s steps(1) infinite; }
.sprite-warm .f2 { animation: warm-f2-show 1.0s steps(1) infinite; }
.sprite-warm .f3 { animation: warm-f3-show 1.0s steps(1) infinite; }
.sprite-warm .f4 { animation: warm-f4-show 1.0s steps(1) infinite; }
.sprite-warm .f5 { animation: warm-f5-show 1.0s steps(1) infinite; }

.sprite-default .f1 { animation: def-f1-show 0.9s steps(1) infinite; }
.sprite-default .f2 { animation: def-f2-show 0.9s steps(1) infinite; }
.sprite-default .f3 { animation: def-f3-show 0.9s steps(1) infinite; }

/* Workers Page */
.workers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 16px;
  padding-bottom: 120px;
}

.worker-card {
  align-items: center;
  text-align: center;
  padding: 20px 10px;
}

.worker-character {
  width: 60px;
  height: 100px;
  margin-bottom: 12px;
}

.worker-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.capability-pill {
  font-size: 10px;
  background: rgba(10, 132, 255, 0.15);
  color: var(--ios-blue);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* Worker Activity Page */
.worker-activity-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 180px);
}

.activity-character {
  width: 120px;
  height: 200px;
  margin-bottom: 40px;
}

.activity-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Projects Page */
.projects-view {
  padding: 16px;
  padding-bottom: 120px;
}

.project-book-container {
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-book {
  perspective: 1000px;
  width: 180px; height: 240px;
  transform-style: preserve-3d;
}

.page {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0 12px 12px 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
  transform-origin: left center;
  animation: page-flip 8s linear infinite;
  box-shadow: -5px 0 15px rgba(0,0,0,0.5);
}

.page-1 { animation-delay: 0s; }
.page-2 { animation-delay: -2s; }
.page-3 { animation-delay: -4s; }
.page-4 { animation-delay: -6s; }

.projects-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.project-chip {
  flex: 1 1 calc(50% - 6px);
  padding: 16px;
}

.project-chip-name {
  font-weight: 700;
  font-size: 16px;
}

.project-chip-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Navigation & Headers */
.chat-header {
  display: flex;
  align-items: center;
  padding: 44px 16px 12px; /* Extra top padding for iOS notch */
  gap: 12px;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}

.back-btn {
  font-size: 28px;
  color: var(--ios-blue);
  line-height: 1;
}

.breadcrumb {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 83px;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-around;
  border-top: 0.5px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 20px;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8e8e93;
  font-size: 10px;
  text-decoration: none;
  width: 25%;
}

.nav-item.active {
  color: var(--ios-blue);
}

.nav-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

/* Chat Canvas (kept from v1) */
.chat-canvas {
  padding: 16px;
  padding-bottom: 140px;
}

.agent-msg {
  color: white;
  font-size: 17px;
  margin-bottom: 24px;
  line-height: 1.4;
}

.tool-cluster {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
  cursor: pointer;
}

.user-msg {
  background: var(--ios-blue);
  color: white;
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 17px;
  line-height: 1.4;
  margin-left: auto;
  max-width: 80%;
  margin-bottom: 24px;
}

/* Animation Classes for SVGs */
.worker-character .arm-left  { transform-origin: 30px 35px; animation: walk-arm-left  1s ease-in-out infinite; }
.worker-character .arm-right { transform-origin: 30px 35px; animation: walk-arm-right 1s ease-in-out infinite; }
.worker-character .leg-left  { transform-origin: 30px 60px; animation: walk-leg-left  1s ease-in-out infinite; }
.worker-character .leg-right { transform-origin: 30px 60px; animation: walk-leg-right 1s ease-in-out infinite; }

/* Activity specific SVG animations */
.activity-character.active-cycle {
  animation: activity-body 12s step-end infinite;
}

/* We use a different approach for activity cycle since step-end doesn't allow smooth transitions 
   but for this mock it's okay, or we could use nested animations.
*/


/* Emoji icons (replaced pixel sprites — Yahya 2026-05-25 "pixel idea sucks just use emojis") */
.tile.small .emoji-icon {
  font-size: 36px;
  line-height: 1;
  margin: 8px auto;
  text-align: center;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
