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

:root {
  /* Color Palette - Modern Dark Slate & Neon Accents */
  --bg-primary: #080c14;
  --bg-secondary: #0f1420;
  --bg-card: rgba(18, 25, 41, 0.65);
  --bg-card-hover: rgba(24, 34, 56, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Status Colors */
  --color-todo: #3b82f6;
  --color-todo-bg: rgba(59, 130, 246, 0.1);
  --color-todo-border: rgba(59, 130, 246, 0.2);

  --color-in-progress: #f59e0b;
  --color-in-progress-bg: rgba(245, 158, 11, 0.1);
  --color-in-progress-border: rgba(245, 158, 11, 0.2);

  --color-review: #a855f7;
  --color-review-bg: rgba(168, 85, 247, 0.1);
  --color-review-border: rgba(168, 85, 247, 0.2);

  --color-done: #10b981;
  --color-done-bg: rgba(16, 185, 129, 0.1);
  --color-done-border: rgba(16, 185, 129, 0.2);

  /* Priority Colors */
  --priority-low: #06b6d4;
  --priority-low-bg: rgba(6, 182, 212, 0.12);
  --priority-medium: #f97316;
  --priority-medium-bg: rgba(249, 115, 22, 0.12);
  --priority-high: #ef4444;
  --priority-high-bg: rgba(239, 68, 68, 0.12);

  /* Fonts */
  --font-display: 'Outfit', 'Inter', 'Sarabun', sans-serif;
  --font-body: 'Sarabun', 'Inter', sans-serif;

  /* Layout */
  --max-width: 1400px;
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Typography Utilities */
h1, h2, h3, h4, .amount-label, .stat-value {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Glassmorphism Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 12, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-todo), var(--color-review));
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: white;
  box-shadow: var(--shadow-glow);
}

.brand-name {
  font-size: 1.4rem;
  color: var(--text-primary);
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* User Switcher */
.user-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.role-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.25rem 0.75rem;
  transition: all 0.3s ease;
}

.role-selector-wrapper:hover {
  border-color: var(--border-color-hover);
  background: rgba(255, 255, 255, 0.08);
}

.role-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-right: 0.5rem;
}

.role-select {
  background: transparent;
  color: var(--text-primary);
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 2rem 0.5rem 0.5rem;
  outline: none;
  cursor: pointer;
  appearance: none;
}

.role-selector-wrapper::after {
  content: '▾';
  position: absolute;
  right: 1rem;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Main Layout */
main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
  display: block;
}

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

/* Dashboard Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--theme-color, var(--color-todo));
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
}

.stat-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2.2rem;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card.todo { --theme-color: var(--color-todo); }
.stat-card.in-progress { --theme-color: var(--color-in-progress); }
.stat-card.review { --theme-color: var(--color-review); }
.stat-card.done { --theme-color: var(--color-done); }
.stat-card.total { --theme-color: #8892b0; }
.stat-card.overdue { --theme-color: var(--priority-high); }

/* Grid Dashboard Sections */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.15rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* User Progress / Workload Listing */
.workload-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.workload-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.workload-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: white;
}

.workload-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.workload-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.workload-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.workload-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(to right, var(--color-todo), var(--color-done));
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.workload-stats {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.workload-count {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
}

/* Tab Navigation */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  padding-bottom: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--color-todo);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-todo);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out forwards;
}

/* Pie Chart (Conic-Gradient Doughnut Chart) */
.pie-chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1rem 0;
  min-height: 200px;
}

@media (max-width: 500px) {
  .pie-chart-wrapper {
    flex-direction: column;
    gap: 1.5rem;
  }
}

.pie-chart {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: background 0.5s ease;
  flex-shrink: 0;
}

.pie-chart-center {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 2;
}

.pie-chart-center-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: 1.1;
}

.pie-chart-center-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.pie-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  color: var(--text-secondary);
  flex-grow: 1;
}

.legend-value {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.6rem 1.2rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-todo);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: #2563eb;
  border-color: transparent;
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.25);
}

/* Master Table / Task Grid (Supervisor view) */
.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 400px;
  min-width: 250px;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-md);
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  font-family: var(--font-body);
  outline: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--color-todo);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.9rem;
}

.filters-wrapper {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-md);
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-select:hover {
  background: rgba(255, 255, 255, 0.06);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.task-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.task-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.task-table tr:last-child td {
  border-bottom: none;
}

.task-table tr {
  transition: background 0.2s ease;
}

.task-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges for status, priority */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-todo { background: var(--color-todo-bg); color: var(--color-todo); border: 1px solid var(--color-todo-border); }
.badge-in-progress { background: var(--color-in-progress-bg); color: var(--color-in-progress); border: 1px solid var(--color-in-progress-border); }
.badge-review { background: var(--color-review-bg); color: var(--color-review); border: 1px solid var(--color-review-border); }
.badge-done { background: var(--color-done-bg); color: var(--color-done); border: 1px solid var(--color-done-border); }

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

/* Deadline label */
.deadline-text {
  font-family: var(--font-display);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.deadline-text.overdue {
  color: var(--priority-high);
  font-weight: 600;
}

.deadline-text.soon {
  color: var(--priority-medium);
  font-weight: 600;
}

/* Kanban Board Styles (Team member view) */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  align-items: start;
  min-height: 550px;
}

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

@media (max-width: 600px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.kanban-column {
  background: rgba(15, 20, 32, 0.45);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem 1rem;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.kanban-column.drag-over {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow-glow);
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0 0.25rem;
}

.column-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.column-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--indicator-color);
}

