/* gamedevtracker/style.css — Game Dev Tracker app styles */
/* Shared base styles provided by /theme.css */

/* === PAGE-SPECIFIC OVERRIDES (status/priority colors) === */
:root {
  --primary: #7c3aed;
  --primary-dim: #5a3f96;
  --secondary: #4a9eff;
  --done: #44d97c;
  --in-progress: #f0a030;
  --blocked: #ef4444;
  --not-started: #6b6385;
  --high: #ef4444;
  --med: #f0a030;
  --low: #4a9eff;
  --radius: 8px;
  --radius-sm: 4px;
  --transition: 0.2s ease;
  --sidebar-w: 260px;
  --sidebar-bg: var(--surface);
  --card-bg: var(--surface2);
  --card-hover: var(--border);
  --text-dim: var(--text-secondary);
  --text-muted: var(--dim);
}

html, body {
  height: 100%;
  font-size: 14px;
  overflow: hidden;
}

/* === APP LAYOUT === */
.app-layout {
  display: flex;
  height: calc(100vh - 56px);
  margin-top: 56px;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.overall-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--done);
  white-space: nowrap;
  min-width: 30px;
}

.progress-bar-sm {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill-sm {
  height: 100%;
  background: var(--done);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.category-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}

.category-item:hover {
  background: rgba(124,58,237,0.08);
}

.category-item.active {
  background: rgba(124,58,237,0.12);
  border-left-color: var(--primary);
}

.category-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.category-info {
  flex: 1;
  min-width: 0;
}

.category-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-count {
  font-size: 11px;
  color: var(--dim);
  margin-top: 2px;
}

.category-progress {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.category-progress-fill {
  height: 100%;
  background: var(--done);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
  background: var(--surface2);
}

.btn:hover { background: var(--card-hover); }

.btn-icon {
  padding: 6px;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dim); }

.btn-secondary {
  background: var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover { background: var(--card-hover); color: var(--text); }

.btn-danger { color: var(--blocked); }
.btn-danger:hover { background: rgba(239,68,68,0.15); }

.btn-add-category {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  margin: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-add-category:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(124,58,237,0.08);
}

/* === MAIN CONTENT === */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* === CONTENT TOOLBAR (search + filters) === */
.content-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.content-toolbar[hidden] { display: none; }

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
  min-width: 180px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 7px 36px 7px 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
}

.search-box input:focus + .search-hint,
.search-box input:not(:placeholder-shown) + .search-hint {
  display: none;
}

.search-hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--border);
  color: var(--dim);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-family: monospace;
  pointer-events: none;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.filter-group select {
  padding: 6px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

.filter-group select:focus {
  border-color: var(--primary);
}

/* === CONTENT HEADER === */
.content-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.content-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.content-header .header-icon {
  font-size: 24px;
}

.content-header-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* === SUBCATEGORY === */
.subcategory {
  margin-bottom: 16px;
}

.subcategory-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.subcategory-header:hover {
  background: var(--card-hover);
}

.subcategory.collapsed .subcategory-header {
  border-radius: var(--radius);
}

.subcategory-arrow {
  transition: transform var(--transition);
  color: var(--dim);
  flex-shrink: 0;
}

.subcategory.collapsed .subcategory-arrow {
  transform: rotate(-90deg);
}

.subcategory-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.subcategory-stats {
  font-size: 12px;
  color: var(--dim);
  flex-shrink: 0;
}

.subcategory-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}

.subcategory-header:hover .subcategory-actions {
  opacity: 1;
}

.subcategory-actions .btn-icon {
  padding: 3px;
}

.subcategory-actions .btn-icon svg {
  width: 14px;
  height: 14px;
}

.subcategory-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.subcategory.collapsed .subcategory-body {
  display: none;
}

.add-subcategory-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 16px;
}

.add-subcategory-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* === EMPTY SUBCATEGORIES === */
.empty-subcategories {
  text-align: center;
  padding: 48px 24px;
  color: var(--dim);
}

.empty-subcategories p {
  margin-bottom: 16px;
  font-size: 14px;
}

.empty-subcategories .btn {
  gap: 6px;
}

/* === EMPTY ITEMS === */
.empty-items {
  padding: 12px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
}

/* === ITEM BLOCK (wrapper for parent + children) === */
.item-block {
  border-bottom: 1px solid var(--border);
}

.item-block:last-child {
  border-bottom: none;
}

/* === ITEM (parent row) === */
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  transition: background var(--transition);
}

.item:hover {
  background: rgba(124,58,237,0.05);
}

.item.done-item {
  opacity: 0.6;
}

.item-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  position: relative;
}

.item-checkbox:checked {
  background: var(--done);
  border-color: var(--done);
  animation: checkPop 0.3s ease;
}

