@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #90A4AE;
  --secondary: #B0BEC5;
  --accent: #CFD8DC;
  --light: #ECEFF1;
  --bg: #546E7A;
  --white: #FFFFFF;
  --card-bg: #FFFFFF;
  --text: #263238;
  --text-secondary: #607D8B;
  --border: #CFD8DC;
  --critical: #D32F2F;
  --critical-bg: #FFEBEE;
  --critical-border: #EF9A9A;
  --high: #EF6C00;
  --high-bg: #FFF3E0;
  --high-border: #FFCC80;
  --medium: #F9A825;
  --medium-bg: #FFFDE7;
  --medium-border: #FFF59D;
  --low: #2E7D32;
  --low-bg: #E8F5E9;
  --low-border: #A5D6A7;
  --shadow-sm: 0 1px 3px rgba(55, 71, 79, 0.08);
  --shadow-md: 0 4px 12px rgba(55, 71, 79, 0.1);
  --shadow-lg: 0 8px 30px rgba(55, 71, 79, 0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

::selection {
  background: var(--secondary);
  color: var(--white);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.app-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.bug-count {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  background: var(--white);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--accent);
}

.btn-danger {
  background: var(--white);
  color: var(--critical);
  border: 1px solid var(--critical-border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: var(--critical-bg);
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--accent);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--primary);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--white);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--accent);
}

.filter-chip.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.chip-count {
  font-size: 0.7rem;
  opacity: 0.7;
}

.filter-chip.chip-critical.active {
  background: var(--critical);
  border-color: var(--critical);
}

.filter-chip.chip-high.active {
  background: var(--high);
  border-color: var(--high);
}

.filter-chip.chip-medium.active {
  background: var(--medium);
  border-color: var(--medium);
  color: var(--text);
}

.filter-chip.chip-low.active {
  background: var(--low);
  border-color: var(--low);
}

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-height: 60vh;
}

.kanban-column {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 300px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kanban-column.column-drag-over {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(84, 110, 122, 0.15);
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.column-emoji {
  font-size: 1.1rem;
}

.column-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
}

.column-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.column-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.empty-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  opacity: 0.5;
}

.empty-icon {
  font-size: 2rem;
}

.empty-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Bug Cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bug-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  transition: all 0.2s ease;
  animation: fadeInUp 0.35s ease both;
  border-left: 3px solid var(--border);
}

.bug-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.bug-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.bug-card.severity-critical {
  border-left-color: var(--critical);
}

.bug-card.severity-high {
  border-left-color: var(--high);
}

.bug-card.severity-medium {
  border-left-color: var(--medium);
}

.bug-card.severity-low {
  border-left-color: var(--low);
}

