/* 
 * ProDocFlow - Sleek Glassmorphism Design System
 * Hỗ trợ Dual-Theme (Mặc định: Dark Mode, chuyển đổi sang Light Mode)
 * Thiết kế Responsive & In ấn chuyên nghiệp A4
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- HỆ THỐNG BIẾN TOÀN CỤC (DESIGN TOKENS) --- */
:root {
  --font-primary: 'Plus Jakarta Sans', sans-serif;
  
  /* Cấu hình màu Light Mode (Mặc định) */
  --bg-app: #f8fafc;
  --bg-sidebar: rgba(255, 255, 255, 0.75);
  --bg-card: rgba(255, 255, 255, 0.7);
  --border-color: rgba(0, 0, 0, 0.06);
  --border-focus: rgba(139, 92, 246, 0.6);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  /* Màu sắc chủ đạo và trạng thái */
  --color-primary: #8b5cf6; /* Electric Violet */
  --color-primary-glow: rgba(139, 92, 246, 0.08);
  --color-secondary: #06b6d4; /* Cyan */
  
  --color-success: #10b981; /* Emerald Green */
  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-warning: #f59e0b; /* Amber Yellow */
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-danger: #ef4444; /* Rose Red */
  --color-danger-bg: rgba(239, 68, 68, 0.1);
  --color-info: #3b82f6; /* Blue */
  --color-info-bg: rgba(59, 130, 246, 0.1);
  
  /* Hiệu ứng bóng */
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 30px -4px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px -6px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
  
  --glass-blur: 16px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cấu hình màu Dark Mode */
body.dark-mode {
  --bg-app: #09090b;
  --bg-sidebar: rgba(15, 15, 20, 0.7);
  --bg-card: rgba(22, 22, 28, 0.45);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.4);
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --color-primary-glow: rgba(139, 92, 246, 0.15);
  
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 30px -4px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px -6px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.25);
}

/* --- ĐỊNH DẠNG BAN ĐẦU (RESET & BASIS) --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Scrollbar đẹp mắt */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- SIDEBAR TRÁI (SIDEBAR) --- */
aside.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: background var(--transition-normal), border var(--transition-normal);
}

.sidebar-logo {
  padding: 30px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo i {
  font-size: 24px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px var(--color-primary-glow));
}

.sidebar-logo h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav.sidebar-menu {
  flex: 1;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.menu-item:hover {
  background: var(--color-primary-glow);
  color: var(--text-primary);
}

.menu-item.active {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
  font-weight: 600;
}

.menu-item i {
  font-size: 18px;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Nút đổi giao diện Dark/Light */
.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

/* --- KHU VỰC CHÍNH (MAIN CONTENT) --- */
main.main-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  margin-left: 280px;
  padding: 30px 40px;
  min-height: 100vh;
  position: relative;
}

/* --- THANH ĐẦU TRANG (HEADER BAR) --- */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.header-title h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-title p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

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

/* --- NÚT BẤM (BUTTONS) --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: #7c3aed;
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-color);
  border-color: var(--text-muted);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

/* --- THẺ THỐNG KÊ (STAT CARDS) --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 0;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
}

.stat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-icon.primary { background: var(--color-primary-glow); color: var(--color-primary); }
.stat-icon.secondary { background: rgba(6, 182, 212, 0.1); color: var(--color-secondary); }
.stat-icon.success { background: var(--color-success-bg); color: var(--color-success); }
.stat-icon.warning { background: var(--color-warning-bg); color: var(--color-warning); }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  z-index: 1;
}

.stat-desc {
  font-size: 12px;
  color: var(--text-muted);
  z-index: 1;
}

.stat-desc span {
  font-weight: 600;
}

.stat-desc span.success { color: var(--color-success); }
.stat-desc span.warning { color: var(--color-warning); }

/* --- KHU VỰC CHI TIẾT DỰ ÁN & BIỂU ĐỒ --- */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
  margin-bottom: 30px;
}

