/* ==========================================================================
   Swipe Page - Mobile-First Task Cards
   ========================================================================== */

.swipe-page {
  max-width: 520px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
}

/* Filter Bar */
.swipe-filter-bar {
  margin-bottom: 0.75rem;
}

.swipe-filter-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: var(--bg, #fff);
  color: var(--fg, #1a1a1a);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

/* Card Area */
.swipe-card-area {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Navigation row: arrows + dots together below card */
.swipe-nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0.6rem 0 0.4rem;
}

/* Arrow Buttons - compact circles in nav row */
.swipe-arrow {
  width: 32px;
  height: 32px;
  border: 1px solid #e0e0e0;
  border-radius: 50%;
  background: var(--bg, #fff);
  color: var(--fg-dim, #888);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.swipe-arrow:hover:not(:disabled) {
  background: var(--bg-muted, #f8f9fa);
  color: var(--fg, #1a1a1a);
  border-color: #ccc;
}

.swipe-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

/* Card Container */
.swipe-card-container {
  overflow: hidden;
  position: relative;
}

/* Card */
.swipe-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 0;
  background: var(--bg, #fff);
  will-change: transform, opacity;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: grab;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.swipe-card.swiping {
  transition: none;
  cursor: grabbing;
}

.swipe-card.exiting {
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

.swipe-card.entering {
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

.swipe-card-empty {
  text-align: center;
  color: var(--fg-dim, #666);
  padding: 3rem 1rem;
  font-style: italic;
}

/* Status accent bar at top of card */
.swipe-card-accent {
  height: 2px;
  width: 100%;
}
.swipe-card-accent.in-progress { background: linear-gradient(90deg, #d4a600, #e8c547); }
.swipe-card-accent.done { background: linear-gradient(90deg, #16a085, #2ecc71); }
.swipe-card-accent.todo { background: #ddd; }
.swipe-card-accent.backlog { background: #eee; }

/* Card inner content */
.swipe-card-inner {
  padding: 1rem 1.25rem 1.25rem;
}

/* Card Header: status + identifier + position */
.swipe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
}

.swipe-card-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.swipe-card-status .state {
  font-size: 13px;
}

.swipe-card-status .state.done { color: #16a085; }
.swipe-card-status .state.in-progress { color: #d4a600; }
.swipe-card-status .state.todo { color: #999; }
.swipe-card-status .state.backlog { color: #ccc; }

.swipe-card-identifier {
  color: var(--fg-dim, #888);
  font-size: 12px;
}

.swipe-card-position {
  color: var(--fg-dim, #999);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

/* Card Title */
.swipe-card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  color: var(--fg, #1a1a1a);
  word-break: break-word;
  letter-spacing: -0.01em;
}

.swipe-card-title.done {
  text-decoration: line-through;
  opacity: 0.5;
}

/* Card Meta */
.swipe-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 13px;
  color: var(--fg-dim, #666);
  padding-bottom: 0.25rem;
}

.swipe-card-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.swipe-card-meta-label {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--fg-dim, #999);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 56px;
}

.swipe-card-meta-value {
  color: var(--fg, #333);
  font-size: 13px;
}

/* Priority Dots */
.priority-dots {
  letter-spacing: 1px;
}

.priority-dots .filled { color: var(--fg, #1a1a1a); }
.priority-dots .empty { color: #ddd; }

/* Label Tags */
.swipe-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.swipe-label-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  color: var(--fg-dim, #666);
  background: var(--bg-muted, #f8f9fa);
}

/* Blocking Relationship Rows */
.swipe-meta-blocks {
  border: 1px solid #e74c3c;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  margin-top: 0.15rem;
}
.swipe-meta-blocks .swipe-card-meta-label { color: #c0392b; }
.swipe-meta-blocks .swipe-card-meta-value { color: #c0392b; }

.swipe-meta-blocked {
  background: var(--bg-muted, #f5f5f5);
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  margin-top: 0.15rem;
}
.swipe-meta-blocked .swipe-card-meta-label { color: var(--fg-dim, #999); }

.swipe-blocking-issue {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: inherit;
  text-decoration: none;
}

a.swipe-blocking-issue {
  border-bottom: 1px dotted currentColor;
  cursor: pointer;
  transition: opacity 0.15s;
}

a.swipe-blocking-issue:hover {
  opacity: 0.7;
}

/* Parent/Subtask Relationship Rows */
.swipe-meta-parent {
  background: var(--bg-muted, #f5f5f5);
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  margin-top: 0.15rem;
}
.swipe-meta-parent .swipe-card-meta-label { color: var(--fg-dim, #999); }

.swipe-meta-subtasks {
  background: var(--bg-muted, #f5f5f5);
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  margin-top: 0.15rem;
}
.swipe-meta-subtasks .swipe-card-meta-label { color: var(--fg-dim, #999); }
.swipe-meta-subtasks .swipe-card-meta-value { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.5rem; }

.swipe-relation-issue {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: inherit;
  text-decoration: none;
}

a.swipe-relation-issue {
  border-bottom: 1px dotted currentColor;
  cursor: pointer;
  transition: opacity 0.15s;
}

a.swipe-relation-issue:hover {
  opacity: 0.7;
}

.swipe-relation-done { color: #16a085; }
.swipe-relation-in-progress { color: #d4a600; }
.swipe-relation-todo { color: #999; }
.swipe-relation-backlog { color: #ccc; }

/* Expandable Accordion Sections */
.swipe-card-accordion {
  margin-top: 0.25rem;
  border-top: 1px solid #f0f0f0;
}

.swipe-card-accordion:first-of-type {
  margin-top: 0.5rem;
}

.swipe-accordion-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0;
  cursor: pointer;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--fg-dim, #aaa);
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.15s;
}

.swipe-accordion-header:hover {
  color: var(--fg, #1a1a1a);
}

.swipe-accordion-toggle {
  font-size: 9px;
  transition: transform 0.2s;
}

.swipe-accordion-header.open .swipe-accordion-toggle {
  transform: rotate(90deg);
}

.swipe-accordion-body {
  display: none;
  padding: 0.5rem 0 0.75rem;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg, #1a1a1a);
  overflow-wrap: break-word;
  word-break: break-word;
}

.swipe-accordion-body.open {
  display: block;
}

/* Markdown content in accordion */
.swipe-accordion-body p { margin: 0 0 0.5rem; }
.swipe-accordion-body ul,
.swipe-accordion-body ol { margin: 0 0 0.5rem; padding-left: 1.5rem; }
.swipe-accordion-body code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  background: var(--bg-muted, #f8f9fa);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}
.swipe-accordion-body pre {
  background: var(--bg-muted, #f8f9fa);
  padding: 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0 0 0.5rem;
}
.swipe-accordion-body pre code {
  background: none;
  padding: 0;
}
.swipe-accordion-body img {
  max-width: 100%;
  height: auto;
}

/* Comments */
.swipe-comments-loading {
  color: var(--fg-dim, #666);
  font-style: italic;
  padding: 0.5rem 0;
}

.swipe-comment {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.swipe-comment:last-child {
  border-bottom: none;
}

.swipe-comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-dim, #666);
  margin-bottom: 0.3rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.swipe-comment-body {
  font-size: 14px;
  line-height: 1.5;
}

/* Counter - dot indicators */
.swipe-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  color: var(--fg-dim, #999);
}

.swipe-counter-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.swipe-counter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ddd;
  transition: background 0.2s, transform 0.2s;
}

.swipe-counter-dot.active {
  background: #666;
  transform: scale(1.3);
}

/* Linear Link */
.swipe-card-link {
  display: block;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid #f0f0f0;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.swipe-card-link a {
  color: var(--fg-dim, #aaa);
  text-decoration: none;
  transition: color 0.15s;
}

.swipe-card-link a:hover {
  color: #2563eb;
}

/* ==========================================================================
   Prompt Section
   ========================================================================== */

.swipe-prompts {
  margin-top: 0.25rem;
}

/* Prompt Buttons - compact centered row */
.swipe-prompt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.75rem;
  justify-content: center;
}

.swipe-prompt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  min-height: 36px;
  border: 1px solid #e0e0e0;
  border-radius: 18px;
  background: var(--bg, #fff);
  color: var(--fg-dim, #555);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.swipe-prompt-btn:hover {
  background: var(--bg-muted, #f8f9fa);
  border-color: #ccc;
  color: var(--fg, #1a1a1a);
}

.swipe-prompt-btn:active {
  background: #f0f0f0;
}

.swipe-prompt-btn.active {
  border-color: #2563eb;
  background: #eff4ff;
  color: #2563eb;
}

.swipe-prompt-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.swipe-prompt-btn.ai-btn {
  border-color: #e8d48a;
  color: #8a6d00;
  background: linear-gradient(135deg, #fffdf5, #fff8e1);
}

.swipe-prompt-btn.ai-btn:hover {
  background: linear-gradient(135deg, #fffbeb, #fff3cd);
  border-color: #d4a600;
}

.swipe-prompt-btn.ai-btn.active {
  border-color: #d4a600;
  background: linear-gradient(135deg, #fff8e1, #fff3cd);
  color: #6b5600;
}

.swipe-prompt-btn-more {
  font-size: 11px;
  color: var(--fg-dim, #999);
  border-style: dashed;
}

.swipe-prompt-btn.custom-prompt-btn {
  border-style: dashed;
}

/* More prompts (hidden by default) */
.swipe-more-prompts {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.75rem;
  justify-content: center;
}

.swipe-more-prompts.visible {
  display: flex;
}

/* Prompt Result */
.swipe-prompt-result {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.swipe-prompt-result.hidden {
  display: none;
}

.swipe-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-muted, #f8f9fa);
  border-bottom: 1px solid #eee;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
}

.swipe-prompt-name {
  color: var(--fg-dim, #666);
  font-weight: 600;
}

.swipe-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.swipe-prompt-actions button {
  padding: 0.2rem 0.45rem;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: var(--bg, #fff);
  color: var(--fg-dim, #666);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.swipe-prompt-actions button:hover {
  background: var(--bg-muted, #f8f9fa);
}

.swipe-prompt-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

.swipe-prompt-text {
  padding: 0.75rem;
  font-size: 13px;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  color: var(--fg, #1a1a1a);
}

/* Streaming fade-in for the container */
@keyframes promptFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.swipe-prompt-result.streaming {
  animation: promptFadeIn 0.3s ease-out both;
}

/* Per-element fade-in during streaming — new blocks materialise smoothly */
@keyframes streamIn {
  from { opacity: 0; filter: blur(2px); transform: translateY(4px); }
  to   { opacity: 1; filter: blur(0);   transform: translateY(0); }
}

.swipe-prompt-text .stream-in {
  animation: streamIn 0.35s ease-out both;
}

/* Subtle indicator on the element currently being written to */
.swipe-prompt-result.streaming .swipe-prompt-text .stream-cursor {
  border-left: 2px solid rgba(0,0,0,0.12);
  padding-left: 0.5rem;
  transition: border-color 0.3s;
}

/* Bottom gradient mask during streaming — text appears to materialise */
.swipe-prompt-result.streaming .swipe-prompt-text {
  mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
}

.swipe-prompt-text p { margin: 0 0 0.5rem; }
.swipe-prompt-text ul,
.swipe-prompt-text ol { margin: 0 0 0.5rem; padding-left: 1.5rem; }
.swipe-prompt-text code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  background: var(--bg-muted, #f8f9fa);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}
.swipe-prompt-text pre {
  background: var(--bg-muted, #f8f9fa);
  padding: 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
}
.swipe-prompt-text pre code {
  background: none;
  padding: 0;
}

/* Copy feedback */
.swipe-prompt-copy.copied {
  color: #16a085;
  border-color: #16a085;
}


/* Reasoning toggle */
.swipe-reasoning-toggle {
  padding: 0.4rem 0.75rem;
  font-size: 11px;
  color: var(--fg-dim, #666);
  cursor: pointer;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  border-bottom: 1px solid #eee;
  user-select: none;
}
.swipe-reasoning-toggle:hover {
  color: var(--fg, #1a1a1a);
}

/* Reasoning content (collapsible) */
.swipe-reasoning-content {
  padding: 0.5rem 0.75rem;
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-dim, #888);
  border-bottom: 1px solid #eee;
  max-height: 300px;
  overflow-y: auto;
}
.swipe-reasoning-content.hidden { display: none; }
.swipe-reasoning-toggle.hidden { display: none; }
.swipe-reasoning-content p { margin: 0 0 0.4rem; }
.swipe-reasoning-content ul,
.swipe-reasoning-content ol { margin: 0 0 0.4rem; padding-left: 1.5rem; }
.swipe-reasoning-content code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  background: var(--bg-muted, #f8f9fa);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* ==========================================================================
   Responsive - Desktop
   ========================================================================== */

@media (min-width: 641px) {
  .swipe-page {
    padding: 1rem 2rem 3rem;
  }

  .swipe-card-inner {
    padding: 1.25rem 1.5rem 1.5rem;
  }

  .swipe-card-title {
    font-size: 22px;
  }
}

/* ==========================================================================
   Responsive - Small Phones
   ========================================================================== */

@media (max-width: 400px) {
  .swipe-page {
    padding: 0.5rem 0.75rem 1.5rem;
  }

  .swipe-card-inner {
    padding: 0.75rem 1rem 1rem;
  }

  .swipe-card-title {
    font-size: 18px;
  }

  .swipe-prompt-btn {
    padding: 0.4rem 0.6rem;
    font-size: 11px;
    min-height: 32px;
  }

  .swipe-arrow {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}