.card-top {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.severity-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-critical {
  background: var(--critical-bg);
  color: var(--critical);
}

.badge-high {
  background: var(--high-bg);
  color: var(--high);
}

.badge-medium {
  background: var(--medium-bg);
  color: #F57F17;
}

.badge-low {
  background: var(--low-bg);
  color: var(--low);
}

.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-time {
  font-size: 0.7rem;
  color: var(--light);
}

.card-attachment {
  font-size: 0.85rem;
}

/* Skeleton */
.skeleton-card {
  height: 90px;
  background: linear-gradient(90deg, var(--bg) 25%, #e0e4e7 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(38, 50, 56, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Bug Form */
.bug-form {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: all 0.2s ease;
  resize: vertical;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(84, 110, 122, 0.12);
}

.severity-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.severity-option {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.severity-option:hover {
  border-color: var(--accent);
}

.severity-option.selected.opt-critical {
  background: var(--critical-bg);
  border-color: var(--critical);
  color: var(--critical);
}

.severity-option.selected.opt-high {
  background: var(--high-bg);
  border-color: var(--high);
  color: var(--high);
}

.severity-option.selected.opt-medium {
  background: var(--medium-bg);
  border-color: var(--medium);
  color: #F57F17;
}

.severity-option.selected.opt-low {
  background: var(--low-bg);
  border-color: var(--low);
  color: var(--low);
}

/* Upload */
.upload-area {
  position: relative;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.upload-label:hover {
  border-color: var(--secondary);
  background: var(--bg);
}

.screenshot-preview {
  position: relative;
  margin-top: 10px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.screenshot-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.btn-remove-img {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(38, 50, 56, 0.7);
  color: var(--white);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Bug Detail */
.detail-modal {
  max-width: 620px;
}

.detail-header-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.detail-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-status-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--white);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.status-pill:hover {
  border-color: var(--secondary);
}

.status-pill.active-status {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.detail-steps {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  background: var(--bg);
  padding: 14px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  border: 1px solid var(--border);
}

.detail-screenshot {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.detail-screenshot img {
  width: 100%;
  display: block;
  max-height: 400px;
  object-fit: contain;
  background: var(--bg);
}

.detail-meta {
  font-size: 0.78rem;
  color: var(--light);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.detail-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .app-title {
    font-size: 1.4rem;
  }

  .kanban-board {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kanban-column {
    min-height: 200px;
  }

  .modal-content {
    max-height: 95vh;
    border-radius: var(--radius-md);
  }

  .severity-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .status-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .detail-actions {
    flex-direction: column-reverse;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions button,
  .detail-actions button {
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to your Bug Tracker! This is a kanban board to organize and track bugs through their lifecycle — from new reports to closed issues.", "view": "user", "highlight_selector": ".app-header", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Click 'Report Bug' to file a new bug. Fill in the title, description, severity, steps to reproduce, and optionally attach a screenshot.", "view": "user", "highlight_selector": ".btn-primary", "wait_for": "user_interaction"},
  {"step": 3, "narration": "Set the severity level — critical, high, medium, or low — to prioritize bugs effectively.", "view": "user", "highlight_selector": ".severity-selector", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "Your bugs appear in four columns: New, Investigating, Fixed, and Closed. Drag and drop cards between columns to update their status.", "view": "user", "highlight_selector": ".kanban-board", "wait_for": "tap_to_continue"},
  {"step": 5, "narration": "Use the severity filter chips to quickly find critical or high-priority bugs that need attention.", "view": "user", "highlight_selector": ".filter-chips", "wait_for": "tap_to_continue"},
  {"step": 6, "narration": "Click any bug card to see its full details, change its status, edit it, or delete it.", "view": "user", "highlight_selector": ".bug-card", "wait_for": "user_interaction"}
]
-->

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  text-align: center;
}

.auth-badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--secondary);
  font-size: 0.8rem;
  font-weight: 600;
}

.auth-card h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.auth-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 22px;
}

.auth-button {
  width: 100%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.author-info-group {
  gap: 8px;
}

.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 700;
}

.author-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.author-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.author-email {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.author-empty {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.rich-editor {
  border: 1px solid var(--border-color, #d9d9df);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-bg, #fff);
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border-color, #d9d9df);
  background: var(--surface-2, #f7f7fb);
}

.rich-tool-button {
  border: 1px solid var(--border-color, #d9d9df);
  background: white;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.rich-editor-content {
  min-height: 180px;
  padding: 12px;
  outline: none;
}

.rich-editor-content:empty:before {
  content: 'Describe the bug...';
  color: var(--muted-text, #7a7a87);
}

.rich-content {
  line-height: 1.6;
}

.rich-content ul,
.rich-content ol {
  padding-left: 24px;
}

.rich-content a {
  color: var(--link-color, #2563eb);
  text-decoration: underline;
}

.empty-rich-text {
  color: var(--muted-text, #7a7a87);
  font-style: italic;
}

.bug-viewers {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bug-viewers-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 10px;
}

.bug-viewers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bug-viewer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.bug-viewer-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.bug-viewer-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.bug-viewer-name {
  font-size: 13px;
}

.bug-viewers-empty {
  font-size: 13px;
  opacity: 0.7;
}

.kanban-board-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kanban-board-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.kanban-board-toolbar-spacer {
  flex: 1;
}
