/* ==========================================================================
   CSS DESIGN SYSTEM: Modern Obsidian & Glassmorphic Excel-Grid UI
   Hỗ trợ Responsive PC & Mobile, UTF-8 Tiếng Việt
   ========================================================================== */

:root {
  --bg-main: #0B0F19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(28, 36, 56, 0.9);
  --bg-surface: #151D2E;
  --bg-surface-elevated: #1E293B;
  
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-grid: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-highlight: rgba(129, 140, 248, 0.3);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-inverse: #0F172A;

  --accent-primary: #6366F1;
  --accent-primary-hover: #4F46E5;
  --accent-primary-light: rgba(99, 102, 241, 0.15);

  --accent-emerald: #10B981;
  --accent-emerald-hover: #059669;
  --accent-emerald-light: rgba(16, 185, 129, 0.15);
  --accent-amber: #F59E0B;
  --accent-amber-light: rgba(245, 158, 11, 0.15);
  --accent-rose: #EF4444;
  --accent-rose-light: rgba(239, 68, 68, 0.15);
  --accent-cyan: #06B6D4;
  --accent-purple: #8B5CF6;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}
.bg-glow-1 {
  top: -10%;
  left: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
}
.bg-glow-2 {
  bottom: 10%;
  right: 15%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, transparent 70%);
}

/* Layout Container */
.app-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px 20px 100px;
  position: relative;
  z-index: 1;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

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

.logo-box {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  flex-shrink: 0;
}

.logo-icon {
  width: 26px;
  height: 26px;
  color: #FFFFFF;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #FFFFFF 0%, #CBD5E1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn-add-row {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.btn-add-row:hover {
  background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #4338CA 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #7073FA 0%, #4F46E5 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background: #27354A;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: #FFFFFF;
  border: 1px solid transparent;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #F87171 0%, #EF4444 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}
.btn-danger:active {
  transform: translateY(0);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.btn-text:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}
.btn-text.text-danger:hover {
  color: var(--accent-rose);
  background: var(--accent-rose-light);
}

/* Stats Section */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}
.stat-card.active-card {
  border-color: rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(49, 46, 129, 0.25) 100%);
}

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

.icon-blue { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }
.icon-green { background: var(--accent-emerald-light); color: var(--accent-emerald); }
.icon-amber { background: var(--accent-amber-light); color: var(--accent-amber); }

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

.stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.2;
  margin-top: 2px;
}
.stat-value.highlight {
  color: #818CF8;
}

/* Toolbar & Filters */
.toolbar-card {
  padding: 16px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.search-box {
  position: relative;
  flex: 1 1 320px;
  max-width: 450px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 10px 38px 10px 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}
.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.search-box input::placeholder {
  color: var(--text-muted);
}

.btn-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.btn-clear:hover {
  color: var(--text-primary);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}
.filter-pill:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}
.filter-pill.active {
  background: var(--accent-primary);
  color: #FFFFFF;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.selection-actions .divider {
  color: var(--border-subtle);
}

/* Custom Checkbox */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background-color: var(--bg-surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  vertical-align: middle;
}
.custom-checkbox:hover {
  border-color: var(--accent-primary);
}
.custom-checkbox:checked {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.custom-checkbox:checked::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  position: absolute;
  top: 2px;
}

/* ==========================================================================
   EXCEL GRID SPREADSHEET TABLE DESIGN
   ========================================================================== */
.table-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

.table-wrapper {
  overflow-x: auto;
  max-height: 72vh;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-surface-elevated) transparent;
}

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

.header-excel-row {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0F172A;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.personnel-table th {
  padding: 14px 14px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #F1F5F9;
  text-transform: none;
  letter-spacing: 0.02em;
  border-bottom: 2px solid rgba(255, 255, 255, 0.18);
  border-right: 1px solid var(--border-grid);
  text-align: center;
  white-space: nowrap;
  background: #0F172A;
}

.personnel-table th:last-child {
  border-right: none;
}

.personnel-table th.th-name {
  text-align: left;
}

.personnel-table tbody tr {
  border-bottom: 1px solid var(--border-grid);
  transition: var(--transition);
}
.personnel-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}
.personnel-table tbody tr:hover {
  background: var(--bg-card-hover);
}
.personnel-table tbody tr.selected {
  background: rgba(99, 102, 241, 0.12);
}

.personnel-table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-right: 1px solid var(--border-grid);
}
.personnel-table td:last-child {
  border-right: none;
}

