/* ROCKS Dashboard — Mobile-First Dark Theme */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22252f;
  --border: #2a2d3a;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --text-dim: #52525b;
  --accent: #6366f1;
  --today-color: #ef4444;
  --week-color: #6366f1;
  --later-color: #8b5cf6;
  --waiting-color: #f97316;
  --done-color: #22c55e;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-date {
  font-size: 13px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.done-today {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
}

.refresh-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}
.refresh-btn:active { color: var(--accent); }
.refresh-btn.spinning { animation: spin 0.6s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Alert bar */
.alert-bar {
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 13px;
  color: var(--red);
  display: none;
}
.alert-bar.visible { display: block; }

/* AI Response Panel */
.ai-panel {
  display: none;
  margin: 8px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
}
.ai-panel.visible { display: block; }

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.1);
}

.ai-panel-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  -webkit-tap-highlight-color: transparent;
}

.ai-panel-body {
  padding: 12px;
}

.ai-response-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ai-files-changed {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Board layout */
.board {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 640px) {
  .board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
  }
}

@media (min-width: 1024px) {
  .board {
    grid-template-columns: 1fr 1fr 1fr 0.85fr;
    padding: 16px;
  }
}

/* Columns */
.column {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}

@media (min-width: 640px) {
  .column { margin-bottom: 0; }
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.column-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.column[data-column="today"] .column-title { color: var(--today-color); }
.column[data-column="this_week"] .column-title { color: var(--week-color); }
.column[data-column="later"] .column-title { color: var(--later-color); }
.column[data-column="waiting_on"] .column-title { color: var(--waiting-color); }
.column-done .column-title { color: var(--done-color); }

.column-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.column-chevron {
  color: var(--text-muted);
  font-size: 14px;
  transition: transform 0.2s ease;
}
.column.collapsed .column-chevron { transform: rotate(-90deg); }

.column-body {
  padding: 0 8px 8px;
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.column.collapsed .column-body {
  max-height: 0;
  padding: 0 8px;
}

/* Task cards */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border-left: 3px solid transparent;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.task-card:active { background: var(--surface-hover); }

.task-card.completing {
  opacity: 0;
  transform: translateX(40px);
}

.task-card.error-flash {
  background: rgba(239, 68, 68, 0.15);
}

.column[data-column="waiting_on"] .task-card {
  border-left-color: var(--waiting-color);
}

.task-card.overdue {
  border-left-color: var(--red);
  background: rgba(239, 68, 68, 0.05);
}

.task-card.stale-amber {
  border-left-color: var(--amber);
}

/* Done cards */
.done-card {
  opacity: 0.7;
}
.done-card:active { background: var(--bg); }

/* Checkbox */
.checkbox {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 1px;
  -webkit-tap-highlight-color: transparent;
}

.checkbox:active {
  transform: scale(0.9);
}

.checkbox.checked {
  background: var(--green);
  border-color: var(--green);
}

.checkbox.checked::after {
  content: '\2713';
  color: white;
  font-size: 14px;
  font-weight: 700;
}

/* Task text */
.task-content {
  flex: 1;
  min-width: 0;
}

.task-text {
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  cursor: pointer;
}

.task-text.completed {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-due {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.badge-overdue {
  background: rgba(239, 68, 68, 0.25);
  color: var(--red);
  font-weight: 700;
}

.badge-waiting {
  background: rgba(249, 115, 22, 0.15);
  color: var(--waiting-color);
}

.badge-followup {
  background: rgba(249, 115, 22, 0.15);
  color: var(--waiting-color);
}

.task-sub-items {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 4px;
  line-height: 1.5;
}

/* Capture panel */
.capture-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  z-index: 100;
}

.capture-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
}
.capture-input::placeholder { color: var(--text-dim); }
.capture-input:focus { border-color: var(--accent); }

.capture-btn {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn-send {
  background: var(--accent);
  color: white;
  padding: 10px 18px;
}
.btn-send:active { opacity: 0.8; }
.btn-send.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Bottom sheets */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sheet-overlay.visible { display: block; opacity: 1; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.sheet-overlay.visible .sheet { transform: translateY(0); }

.sheet-title {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 12px;
}

.sheet-task-name {
  font-size: 15px;
  text-align: center;
  margin-bottom: 16px;
  padding: 0 16px;
  line-height: 1.4;
}

.sheet-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sheet-option {
  padding: 14px 16px;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sheet-option:active { background: var(--surface-hover); }
.sheet-option .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.sheet-option[data-target="today"] .dot { background: var(--today-color); }
.sheet-option[data-target="this_week"] .dot { background: var(--week-color); }
.sheet-option[data-target="later"] .dot { background: var(--later-color); }
.sheet-option[data-target="waiting_on"] .dot { background: var(--waiting-color); }

.sheet-option.edit-option {
  color: var(--accent);
  margin-top: 6px;
}

.sheet-option.delete-option {
  color: var(--red);
}

.sheet-cancel {
  padding: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
  width: 100%;
  cursor: pointer;
  margin-top: 8px;
  -webkit-tap-highlight-color: transparent;
}

/* Edit modal */
.edit-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  -webkit-appearance: none;
  margin-bottom: 12px;
}
.edit-textarea:focus { border-color: var(--accent); }

.edit-actions {
  display: flex;
  gap: 8px;
}

.edit-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.edit-save {
  background: var(--accent);
  color: white;
}
.edit-save:active { opacity: 0.8; }

.edit-cancel {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Undo toast */
.undo-toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom) + 8px);
  left: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 150;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.undo-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.undo-toast span {
  font-size: 14px;
}

.undo-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}

/* Toast */
.toast {
  position: fixed;
  top: calc(60px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  pointer-events: none;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}
.toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Loading state */
.loading-indicator {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-indicator::before {
  content: '\25CC';
  display: block;
  font-size: 24px;
  margin-bottom: 8px;
  animation: pulse 1.5s ease infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }
