:root {
  --bg-core: #0b0b0b;
  --bg-panel: #141414;
  --bg-card: #1a1a1a;
  --bg-input: #000000;

  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #555555;

  --border-subtle: #333333;
  --border-focus: #555555;

  --accent-gold: #fcaf17;
  --accent-blue: #3498db;
  --accent-red: #e74c3c;
  --accent-green: #2ecc71;

  --prio-high: #e74c3c;
  --prio-med: #fcaf17;
  --prio-low: #3498db;

  --font-display: "Oswald", "Impact", "Arial Narrow", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;

  --spacing-unit: 4px;
  --radius-sm: 2px;
}

* {
  box-sizing: border-box;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-core);
  color: var(--text-primary);
  font-family: var(--font-body);
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  text-transform: uppercase;
  margin: 0;
  letter-spacing: 0.5px;
}
h1 {
  font-size: 1.8rem;
  font-style: italic;
}

.gta-header {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-core);
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 0;
}

header {
  padding: 16px 24px;
  background: var(--bg-core);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  flex-direction: column;
}
.sub-header {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}


.gta-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-right: 20px;
  padding-right: 20px;
  border-right: 1px solid var(--border-subtle);
  font-family: var(--font-display);
}
.clock-time {
  font-size: 1.4rem;
  color: #fff;
  line-height: 1;
  letter-spacing: 1px;
}
.clock-date {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

@media (max-width: 600px) {
  .gta-clock {
    display: none;
  }
}

.hud-stats {
  display: flex;
  gap: 20px;
}
.stat-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-right: 2px solid var(--accent-gold);
  padding-right: 10px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.dashboard {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.sidebar-overlay,
.mobile-stats-panel {
  display: none;
}

.filter-group h3 {
  font-size: 0.9rem;
  color: var(--accent-gold);
  margin-bottom: 12px;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
}

.filter-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.filter-btn:hover {
  background: #222;
  color: #fff;
}
.filter-btn.active {
  background: #222;
  color: #fff;
  border-left-color: var(--accent-gold);
}
.filter-count {
  float: right;
  font-size: 0.75rem;
  opacity: 0.6;
}

.main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
}

.quick-add-wrapper {
  background: var(--bg-card);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  align-items: center;
}
.input-group {
  flex: 1;
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}
.input-group:focus-within {
  border-color: var(--accent-gold);
}
.quick-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  padding: 12px 16px;
  font-size: 1rem;
}
.smart-tag {
  color: var(--accent-gold);
  font-size: 0.8rem;
  background: rgba(252, 175, 23, 0.1);
  padding: 2px 6px;
  margin-right: 8px;
  border-radius: 2px;
  white-space: nowrap;
}

.task-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  position: relative;
}

.group-header {
  display: flex;
  align-items: center;
  margin: 20px 0 10px 0;
  cursor: pointer;
  user-select: none;
}
.group-header h4 {
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.group-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  margin-left: 12px;
}

.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  user-select: none;
}
.task-item:hover {
  transform: translateY(-1px);
  border-color: #555;
}
.task-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}
.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-main {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  min-height: 50px;
}

.priority-strip {
  width: 4px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
}
.p-high {
  background: var(--prio-high);
}
.p-med {
  background: var(--prio-med);
}
.p-low {
  background: var(--prio-low);
}

.checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  margin-right: 16px;
  margin-left: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.checkbox:hover {
  border-color: var(--accent-gold);
}
.task-item.completed .checkbox {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
}
.checkbox svg {
  width: 14px;
  height: 14px;
  fill: #000;
  display: none;
}
.task-item.completed .checkbox svg {
  display: block;
}

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.task-title {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  width: 100%;
  font-family: var(--font-body);
  cursor: text;
}

.task-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  align-items: center;
}
.meta-tag {
  background: #333;
  padding: 1px 6px;
  border-radius: 2px;
  color: #ccc;
}
.meta-date {
  display: flex;
  align-items: center;
  gap: 4px;
}
.meta-date.overdue {
  color: var(--accent-red);
}

.task-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.task-item:hover .task-actions,
.task-item:focus-within .task-actions {
  opacity: 1;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 2px;
}
.icon-btn:hover {
  color: #fff;
  background: #333;
}
.icon-btn.danger:hover {
  color: var(--accent-red);
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--accent-gold);
  color: #fff;
  padding: 12px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 250px;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}
.overlay.active {
  display: flex;
}
.modal {
  background: var(--bg-card);
  width: 90%;
  max-width: 500px;
  padding: 24px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}
.modal-header {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 16px;
  border-bottom: 1px solid #333;
  padding-bottom: 8px;
  color: var(--accent-gold);
}

.form-row {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.form-input {
  width: 100%;
  background: #000;
  border: 1px solid #333;
  color: #fff;
  padding: 8px;
  font-family: var(--font-body);
}
.form-input:focus {
  border-color: var(--accent-gold);
}

.btn {
  background: #333;
  color: #fff;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: 0.2s;
  font-size: 0.9rem;
}
.btn:hover {
  background: #444;
}
.btn.primary {
  background: var(--accent-gold);
  color: #000;
  font-weight: bold;
}
.btn.primary:hover {
  background: #e59e15;
}

.focus-hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  display: none;
}
.focus-hud.active {
  display: flex;
}
.timer-display {
  font-family: var(--font-display);
  font-size: 8rem;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
}
.focus-task {
  font-size: 2rem;
  margin-bottom: 20px;
  color: #fff;
  text-align: center;
  max-width: 80%;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    position: fixed;
    left: -280px; /* Increased width slightly for better touch targets */
    top: 0;
    width: 280px;
    height: 100%;
    z-index: 1000; /* Higher than everything else */
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.8);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    transform: translateX(280px);
    left: -280px; /* Keep original position, transform moves it */
  }
  .sidebar-close-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: pointer;
    padding: 0;
  }
  .sidebar-close-btn:hover,
  .sidebar-close-btn:active {
    background: rgba(231, 76, 60, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
    transform: scale(1.05);
  }
  
  .mobile-stats-panel {
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border-subtle);
  }
  .mob-clock {
    text-align: right;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
  }
  #mobClockTime {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: #fff;
    line-height: 1;
  }
  #mobClockDate {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .mob-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .mob-stat-item {
    display: flex;
    flex-direction: column;
  }
  .mob-stat-item .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  .mob-stat-item .value {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--accent-gold);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 999; /* Just below sidebar */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .header-left h1 {
    font-size: 1.2rem;
  }
  .hud-stats {
    display: none;
  }
  .wanted-container {
    display: flex;
    margin-right: 8px;
    padding-right: 8px;
    border-right: none;
    flex-direction: row;
    align-items: center;
  }
  .wanted-star {
    font-size: 0.9rem;
  }
  .wanted-label {
    display: none;
  }
  header {
    padding: 12px 16px;
  }
  .gta-header {
    font-size: 1.1rem;
    margin-bottom: 2px;
  }
  .sub-header {
    font-size: 0.65rem;
  }
  .quick-add-wrapper {
    padding: 12px;
  }
  .filter-toggle {
    display: block !important;
  }
}
.filter-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  margin-right: 16px;
}
.shortcut-hint {
  font-size: 0.7rem;
  background: #333;
  padding: 2px 4px;
  border-radius: 2px;
  color: #aaa;
  margin-left: auto;
}

.help-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.9);
  width: 100%;
  padding: 10px;
  font-size: 0.8rem;
  border-top: 1px solid #333;
  transform: translateY(100%);
  transition: transform 0.3s;
  z-index: 90;
  display: flex;
  justify-content: space-around;
  color: #888;
}
.help-overlay.show {
  transform: translateY(0);
}
.key {
  color: var(--accent-gold);
  font-weight: bold;
}