.th-checkbox, td.td-checkbox {
  width: 44px;
  text-align: center;
}
.th-stt, td.td-stt {
  width: 55px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: center;
}
.th-name { min-width: 180px; }
.th-cccd { min-width: 130px; text-align: center; }
.th-dob { min-width: 110px; text-align: center; }
.th-img-cccd { min-width: 220px; }
.th-exp { min-width: 115px; text-align: center; }
.th-exam { min-width: 110px; text-align: center; }
.th-status { min-width: 120px; text-align: center; }
.th-action, td.td-action { width: 88px; text-align: center; white-space: nowrap; }

.btn-action-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FBBF24;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-action-edit:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #F59E0B;
  color: #FDE68A;
  transform: scale(1.08);
}
.btn-action-edit .icon-sm {
  width: 16px;
  height: 16px;
}

.btn-action-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  margin-left: 4px;
}
.btn-action-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #EF4444;
  color: #FECACA;
  transform: scale(1.08);
}
.btn-action-delete .icon-sm {
  width: 16px;
  height: 16px;
}

.td-name {
  font-weight: 700;
  color: #FFFFFF;
  font-size: 0.92rem;
}

.td-cccd, .td-dob, .td-exp, .td-exam {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  color: #CBD5E1;
}

.cccd-copy-badge {
  display: inline-block;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.cccd-copy-badge:hover {
  border-color: var(--accent-primary);
  background: var(--accent-primary-light);
  color: #A5B4FC;
}

/* Excel Images Grid Display inside Cell */
.excel-cell-images {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.excel-img-item {
  position: relative;
  width: 96px;
  height: 96px;
  background: #000000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.excel-img-item:hover {
  transform: scale(1.1);
  border-color: var(--accent-primary);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

.excel-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.excel-img-item:hover img {
  transform: scale(1.05);
}

.excel-img-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  padding: 2px 0;
}

.no-img-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.valid {
  background: var(--accent-emerald-light);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.status-pill.expired {
  background: var(--accent-rose-light);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.status-pill.unknown {
  background: rgba(148, 163, 184, 0.12);
  color: #94A3B8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Empty & Loading States */
.empty-state, .loading-state {
  padding: 60px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

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

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Floating Action Bar */
.floating-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 100;
  width: calc(100% - 40px);
  max-width: 860px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  pointer-events: none;
}
.floating-bar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.floating-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

.floating-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-count {
  width: 36px;
  height: 36px;
  background: var(--accent-primary);
  color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 1rem;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.floating-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.floating-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-card.modal-lg {
  max-width: 900px;
  max-height: 88vh;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-title-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.modal-title-box p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}
.btn-close-modal:hover {
  color: var(--text-primary);
}

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
}

/* Form Styles for Add Row Modal */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.form-group label .text-danger {
  color: var(--accent-rose);
}

.form-group input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}
.form-group input:focus, .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-select {
  cursor: pointer;
}

.badge-count-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: #A5B4FC;
  font-family: var(--font-mono);
}

.upload-section {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 10px;
}

/* Utility icon sizes */
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; }
.icon-md { width: 24px; height: 24px; flex-shrink: 0; }
.icon-lg { width: 32px; height: 32px; flex-shrink: 0; }
.text-primary { color: #818CF8; }
.text-green { color: #34D399; }

.upload-dropzone {
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.upload-dropzone:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
}
.upload-dropzone .dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.upload-dropzone p {
  font-size: 0.84rem;
  color: var(--text-primary);
  margin: 0;
}
.upload-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.upload-previews {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.preview-thumb-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.preview-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.btn-remove-thumb {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.75);
  color: #FFFFFF;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}

/* Lightbox specific styles */
.person-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.lightbox-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}
.tab-btn.active {
  background: var(--accent-primary-light);
  color: #A5B4FC;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.gallery-card {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.gallery-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.gallery-img-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.gallery-card:hover .gallery-img-wrap img {
  transform: scale(1.04);
}

.gallery-info {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

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

@media (max-width: 768px) {
  .app-container {
    padding: 16px 12px 100px;
  }
  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 16px;
  }
  .header-actions {
    flex-direction: column;
  }
  .header-actions .btn {
    width: 100%;
  }
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .toolbar-card {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
  .filter-group {
    justify-content: flex-start;
  }
  .selection-actions {
    justify-content: space-between;
    width: 100%;
  }
  .floating-bar {
    width: calc(100% - 24px);
    bottom: 12px;
  }
  .floating-bar-content {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .floating-buttons {
    width: 100%;
  }
  .floating-buttons .btn {
    flex: 1;
  }
}
