/* ==========================================================================
   TO-DO WEB APP - DESIGN SYSTEM & STYLES (STRICTLY NO GRADIENTS, NO EMOJIS)
   ========================================================================== */

/* 1. CSS VARIABLES (SOLID COLORS ONLY) */
:root {
  --bg-app: #0b0d14;
  --bg-surface: #141724;
  --bg-surface-hover: #1b1f30;
  --bg-card: #191c2c;
  --bg-card-inner: #21263c;
  --bg-input: #10131f;

  --border-subtle: #242a40;
  --border-active: #3b82f6;
  --border-focus: #60a5fa;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Solid Brand Accents */
  --accent-blue: #3b82f6;
  --accent-blue-dark: #1d4ed8;
  --accent-green: #10b981;
  --accent-green-dark: #047857;
  --accent-yellow: #f59e0b;
  --accent-yellow-dark: #b45309;
  --accent-red: #ef4444;
  --accent-red-dark: #b91c1c;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-teal: #14b8a6;

  /* Priority Solid Colors */
  --priority-high-bg: #451a1d;
  --priority-high-text: #fca5a5;
  --priority-high-border: #ef4444;

  --priority-med-bg: #3c2a14;
  --priority-med-text: #fde047;
  --priority-med-border: #f59e0b;

  --priority-low-bg: #153326;
  --priority-low-text: #6ee7b7;
  --priority-low-border: #10b981;

  --shadow-3d: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 14px 0 rgba(0, 0, 0, 0.35);

  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

/* 2. BASE RESET & GLOBAL LAYOUT */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient 3D Animated Background Shapes */
.ambient-3d-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  perspective: 1000px;
  overflow: hidden;
}

.cube-3d {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 2px solid var(--border-subtle);
  transform-style: preserve-3d;
  opacity: 0.15;
}

.cube-1 {
  top: 10%;
  left: 5%;
  background-color: #1e293b;
  animation: rotate3dCube 24s infinite linear;
}

.cube-2 {
  bottom: 15%;
  right: 8%;
  width: 180px;
  height: 180px;
  background-color: #1e1b4b;
  animation: rotate3dCubeReverse 32s infinite linear;
}

.cube-3 {
  top: 50%;
  right: 25%;
  width: 80px;
  height: 80px;
  background-color: #064e3b;
  animation: rotate3dCube 18s infinite linear;
}

@keyframes rotate3dCube {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateZ(0); }
  50% { transform: rotateX(180deg) rotateY(270deg) rotateZ(90deg) translateZ(50px); }
  100% { transform: rotateX(360deg) rotateY(540deg) rotateZ(360deg) translateZ(0); }
}

@keyframes rotate3dCubeReverse {
  0% { transform: rotateX(360deg) rotateY(360deg) translateZ(0); }
  100% { transform: rotateX(0deg) rotateY(0deg) translateZ(-80px); }
}

/* App Viewport Container */
.app-viewport {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 3. PERSPECTIVE SYSTEM */
/* .3d-perspective {
  perspective: 1200px;
} */

.js-tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

.js-tilt-card:hover {
  border-color: var(--border-active);
}

/* 4. HEADER BANNER STYLING */
.app-header {
  perspective: 1000px;
}

.header-content {
  background-color: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-3d);
}

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

.task-badge {
  display: inline-block;
  align-self: flex-start;
  background-color: var(--accent-red);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-red-dark);
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  background-color: var(--accent-blue);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 var(--accent-blue-dark);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.header-right {
  max-width: 520px;
}

.header-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* 5. 3D DASHBOARD STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  cursor: default;
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.blue-theme { background-color: #1e3a8a; color: #60a5fa; border: 1px solid #2563eb; }
.yellow-theme { background-color: #451a03; color: #fbbf24; border: 1px solid #d97706; }
.green-theme { background-color: #064e3b; color: #34d399; border: 1px solid #059669; }
.red-theme { background-color: #451215; color: #f87171; border: 1px solid #dc2626; }

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* 6. MAIN WORKSPACE GRID LAYOUT */
.workspace-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

/* Panel Card Base */
.panel-card {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-3d);
}

.panel-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-blue);
}

.panel-title-wrap h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* 7. FORM STYLING & INPUT CONTROLS */
.task-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

/* Color picker styling for dark date/time inputs */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

/* 8. 3D BUTTONS SYSTEM */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.2s ease;
  user-select: none;
  text-decoration: none;
}

.btn-3d {
  position: relative;
  top: 0;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--accent-blue-dark);
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-primary:active {
  top: 3px;
  box-shadow: 0 1px 0 var(--accent-blue-dark);
}

.btn-secondary {
  background-color: var(--bg-card-inner);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 0 #151928;
}

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

.btn-secondary:active {
  top: 3px;
  box-shadow: 0 1px 0 #151928;
}

.btn-danger {
  background-color: var(--accent-red);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--accent-red-dark);
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-danger:active {
  top: 3px;
  box-shadow: 0 1px 0 var(--accent-red-dark);
}

/* 9. RIGHT PANEL: TOOLBAR & FILTERS */
.list-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 520px;
}

.controls-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  padding-left: 42px;
  padding-right: 36px;
  height: 44px;
  font-size: 14px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
}

.btn-clear-search:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.select-wrapper {
  flex: 1;
  min-width: 160px;
}

.select-wrapper select {
  height: 38px;
  padding: 6px 12px;
  font-size: 13px;
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
  scrollbar-width: thin;
}

.tab-btn {
  background-color: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.tab-btn.active {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
  font-weight: 700;
}

/* 10. TASK LIST & CARDS (3D ANIMATIONS) */
.task-list-container {
  min-height: 340px;
  position: relative;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transform-style: preserve-3d;
  transition: transform 0.2s ease, border-color 0.2s ease, opacity 0.3s ease, background-color 0.2s ease;
  animation: slideIn3D 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn3D {
  0% {
    opacity: 0;
    transform: perspective(1000px) rotateX(-15deg) translateY(-20px) translateZ(-50px);
  }
  100% {
    opacity: 1;
    transform: perspective(1000px) rotateX(0deg) translateY(0) translateZ(0);
  }
}

.task-item.exit-anim {
  animation: fadeOut3D 0.3s ease forwards;
}

@keyframes fadeOut3D {
  0% {
    opacity: 1;
    transform: perspective(1000px) rotateX(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: perspective(1000px) rotateX(20deg) scale(0.9) translateY(20px);
  }
}

.task-item:hover {
  border-color: var(--border-active);
  background-color: var(--bg-surface-hover);
  transform: perspective(1000px) translateZ(10px);
}

.task-item.completed {
  opacity: 0.65;
  background-color: #121420;
  border-color: #1a1e2e;
}

/* Custom Checkbox */
.checkbox-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.custom-checkmark {
  width: 22px;
  height: 22px;
  background-color: var(--bg-input);
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .custom-checkmark {
  border-color: var(--accent-blue);
}

.checkbox-container input:checked ~ .custom-checkmark {
  background-color: var(--accent-green);
  border-color: var(--accent-green-dark);
  color: #ffffff;
}

.custom-checkmark svg {
  display: none;
}

.checkbox-container input:checked ~ .custom-checkmark svg {
  display: block;
}

/* Task Content */
.task-content-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.task-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-category {
  background-color: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}

.badge-category[data-cat="Work"] { background-color: #1e3a8a; color: #93c5fd; border-color: #2563eb; }
.badge-category[data-cat="Personal"] { background-color: #4c1d95; color: #ddd6fe; border-color: #7c3aed; }
.badge-category[data-cat="Shopping"] { background-color: #831843; color: #fbcfe8; border-color: #db2777; }
.badge-category[data-cat="Urgent"] { background-color: #451215; color: #fca5a5; border-color: #ef4444; }
.badge-category[data-cat="Projects"] { background-color: #134e4a; color: #99f6e4; border-color: #0d9488; }
.badge-category[data-cat="Health"] { background-color: #064e3b; color: #a7f3d0; border-color: #059669; }

.badge-priority-High {
  background-color: var(--priority-high-bg);
  color: var(--priority-high-text);
  border: 1px solid var(--priority-high-border);
}

.badge-priority-Medium {
  background-color: var(--priority-med-bg);
  color: var(--priority-med-text);
  border: 1px solid var(--priority-med-border);
}

.badge-priority-Low {
  background-color: var(--priority-low-bg);
  color: var(--priority-low-text);
  border: 1px solid var(--priority-low-border);
}

.task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

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

.task-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.task-footer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.due-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.due-badge.overdue {
  color: var(--accent-red);
  font-weight: 700;
}

.due-badge.due-today {
  color: var(--accent-yellow);
  font-weight: 700;
}

/* Task Actions (Buttons) */
.task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.btn-icon.btn-delete:hover {
  background-color: var(--accent-red);
  color: #ffffff;
  border-color: var(--accent-red);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background-color: var(--bg-card);
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 10px;
}

.empty-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--bg-card-inner);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.empty-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
}

/* 11. 3D MODAL OVERLAY */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 13, 20, 0.85);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  perspective: 1000px;
  transition: opacity 0.3s ease;
}

.3d-modal-card{
  background-color: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  animation: popIn3D 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn3D {
  0% {
    opacity: 0;
    transform: perspective(1000px) rotateX(-20deg) scale(0.8) translateY(30px);
  }
  100% {
    opacity: 1;
    transform: perspective(1000px) rotateX(0deg) scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-blue);
}

.modal-title-wrap h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

/* 12. UTILITY CLASSES */
.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