.item-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.item-checkbox:hover {
  border-color: var(--primary);
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.item.done-item .item-name {
  text-decoration: line-through;
  color: var(--dim);
}

.item-description {
  font-size: 11px;
  color: var(--dim);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.child-progress {
  font-size: 11px;
  color: var(--done);
  font-weight: 600;
  margin-top: 2px;
}

.item-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-high { background: rgba(239,68,68,0.15); color: var(--high); }
.badge-med { background: rgba(240,160,48,0.15); color: var(--med); }
.badge-low { background: rgba(74,158,255,0.15); color: var(--low); }

.status-select {
  padding: 3px 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  outline: none;
}

.status-select.status-done { color: var(--done); border-color: rgba(68,217,124,0.3); }
.status-select.status-in_progress { color: var(--in-progress); border-color: rgba(240,160,48,0.3); }
.status-select.status-blocked { color: var(--blocked); border-color: rgba(239,68,68,0.3); }
.status-select.status-not_started { color: var(--not-started); }

.item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}

.item:hover .item-actions {
  opacity: 1;
}

.item-actions .btn-icon {
  padding: 3px;
}

.item-actions .btn-icon svg {
  width: 14px;
  height: 14px;
}

/* === CHILD ITEMS (sub-tasks) === */
.item-children {
  padding: 2px 12px 6px 40px;
  border-left: 2px solid var(--border);
  margin-left: 20px;
}

.child-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  transition: opacity var(--transition);
}

.child-item.child-done {
  opacity: 0.5;
}

.child-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  position: relative;
}

.child-checkbox:checked {
  background: var(--done);
  border-color: var(--done);
  animation: checkPop 0.3s ease;
}

.child-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 0px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.child-checkbox:hover {
  border-color: var(--primary);
}

.child-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
}

.child-item.child-done .child-name {
  text-decoration: line-through;
  color: var(--dim);
}

.child-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--blocked);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all var(--transition);
}

.child-item:hover .child-delete {
  opacity: 0.6;
}

.child-delete:hover {
  opacity: 1 !important;
  background: rgba(239,68,68,0.15);
}

.add-child-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-size: 11px;
  padding: 4px 0;
  margin-top: 2px;
  transition: color var(--transition);
}

.add-child-btn:hover {
  color: var(--primary);
}

.child-inline-input {
  width: 100%;
  padding: 4px 8px;
  margin-top: 2px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: inherit;
}

/* === CELEBRATION EFFECTS === */
@keyframes checkPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.confetti {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-burst 0.7s ease-out forwards;
}

@keyframes confetti-burst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

.item-complete-flash {
  animation: flash-complete 0.6s ease;
}

@keyframes flash-complete {
  0% { background: transparent; }
  30% { background: rgba(68,217,124,0.2); }
  100% { background: transparent; }
}

/* === SEARCH RESULTS === */
.search-results {
  padding: 0;
}

.search-results-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition: background var(--transition);
  cursor: pointer;
}

.search-result-item:hover {
  background: var(--card-hover);
}

.search-result-path {
  font-size: 11px;
  color: var(--dim);
}

.search-highlight {
  background: rgba(124,58,237,0.3);
  color: var(--text);
  border-radius: 2px;
  padding: 0 2px;
}

/* === FAB === */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  transition: all var(--transition);
  z-index: 50;
}

.fab:hover {
  background: var(--primary-dim);
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(124,58,237,0.5);
}

.fab.hidden {
  display: none;
}

/* === MODAL === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow-xl);
}

.modal-sm { max-width: 360px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  font-size: 20px;
  line-height: 1;
  color: var(--dim);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* === FORM === */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* === EMPTY STATE === */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--dim);
  font-size: 15px;
}

.empty-state[hidden] { display: none; }

/* === WELCOME STATE === */
.welcome-state {
  text-align: center;
  padding: 32px 24px;
  max-width: 520px;
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.welcome-state h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.welcome-state > p {
  color: var(--dim);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.welcome-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 28px;
}

.welcome-btn:hover {
  background: var(--primary-dim);
  transform: translateY(-1px);
}

.welcome-suggestions {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.suggestion-label {
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.suggestion-tag {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.suggestion-tag:hover {
  border-color: var(--primary);
  background: rgba(124,58,237,0.1);
  color: var(--primary);
  transform: translateY(-1px);
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 200px;
  }
  .filter-group { display: none; }
  .content { padding: 16px; }
  .item-badges { display: none; }
}

@media (max-width: 540px) {
  :root {
    --sidebar-w: 0px;
  }
  .sidebar { display: none; }
  .welcome-state { padding: 24px 12px; }
}