.dev-glitch {
  font-family: "Courier New", Courier, monospace;
  color: var(--accent-green) !important;
  text-shadow: 0 0 5px var(--accent-green);
  letter-spacing: 2px;
  font-weight: bold;
}


.wanted-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 20px;
  padding-right: 20px;
  border-right: 1px solid var(--border-subtle);
}

.wanted-stars {
  display: flex;
  gap: 2px;
}

.wanted-star {
  font-size: 1.2rem;
  color: #333;
  text-shadow: 0 0 2px #000;
}

.wanted-star.active {
  color: #fff;
  text-shadow: 0 0 5px #fff;
  animation: starPulse 1s infinite alternate;
}

.wanted-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-top: 2px;
}

@keyframes starPulse {
  from { opacity: 0.8; }
  to { opacity: 1; text-shadow: 0 0 10px #fff; }
}


@keyframes police-chase {
  0% { box-shadow: inset 0 0 50px rgba(255, 0, 0, 0.5); border-color: red; }
  50% { box-shadow: inset 0 0 50px rgba(0, 0, 255, 0.5); border-color: blue; }
  100% { box-shadow: inset 0 0 50px rgba(255, 0, 0, 0.5); border-color: red; }
}

body.police-chase-mode {
  animation: police-chase 0.5s infinite;
  border: 5px solid red;
}

.busted-stamp {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg) scale(0);
  font-family: var(--font-display);
  font-size: 8rem;
  color: var(--accent-red);
  border: 10px solid var(--accent-red);
  padding: 20px 40px;
  text-transform: uppercase;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.police-chase-mode .busted-stamp {
  opacity: 0.8;
  transform: translate(-50%, -50%) rotate(-15deg) scale(1);
}

/* === SAFEHOUSE THEMES === */

/* Vinewood Hills (Luxury Purple/Gold) */
body.theme-vinewood {
  --bg-core: #1a0b1a;
  --bg-panel: #2d1b2d;
  --bg-card: #3d263d;
  --bg-input: #1a0b1a;
  --accent-gold: #d4af37;
  --border-subtle: #4a2c4a;
}

/* Sandy Shores (Desert Orange/Brown) */
body.theme-sandy {
  --bg-core: #1a1510;
  --bg-panel: #2b221a;
  --bg-card: #3d3024;
  --bg-input: #1a1510;
  --accent-gold: #e67e22;
  --border-subtle: #4d3b2d;
}

/* Maze Bank (Corporate Blue/Cyan) */
body.theme-maze {
  --bg-core: #0b1a26;
  --bg-panel: #152a3d;
  --bg-card: #1e3b52;
  --bg-input: #0b1a26;
  --accent-gold: #00d2d3;
  --border-subtle: #2c5370;
}

/* Groove Street (Classic Green) */
body.theme-groove {
  --bg-core: #0b1a0b;
  --bg-panel: #152b15;
  --bg-card: #1e3d1e;
  --bg-input: #0b1a0b;
  --accent-gold: #2ecc71;
  --border-subtle: #2c582c;
}

/* Too Easy Overlay */
#tooEasyOverlay {
    background: rgba(0, 0, 0, 0.4); /* Lighter backdrop */
    backdrop-filter: blur(2px);
}

.too-easy-content {
    text-align: center;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Popup Styles */
    background: var(--bg-card);
    border: 1px solid var(--accent-red);
    padding: 40px;
    box-shadow: 0 0 50px rgba(231, 76, 60, 0.2);
    position: relative;
    max-width: 500px;
    width: 90%;
}

.overlay.active .too-easy-content {
    transform: scale(1);
    opacity: 1;
}

.too-easy-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}
.too-easy-close:hover {
    color: #fff;
}

.too-easy-title {
    font-family: var(--font-display);
    font-size: 4rem; /* Slightly smaller for popup */
    color: var(--accent-red);
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
    margin-bottom: 0;
    line-height: 1;
}

.too-easy-subtitle {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.too-easy-desc {
    color: #aaa;
    font-size: 0.9rem;
    max-width: 300px;
    margin: 0 auto;
}