/* Thẻ chuẩn glass-panel */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-md);
  transition: border var(--transition-normal);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* Hàng bộ lọc dự án */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.search-input-container {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-input-container i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

.filter-selectors {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-chip {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.filter-chip.active {
  background: var(--color-primary-glow);
  color: var(--color-primary);
  border-color: var(--color-primary);
  font-weight: 600;
}

/* --- DANH SÁCH DỰ ÁN (PROJECT TABLES) --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.project-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.project-table th {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.project-table td {
  padding: 18px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

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

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

body.dark-mode .project-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Layout cột Dự án */
.project-info-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-title-name {
  font-weight: 600;
  color: var(--text-primary);
}

.project-client-name {
  font-size: 12px;
  color: var(--text-muted);
}

/* Huy hiệu (Badges) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-website { background: rgba(139, 92, 246, 0.08); color: #6d28d9; }
.badge-mkt { background: rgba(6, 182, 212, 0.08); color: #0891b2; }
.badge-seo { background: rgba(59, 130, 246, 0.08); color: #1d4ed8; }
.badge-social { background: rgba(236, 72, 153, 0.08); color: #be185d; }
.badge-other { background: rgba(113, 113, 122, 0.08); color: #4b5563; }

body.dark-mode .badge-website { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
body.dark-mode .badge-mkt { background: rgba(6, 182, 212, 0.12); color: #22d3ee; }
body.dark-mode .badge-seo { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
body.dark-mode .badge-social { background: rgba(236, 72, 153, 0.12); color: #f472b6; }
body.dark-mode .badge-other { background: rgba(113, 113, 122, 0.12); color: #d4d4d8; }

/* Trạng thái hợp đồng cứng */
.contract-status-btn {
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}

.hard-contract-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.hard-contract-badge.received {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.hard-contract-badge.missing {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.hard-contract-badge:hover {
  transform: scale(1.02);
}

/* Tiến trình thanh toán */
.payment-progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 140px;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

/* Cột hành động */
.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.action-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.action-btn.edit-btn:hover {
  color: var(--color-info);
  border-color: var(--color-info);
  background: rgba(59, 130, 246, 0.05);
}

.action-btn.delete-btn:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* Thống kê doanh thu góc phải */
.chart-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- TRÌNH XEM CHI TIẾT DỰ ÁN (PROJECT VIEW / TABS) --- */
.project-details-card {
  margin-top: 10px;
}

.back-to-list-btn {
  margin-bottom: 20px;
}

.project-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.details-section-title {
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 18px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.details-section-title i {
  color: var(--color-primary);
}

/* Danh sách hồ sơ dạng danh mục thẻ */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-item-card {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.doc-item-card:hover {
  border-color: var(--text-muted);
}

.doc-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.doc-type-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
}

.doc-type-icon.doc-has-file {
  background: var(--color-primary-glow);
  color: var(--color-primary);
}

.doc-item-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.doc-item-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.doc-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ĐỢT THANH TOÁN (PAYMENT PHASES IN DETAILED VIEW) */
.phases-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.phases-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border-color);
  z-index: 0;
}

.phase-node {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.phase-bullet {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 4px solid var(--bg-app);
  margin-left: 15px;
  margin-top: 6px;
  box-shadow: 0 0 0 3px var(--border-color);
  transition: all var(--transition-fast);
}

.phase-node.paid .phase-bullet {
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.phase-node.unpaid .phase-bullet {
  background: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.phase-card {
  flex: 1;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.phase-card:hover {
  border-color: var(--text-muted);
}

.phase-card-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.phase-card-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.phase-card-info .phase-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 4px;
}

.phase-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Nút chuyển đổi trạng thái thanh toán kiểu switch */
.status-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.status-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--text-muted);
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-switch {
  background-color: var(--color-success-bg);
  border-color: var(--color-success);
}

input:checked + .slider-switch:before {
  transform: translateX(22px);
  background-color: var(--color-success);
}

/* --- OVERLAY MODALS (CỬA SỔ NỔI) --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-container {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
  flex: 1;
}

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

/* Modal rộng cho in văn bản A4 */
.modal-container.modal-wide {
  max-width: 850px;
  width: 95%;
}

/* --- CẤU TRÚC PHÒNG NHẬP LIỆU (FORMS) --- */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group label span.required {
  color: var(--color-danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

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

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

/* Quản lý đợt thanh toán động trong form tạo dự án */
.form-payment-phases-section {
  border-top: 1px dashed var(--border-color);
  padding-top: 15px;
  margin-top: 20px;
}

.form-phases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.form-phase-row {
  display: grid;
  grid-template-columns: 3fr 1fr 2fr 2fr auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}

.btn-remove-phase {
  color: var(--color-danger);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  font-size: 16px;
}

/* --- KHU VỰC IN ẤN VÀ PREVIEW GIẤY ĐỀ NGHỊ THANH TOÁN (A4) --- */
.document-preview-container {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 790px; /* A4 width ratio */
  margin: 0 auto;
  padding: 40px 50px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-family: 'Times New Roman', Times, serif;
  font-size: 14px;
  line-height: 1.5;
}

.document-header-print {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: flex-start;
  margin-bottom: 25px;
  border-bottom: 1px solid #475569;
  padding-bottom: 15px;
}

.doc-company-info h3 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
}

.doc-company-info p {
  font-size: 12px;
  color: #475569;
  margin-top: 2px;
}

.doc-national-title {
  text-align: center;
}

.doc-national-title h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.doc-national-title p {
  font-size: 12px;
  font-weight: 600;
}

.doc-national-title .line-sep {
  width: 120px;
  height: 1px;
  background: #1e293b;
  margin: 6px auto 0;
}

.doc-title-print {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 30px 0 20px;
  letter-spacing: 0.5px;
}

.doc-subtitle-print {
  text-align: center;
  font-style: italic;
  font-size: 13px;
  margin-top: -15px;
  margin-bottom: 25px;
}

.doc-body-print p {
  margin-bottom: 10px;
  text-align: justify;
}

.doc-body-print p span.label {
  font-weight: 700;
  display: inline-block;
  min-width: 180px;
}

.doc-table-print {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.doc-table-print th, .doc-table-print td {
  border: 1px solid #1e293b;
  padding: 8px 10px;
  text-align: left;
}

.doc-table-print th {
  background-color: #f1f5f9;
  font-weight: 700;
  text-align: center;
}

.doc-table-print td.text-right {
  text-align: right;
}

.doc-table-print td.text-center {
  text-align: center;
}

.doc-bank-info-box {
  border: 1px dashed #475569;
  background-color: #f8fafc;
  padding: 15px;
  border-radius: 4px;
  margin: 20px 0;
}

.doc-bank-info-box h4 {
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-size: 13px;
}

.doc-bank-info-box p {
  margin-bottom: 4px;
}

.doc-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  text-align: center;
  margin-top: 40px;
}

.doc-signature-col {
  display: flex;
  flex-direction: column;
}

.doc-signature-col .sig-title {
  font-weight: 700;
  text-transform: uppercase;
}

.doc-signature-col .sig-desc {
  font-style: italic;
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.doc-signature-col .sig-space {
  height: 80px;
}

.doc-signature-col .sig-name {
  font-weight: 700;
}

/* --- THIẾT KẾ RESPONSIVE TOÀN DIỆN CHO MỌI THIẾT BỊ --- */
.mobile-menu-toggle {
  display: none;
}
.sidebar-overlay {
  display: none;
}

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

@media (max-width: 992px) {
  aside.sidebar {
    width: 80px;
  }
  aside.sidebar .sidebar-logo h1, 
  aside.sidebar .menu-item span,
  aside.sidebar .sidebar-footer span:first-child {
    display: none;
  }
  aside.sidebar .sidebar-logo {
    justify-content: center;
    padding: 24px 0;
  }
  aside.sidebar nav.sidebar-menu {
    padding: 0 10px;
  }
  aside.sidebar .menu-item {
    justify-content: center;
    padding: 14px 0;
  }
  main.main-content {
    margin-left: 80px;
    padding: 20px;
  }
  .project-details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  aside.sidebar {
    width: 280px !important;
    left: -280px !important;
    top: 0;
    height: 100vh;
    position: fixed;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    transition: left var(--transition-normal);
  }
  aside.sidebar.active {
    left: 0 !important;
  }
  aside.sidebar .sidebar-logo h1, 
  aside.sidebar .menu-item span,
  aside.sidebar .sidebar-footer span:first-child {
    display: inline-block !important;
  }
  aside.sidebar .sidebar-logo {
    justify-content: flex-start !important;
    padding: 30px 24px !important;
  }
  aside.sidebar nav.sidebar-menu {
    padding: 0 16px !important;
  }
  aside.sidebar .menu-item {
    justify-content: flex-start !important;
    padding: 14px 16px !important;
  }
  main.main-content {
    margin-left: 0 !important;
    padding: 15px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  
  .panel {
    padding: 16px !important;
    border-radius: var(--radius-md) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Mobile header bars styling */
  .header-bar {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center !important;
    justify-content: space-between;
    gap: 12px !important;
    padding: 15px !important;
  }
  .header-title h2 {
    font-size: 18px !important;
  }
  .header-title p {
    font-size: 11px !important;
  }
  
  /* Hamburger button stylings */
  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition-fast);
  }
  .mobile-menu-toggle:hover {
    background: var(--color-primary-glow);
    border-color: var(--color-primary);
  }
  
  /* Background Blur Overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
  }
  .sidebar-overlay.active {
    display: block !important;
  }
  
  /* Filter bar wrapping */
  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 15px !important;
  }
  .filter-group {
    flex-wrap: wrap;
    width: 100%;
  }
  .search-input-container {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Adjust detailed grid inside project_detail.php */
  .project-details-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Phase rows on form modal */
  .form-phase-row {
    grid-template-columns: 1fr !important;
    background: rgba(0, 0, 0, 0.02);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
  }
  
  /* Table wrapping styling */
  .project-table th {
    padding: 10px 8px !important;
    font-size: 11px !important;
  }
  .project-table td {
    padding: 12px 8px !important;
    font-size: 12px !important;
  }
  
  /* PDF Preview Modal */
  .pdf-preview-container {
    flex-direction: column !important;
  }
  .pdf-preview-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 15px !important;
  }
}

/* --- THIẾT KẾ IN ẤN CHUYÊN NGHIỆP A4 (PRINT CSS) --- */
@media print {
  /* Ẩn hoàn toàn các thành phần trang web khi in */
  aside.sidebar,
  main.main-content > *:not(#documentPrintWrapper),
  .modal-overlay,
  .modal-header,
  .modal-footer,
  .theme-toggle-btn,
  .btn {
    display: none !important;
  }

  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body {
    display: block !important;
  }

  /* Đưa wrapper chứa tài liệu in ra làm chính diện */
  #documentPrintWrapper {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .document-preview-container {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    color: #000000 !important;
    background: #ffffff !important;
    font-family: 'Times New Roman', Times, serif !important;
  }

  .doc-table-print th {
    background-color: #e2e8f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .doc-bank-info-box {
    background-color: #f8fafc !important;
    border: 1px dashed #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* --- GIAO DIỆN ĐĂNG NHẬP (LOGIN SCREEN STYLE) --- */
.login-container {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
  animation: loginFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 10;
}

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

.login-container::before {
  content: '';
  position: absolute;
  top: -50px;
  left: -50px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  z-index: 1;
  position: relative;
}

.login-logo i {
  font-size: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px var(--color-primary-glow));
}

.login-logo h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-weight: 500;
}

.login-error {
  background: var(--color-danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.input-with-icon {
  position: relative;
  width: 100%;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  transition: color var(--transition-fast);
}

.input-with-icon input {
  padding-left: 42px !important;
}

.input-with-icon input:focus + i {
  color: var(--color-primary);
}

.btn-login {
  width: 100%;
  height: 48px;
  justify-content: center;
  font-size: 15px;
  letter-spacing: 0.2px;
  margin-top: 15px;
}

.login-footer {
  margin-top: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.login-theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.login-theme-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-glow);
}
