:root {
  /* Color Palette - Premium Mini-CRM */
  --primary-color: #6f42c1;
  --primary-hover: #5a32a3;
  --secondary-color: #1e1e2d;
  --background-color: #f5f6fa;
  --surface-color: #ffffff;
  
  /* Text & Border */
  --text-primary: #333333;
  --text-secondary: #6c757d;
  --border-color: #e2e8f0;

  /* Semantic Status Colors */
  --status-success: #28a745;
  --status-success-bg: #e6f4ea;
  --status-warning: #ffc107;
  --status-warning-bg: #fff8e1;
  --status-danger: #dc3545;
  --status-danger-bg: #fce4e4;

  /* Typography */
  --font-family: 'Inter', sans-serif;
  
  /* Geometry & Shadows */
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --box-shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --box-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Single-Pane Layout */
.sidebar {
  width: 250px;
  background-color: var(--secondary-color);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.header {
  height: 60px;
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: var(--box-shadow-sm);
}

.content-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  position: relative;
}

/* List View & Side Panel */
.list-container {
  max-width: 1200px;
  margin: 0 auto;
}

.side-panel {
  position: absolute;
  top: 0;
  right: -50%; /* Hidden initially */
  width: 40%;
  height: 100%;
  background-color: var(--surface-color);
  box-shadow: -4px 0 15px rgba(0,0,0,0.1);
  transition: right 0.3s ease;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}

.side-panel.open {
  right: 0;
}

/* Basic utilities for UI elements */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
}

.badge-success { color: var(--status-success); background: var(--status-success-bg); }
.badge-warning { color: var(--status-warning); background: var(--status-warning-bg); }
.badge-danger { color: var(--status-danger); background: var(--status-danger-bg); }

/* Responsive adjustments */
@media (max-width: 992px) {
  .sidebar {
    width: 60px; /* Collapsed on mobile */
  }
  
  .side-panel {
    width: 100%;
    right: -100%;
  }
}

/* Data Grid Styles */
.table-container {
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background: var(--surface-color);
  box-shadow: var(--box-shadow-sm);
}

.data-grid {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-grid thead th {
  position: sticky;
  top: 0;
  background-color: var(--background-color);
  z-index: 10;
  padding: 15px;
  font-weight: 600;
  font-size: 0.85em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
}

.data-grid tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.data-grid tbody tr:hover {
  background-color: #f8f9fa;
}

.data-grid tbody td {
  padding: 12px 15px;
  vertical-align: middle;
}

/* Dirty State (Unsaved Changes) */
.dirty-row {
  background-color: #fff3cd !important; /* Vàng nhạt giống ảnh */
}

.dirty-row input, .dirty-row select {
  background-color: transparent;
}

/* Inline Inputs */
.grid-input, .grid-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color); /* Hiển thị rõ viền thay vì transparent */
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: 0.95em;
  color: var(--text-primary);
  background: var(--surface-color); /* Nền trắng thay vì trong suốt */
  transition: all 0.2s;
}

.grid-input:focus, .grid-select:focus {
  border-color: var(--primary-color);
  background: var(--surface-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.2);
}

.add-row {
  background-color: #f8f9fa;
}
.add-row .grid-input, .add-row .grid-select {
  border-color: var(--border-color);
  background: var(--surface-color);
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(0,0,0,0.05);
}

/* User Search Picker & Chips */
.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 20px;
}

.user-chip {
  background-color: #e9ecef;
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-color);
}

.user-chip .remove-chip {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1em;
  line-height: 1;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-chip .remove-chip:hover {
  background-color: #dee2e6;
  color: var(--status-danger);
}

.btn-picker {
  background: white;
  border: 1px dashed var(--border-color);
  color: var(--primary-color);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.btn-picker:hover {
  border-color: var(--primary-color);
  background: #f8f9fa;
}

/* Modal Base */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5); /* Semi-transparent background */
  backdrop-filter: blur(2px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--surface-color);
  border-radius: var(--border-radius-md);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.close-modal {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 300px;
  overflow-y: auto;
}

.picker-list-item {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
}

.picker-list-item:hover {
  background-color: #f8f9fa;
  border-color: var(--primary-color);
}

.picker-list-item .pi-name {
  font-weight: 500;
  color: var(--text-primary);
}

.picker-list-item .pi-email {
  font-size: 0.85em;
  color: var(--text-secondary);
}

.project-links-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

@media (max-width: 992px) {
  .project-links-grid {
    grid-template-columns: 1fr;
  }
}

.task-filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr; /* Search gets double space */
  gap: 10px;
  align-items: center;
}

@media (max-width: 992px) {
  .task-filters-grid {
    grid-template-columns: 1fr;
  }
}
