/* ==========================================================================
   PTHN TEAM WORK PLAN - BRAND STYLES (RED & DEEP NAVY BLUE)
   ========================================================================== */

:root {
  /* Brand Color Tokens */
  --bg-dark: #0A111E;
  --bg-navy: #0F172A;
  --bg-card: #1E293B;
  --bg-card-hover: #334155;
  
  --brand-red: #DC2626;
  --brand-red-hover: #B91C1C;
  --brand-red-light: rgba(220, 38, 38, 0.15);
  
  --brand-navy: #1E3A8A;
  --brand-navy-accent: #3B82F6;
  
  --text-white: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dark: #0F172A;
  
  /* Status Colors */
  --status-todo-bg: #991B1B;
  --status-todo-border: #EF4444;
  --status-in-progress-bg: #1E40AF;
  --status-in-progress-border: #3B82F6;
  --status-completed-bg: #166534;
  --status-completed-border: #22C55E;

  --major-task-bg: linear-gradient(135deg, #7F1D1D 0%, #1E3A8A 100%);
  --major-task-border: #DC2626;
  
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --radius-lg: 14px;
  --radius-md: 8px;
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-white);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- UTILITIES & HELPER CLASSES --- */
.hidden { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-red) 0%, #B91C1C 100%);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  transform: translateY(-1px);
}

.btn-ai {
  background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}
.btn-ai:hover {
  background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-white);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-danger {
  background: #7F1D1D;
  color: #FCA5A5;
  border: 1px solid #991B1B;
}
.btn-danger:hover {
  background: #991B1B;
  color: #FFF;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 12px;
}
.btn-logout:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #EF4444;
}

.btn-block { width: 100%; }

/* --- AUTHENTICATION SCREEN --- */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at top right, rgba(220, 38, 38, 0.15), transparent 50%),
              radial-gradient(circle at bottom left, rgba(30, 58, 138, 0.3), transparent 50%),
              var(--bg-dark);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-badge {
  display: inline-block;
  background: var(--brand-red-light);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #FFF 0%, #CBD5E1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #CBD5E1;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  width: 100%;
  padding: 12px 42px 12px 14px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #FFF;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-with-icon input:focus {
  border-color: var(--brand-red);
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
}

.auth-footer {
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

/* --- APP LAYOUT HEADER --- */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-box {
  background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-navy) 100%);
  color: #FFF;
  font-weight: 900;
  font-size: 1.1rem;
  padding: 8px 12px;
  border-radius: 8px;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: #38BDF8;
  font-weight: 600;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* View Switcher */
.view-switcher {
  display: flex;
  background: rgba(2, 6, 23, 0.6);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.switch-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.switch-btn.active {
  background: var(--brand-navy-accent);
  color: #FFF;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.member-filter-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.member-filter-box select {
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid var(--border-color);
  color: #FFF;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-banner {
  background: linear-gradient(90deg, #1E3A8A 0%, #3B82F6 100%);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.btn-clear-filter {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #FFF;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

/* MAIN BODY AREA */
.app-main {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ==========================================================================
   VIEW 1: BẢNG THỜI GIAN (GANTT TABLE)
   ========================================================================== */
.gantt-container {
  display: flex;
  background: var(--bg-navy);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Sidebar Table Left */
.gantt-sidebar {
  width: 580px;
  min-width: 580px;
  border-right: 2px solid var(--border-color);
  background: #0D1527;
}

.gantt-sidebar-header {
  display: flex;
  align-items: center;
  background: #090F1D;
  border-bottom: 2px solid var(--border-color);
  padding: 12px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  height: 48px;
}

.col-name { flex: 2; padding-right: 10px; }
.col-assignee { width: 90px; text-align: center; }
.col-date { width: 95px; text-align: center; }
.col-status { width: 95px; text-align: center; }

.gantt-sidebar-rows {
  display: flex;
  flex-direction: column;
}

.gantt-row-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  height: 52px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}

.gantt-row-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* PROMINENT MAJOR TASK ROW */
.gantt-row-item.is-major {
  background: var(--major-task-bg);
  border-left: 4px solid var(--major-task-border);
  font-weight: 800;
  font-size: 0.95rem;
  color: #FFF;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}
.gantt-row-item.is-major:hover {
  filter: brightness(1.1);
}

.gantt-row-item.is-subtask {
  padding-left: 32px;
}

.assignee-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}
.status-pill.todo { background: var(--status-todo-bg); color: #FCA5A5; }
.status-pill.in_progress { background: var(--status-in-progress-bg); color: #93C5FD; }
.status-pill.completed { background: var(--status-completed-bg); color: #86EFAC; }

/* Timeline Visual Calendar Right */
.gantt-timeline-wrap {
  flex: 1;
  overflow-x: auto;
  background: #0A111E;
}

.gantt-timeline-header {
  display: flex;
  height: 48px;
  background: #090F1D;
  border-bottom: 2px solid var(--border-color);
}

.gantt-day-col {
  width: 44px;
  min-width: 44px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.gantt-day-col.is-today {
  background: rgba(220, 38, 38, 0.2);
  color: #EF4444;
  font-weight: 800;
}
.gantt-day-col.is-weekend {
  background: rgba(255, 255, 255, 0.02);
}

.gantt-timeline-body {
  position: relative;
  display: flex;
  flex-direction: column;
}

.gantt-timeline-row {
  display: flex;
  height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  align-items: center;
}

/* DẢI MÀU CHẠY THEO NGÀY */
.gantt-bar-item {
  position: absolute;
  height: 30px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #FFF;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.gantt-bar-item:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.gantt-bar-item.major-bar {
  background: linear-gradient(90deg, #DC2626 0%, #1E3A8A 100%);
  border: 2px solid #F87171;
  height: 34px;
}

.gantt-bar-item.todo { background: linear-gradient(90deg, #991B1B 0%, #DC2626 100%); }
.gantt-bar-item.in_progress { background: linear-gradient(90deg, #1E40AF 0%, #3B82F6 100%); }
.gantt-bar-item.completed { background: linear-gradient(90deg, #166534 0%, #22C55E 100%); }


/* ==========================================================================
   VIEW 2: BẢNG CỘT KÉO-THẢ (KANBAN BOARD)
   ========================================================================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.kanban-column {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 600px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.kanban-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
}
.kanban-status-badge .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.badge-todo { color: #EF4444; }
.badge-todo .dot { background: #EF4444; }

.badge-in-progress { color: #60A5FA; }
.badge-in-progress .dot { background: #60A5FA; }

.badge-completed { color: #4ADE80; }
.badge-completed .dot { background: #4ADE80; }

.kanban-count {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-white);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

/* Kanban Cards */
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  transition: all 0.2s;
  position: relative;
}
.kanban-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: var(--shadow-lg);
}

.kanban-card.is-major-card {
  border-left: 4px solid var(--brand-red);
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
}

.kanban-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}


/* ==========================================================================
   MODAL WINDOWS & FLYOUTS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: #0F172A;
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-card.modal-lg { max-width: 720px; }

.modal-header {
  background: #090F1D;
  border-bottom: 1px solid var(--border-color);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.15rem; font-weight: 800; }

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.btn-close-modal:hover { color: #FFF; }

.modal-body { padding: 24px; }

#task-form { padding: 24px; }

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #CBD5E1;
}

.form-group input,
.form-group select {
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #FFF;
  font-size: 0.9rem;
  outline: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--brand-red);
}

.form-row {
  display: flex;
  gap: 16px;
}
.col-6 { flex: 1; }

.task-type-selector {
  display: flex;
  gap: 12px;
}

.radio-card {
  flex: 1;
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s;
}
.radio-card:hover { border-color: var(--brand-red); }
.radio-card input:checked ~ .radio-title { color: #EF4444; }

.radio-title { font-size: 0.85rem; font-weight: 700; }
.radio-desc { font-size: 0.72rem; color: var(--text-muted); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

/* AI SUGGESTION MODAL STYLES */
.ai-intro-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.input-with-button {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.input-with-button input {
  flex: 1;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #FFF;
  font-size: 0.95rem;
}

.ai-results-box {
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}
.ai-results-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #60A5FA;
  margin-bottom: 12px;
}

.ai-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.ai-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
}
.ai-task-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0F172A;
  border: 1px solid var(--brand-red);
  color: #FFF;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* RESPONSIVE DESIGN */
@media (max-width: 900px) {
  .app-header { flex-direction: column; align-items: stretch; }
  .header-controls { flex-direction: column; align-items: stretch; }
  .gantt-sidebar { width: 100%; min-width: unset; }
  .gantt-container { flex-direction: column; }
  .kanban-board { grid-template-columns: 1fr; }
}