.column-count {
  font-family: var(--font-display);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  color: var(--text-secondary);
}

.todo-col { --indicator-color: var(--color-todo); }
.in-progress-col { --indicator-color: var(--color-in-progress); }
.review-col { --indicator-color: var(--color-review); }
.done-col { --indicator-color: var(--color-done); }

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  flex: 1;
  min-height: 400px;
}

/* Kanban Cards styling */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.2s ease, 
              box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

.task-card:active {
  cursor: grabbing;
}

.task-card.dragging {
  opacity: 0.4;
  transform: scale(0.96);
  border-style: dashed;
  border-color: var(--color-todo);
}

.card-priority-bar {
  height: 4px;
  width: 40px;
  border-radius: 2px;
  background: var(--priority-color, var(--priority-low));
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.6rem;
  margin-top: 0.25rem;
}

.card-date {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-display);
}

/* HTML5 Dialog (Modal) Styles */
dialog {
  margin: auto;
  background: rgba(15, 20, 32, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--border-radius-lg);
  padding: 0;
  color: var(--text-primary);
  max-width: 550px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
  outline: none;
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdropFadeIn 0.3s ease forwards;
}

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

dialog[open] {
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
}

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

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Forms in Dialog */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-md);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--color-todo);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Task Detail Specific Modal Layout */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.detail-value {
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.detail-desc-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.875rem;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  white-space: pre-line;
}

/* Activity Log / Comments Section */
.comments-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.comments-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.comment-item {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-sm);
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.comment-author {
  font-weight: 600;
  color: var(--color-todo);
}

.comment-time {
  color: var(--text-muted);
  font-family: var(--font-display);
}

.comment-text {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.comment-form {
  display: flex;
  gap: 0.5rem;
}

.comment-input {
  flex: 1;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
}

/* Footer styling */
footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(8, 12, 20, 0.5);
}

/* ==================== MOBILE RESPONSIVE MEDIA QUERIES ==================== */

@media (max-width: 768px) {
  /* Main Container spacing */
  main {
    padding: 1rem;
  }

  /* Stats Grid (2 columns on mobile instead of 1 or 6) */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }
  
  .stat-value {
    font-size: 1.75rem;
  }

  /* All Tasks Filter controls stacking */
  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .search-input-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .filters-wrapper {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .filter-select {
    width: 100%;
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
    text-align: center;
  }

  /* Responsive Table to Cards Transformation */
  .task-table, 
  .task-table thead, 
  .task-table tbody, 
  .task-table th, 
  .task-table td, 
  .task-table tr {
    display: block;
  }
  
  .task-table thead {
    display: none; /* Hide header row on mobile */
  }
  
  .task-table tr {
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.75rem;
    position: relative;
  }
  
  .task-table td {
    border-bottom: none;
    padding: 0.35rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
  }
  
  .task-table td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    display: inline-block;
  }
  
  /* Task Title Row style */
  .task-table td:first-child {
    display: block;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .task-table td:first-child::before {
    content: ""; /* No prefix for the title row */
  }

  /* Task Action Row style */
  .task-table td:last-child {
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
  }
  
  .task-table td:last-child::before {
    content: ""; /* No prefix for action buttons */
  }
  
  .task-table td:last-child .btn {
    width: 100%;
    justify-content: center;
    padding: 0.5rem;
  }
}

@media (max-width: 600px) {
  /* Header stacking */
  header {
    padding: 0.75rem 1rem;
  }
  
  .header-container {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .brand {
    justify-content: center;
  }
  
  .user-controls {
    width: 100%;
  }
  
  .role-selector-wrapper {
    width: 100%;
    justify-content: space-between;
  }
  
  .role-select {
    flex-grow: 1;
    text-align: right;
  }

  /* Segmented tabs for mobile */
  .tabs-nav {
    width: 100%;
    margin-bottom: 1rem;
  }
  
  .tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.65rem 0.5rem;
    font-size: 0.82rem;
  }

  /* Kanban mobile layout */
  .kanban-board {
    gap: 1rem;
  }

  .kanban-column {
    min-height: 120px; /* Let empty columns collapse on mobile */
    padding: 1rem 0.75rem;
    border-radius: var(--border-radius-md);
  }
  
  .kanban-cards {
    min-height: auto;
  }

  /* Dialogs full screen support on mobile */
  dialog {
    max-width: 100%;
    width: calc(100% - 1rem);
    margin-bottom: 0.5rem;
  }
  
  .modal-header {
    padding: 1rem 1.25rem;
  }
  
  .modal-body {
    padding: 1rem 1.25rem;
  }

  .detail-grid {
    grid-template-columns: 1fr; /* Single column layout inside modal */
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .modal-footer {
    padding: 0.75rem 1.25rem;
    flex-direction: column-reverse; /* Stack button vertically */
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}
