/* ============================================================
   SUPPORT PORTAL v2026 - style.css
   ============================================================ */

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

:root {
  --brand:       #10b981;
  --brand-dark:  #059669;
  --brand-light: #d1fae5;
  --danger:      #ef4444;
  --danger-dark: #dc2626;
  --warning:     #f59e0b;
  --purple:      #8b5cf6;
  --blue:        #3b82f6;

  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --border:      #e2e8f0;
  --border2:     #cbd5e1;

  --text:        #0f172a;
  --text2:       #475569;
  --text3:       #94a3b8;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:      0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-xl:   0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);

  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   20px;

  --transition:  all .2s cubic-bezier(.4,0,.2,1);

  --sidebar-w:   260px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  gap: 16px;
}

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

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16,185,129,.35);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--text);
}

.logo-badge {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: .5px;
}

.header-desc {
  font-size: 12.5px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* USER HEADER */
.user-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1.5px solid var(--border);
}

.user-header-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-header-info {
  display: flex;
  flex-direction: column;
}

.user-header-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.user-header-role {
  font-size: 10px;
  color: var(--text3);
  font-weight: 500;
}

/* ADMIN PANEL LINK */
.btn-admin-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--purple);
  background: transparent;
  color: var(--purple);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}
.btn-admin-link:hover {
  background: #ede9fe;
  transform: translateY(-1px);
}

/* LOGOUT BUTTON */
.header-btns {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-secondary-header {
  height: 36px;
  padding: 0 12px;
  gap: 6px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.btn-secondary-header:hover {
  background: white;
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
}

.btn-logout-header {
  height: 36px;
  padding: 0 14px;
  gap: 8px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.btn-logout-header:hover {
  background: #fff1f2;
  border-color: #fca5a5;
  color: var(--danger);
  transform: translateY(-1px);
}
.btn-logout-header svg { flex-shrink: 0; }


.btn-mail {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--text);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  position: relative;
}
.btn-mail:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.mail-dot {
  width: 8px;
  height: 8px;
  background: var(--brand);
  border-radius: 50%;
  position: absolute;
  top: 7px;
  right: 7px;
  display: none;
}
.mail-dot.visible { display: block; }

/* ══════════════════════════════════════
   MAIN
══════════════════════════════════════ */
.main {
  padding: 24px 28px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 36px 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.search-input::placeholder { color: var(--text3); }
.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--text3);
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: var(--transition);
}
.search-clear:hover { background: var(--danger); }

.team-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: .5px;
  margin-right: 2px;
}

.team-btn {
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--text2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.team-btn:hover { 
  background: var(--surface2); 
  border-color: var(--border2);
  color: var(--text); 
}
.team-btn.active {
  background: var(--text);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Nút team có màu riêng khi active */
.team-btn.active[style*="--team-color"] {
  background: var(--team-color);
  border-color: var(--team-color);
  color: white;
}

.status-select {
  padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.status-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}

.btn-add {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(16,185,129,.3);
}
.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16,185,129,.4);
}
.btn-add:active { transform: translateY(0); }

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

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border2);
  border-radius: 99px 99px 0 0;
}
.stat-card.active::before  { background: var(--brand); }
.stat-card.inactive::before { background: var(--danger); }
.stat-card.display::before  { background: var(--purple); }

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

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: .8px;
  text-transform: uppercase;
}
.stat-card.active  .stat-label { color: var(--brand); }
.stat-card.inactive .stat-label { color: var(--danger); }
.stat-card.display  .stat-label { color: var(--purple); }

.stat-value {
  font-size: 38px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}
.stat-card.active  .stat-value { color: var(--brand); }
.stat-card.inactive .stat-value { color: var(--danger); }
.stat-card.display  .stat-value { color: var(--purple); }

/* ── TABLE ── */
.table-wrap {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto; /* Thêm thanh cuộn ngang */
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
}

.data-table th {
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: .8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.col-stt     { width: 45px; }
.col-name    { min-width: 200px; }
.col-status  { width: 120px; }
.col-team    { width: 140px; }
.col-source  { min-width: 180px; }
.col-tech    { min-width: 350px; }
.col-contact { min-width: 180px; }
.col-backup  { min-width: 200px; }
.col-actions { width: 80px; text-align: center; position: sticky; right: 0; background: var(--surface2); z-index: 10; border-left: 1.5px solid var(--border); }

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }

.data-table td {
  padding: 14px 16px;
  vertical-align: top;
  font-size: 13.5px;
  color: var(--text);
}

.td-stt {
  font-weight: 700;
  color: var(--text3);
  font-size: 13px;
}

.td-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.2px;
}

.td-actions {
  position: sticky;
  right: 0;
  background: white; /* Giữ màu trắng để che nội dung bên dưới khi cuộn */
  z-index: 5;
  border-left: 1.5px solid var(--border);
  vertical-align: middle !important;
}

tr:hover .td-actions {
  background: #f8fafc; /* Màu highlight khi hover dòng */
}

/* STATUS BADGE */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-active {
  background: #dcfce7;
  color: #15803d;
}
.badge-active::before {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.2);
  animation: pulse-green 2s infinite;
}
.badge-inactive {
  background: #fee2e2;
  color: #b91c1c;
}
.badge-inactive::before {
  background: #ef4444;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,.1); }
}

/* TEAM CHIP */
.team-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: #ede9fe;
  color: #6d28d9;
  margin-bottom: 3px;
}
.person-name {
  font-size: 12.5px;
  color: var(--text2);
}
.unassigned {
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
}

/* BACKUP TAG */
.backup-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  margin-bottom: 4px;
}
.backup-note {
  font-size: 12px;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-word;
}
.empty-info {
  color: var(--text3);
  font-style: italic;
  font-size: 12.5px;
}

/* TECH INFO */
.tech-box {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 36px 10px 10px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text2);
  max-height: 120px;
  overflow-y: auto;
}

.btn-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text3);
  flex-shrink: 0;
}
.btn-copy:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
.btn-copy.copied {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

/* ACTION BUTTONS */
.actions-wrap {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-edit, .btn-trash {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1.5px solid;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-edit {
  border-color: var(--blue);
  color: var(--blue);
}
.btn-edit:hover {
  background: var(--blue);
  color: white;
  transform: scale(1.1);
}

.btn-trash {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-trash:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.1);
}

/* EMPTY STATE */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text3);
  font-size: 14px;
}

/* ══════════════════════════════════════
   MODALS
══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(.97);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal.modal-sm { max-width: 420px; }

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

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

/* FORM */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.required { color: var(--danger); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  resize: vertical;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(16,185,129,.1);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.chip {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.selected {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand-dark);
}

.btn-cancel {
  padding: 9px 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-cancel:hover { border-color: var(--border2); background: var(--bg); }

.btn-save {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-save:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* DELETE MODAL */
.delete-icon {
  text-align: center;
  padding: 8px 0;
}
.delete-msg {
  text-align: center;
  font-size: 15px;
  color: var(--text);
}
.delete-sub {
  text-align: center;
  font-size: 12.5px;
  color: var(--text3);
}

.btn-delete-confirm {
  padding: 9px 20px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-delete-confirm:hover {
  background: var(--danger-dark);
  transform: translateY(-1px);
}

/* MAIL HINT */
.mail-hint {
  font-size: 12px;
  color: var(--text3);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  background: var(--text);
  color: white;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 360px;
  pointer-events: all;
  animation: slideUp .3s cubic-bezier(.34,1.56,.64,1);
}
.toast.success { background: var(--brand-dark); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--text); }
.toast.fade-out { animation: fadeOut .3s ease forwards; }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

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

@media (max-width: 768px) {
  .header { padding: 0 16px; height: auto; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; gap: 10px; }
  .header-desc { display: none; }
  .main { padding: 16px; }
  .toolbar { gap: 8px; }
  .search-wrap { min-width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  .data-table { min-width: 840px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { border-radius: var(--radius-lg); }
}

/* ══════════════════════════════════════
   FIRESTORE DB STATUS INDICATOR
══════════════════════════════════════ */
.db-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  transition: var(--transition);
  flex-shrink: 0;
}

.db-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
  transition: var(--transition);
}

/* connecting – xoay nhẹ */
.db-dot.db-connecting {
  background: var(--warning);
  animation: db-blink 1s ease-in-out infinite;
}
.db-status-connecting {
  border-color: #fde68a;
  color: #92400e;
  background: #fffbeb;
}

/* connected – nhịp xanh */
.db-dot.db-connected {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(16,185,129,.2);
  animation: db-pulse 2.5s ease-in-out infinite;
}
.db-status-connected {
  border-color: #6ee7b7;
  color: var(--brand-dark);
  background: #f0fdf4;
}

/* error – đỏ */
.db-dot.db-error {
  background: var(--danger);
}
.db-status-error {
  border-color: #fca5a5;
  color: var(--danger-dark);
  background: #fff1f2;
}

@keyframes db-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,.08); }
}
@keyframes db-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ══════════════════════════════════════
   SETUP BANNER (Firebase chưa cấu hình)
══════════════════════════════════════ */
.setup-banner {
  background: linear-gradient(90deg, #fef3c7, #fef9e7);
  border-bottom: 2px solid #fcd34d;
  position: sticky;
  top: 68px;
  z-index: 99;
}

.setup-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #78350f;
  font-size: 13px;
}

.setup-inner svg { flex-shrink: 0; color: #d97706; }

.setup-inner span { flex: 1; }

.setup-inner code {
  background: rgba(0,0,0,.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

.setup-inner a {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}
.setup-inner a:hover { text-decoration: underline; }

.setup-inner button {
  border: none;
  background: rgba(0,0,0,.1);
  color: #78350f;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.setup-inner button:hover { background: rgba(0,0,0,.2); }

@media (max-width: 768px) {
  .db-status  { display: none; }
  .setup-inner { padding: 10px 16px; font-size: 12px; }
}

/* ──────────────────────────────────────
   MODAL PREMIUM STYLES (New)
 ────────────────────────────────────── */
.modal-premium {
  border-radius: 20px !important;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
  animation: modalPremiumIn .35s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255,255,255,0.1);
}
@keyframes modalPremiumIn {
  from { opacity: 0; transform: scale(0.95) translateY(15px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.header-icon-wrap {
  width: 44px; height: 44px;
  background: var(--brand-light);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand);
  margin-right: 14px;
  flex-shrink: 0;
}

.form-group-premium { margin-bottom: 22px; }
.form-label-sm { 
  display: block; font-size: 13px; font-weight: 700; 
  color: var(--text2); margin-bottom: 9px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.input-icon-wrap { position: relative; display: flex; align-items: center; }
.icon-input {
  position: absolute; left: 16px;
  color: var(--text3);
  pointer-events: none;
  transition: all .2s;
  z-index: 10;
}
.input-premium {
  width: 100%; height: 52px;
  padding: 0 16px 0 46px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all .25s ease;
  color: var(--text);
}
.input-premium:focus {
  background: white;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.input-premium:focus + .icon-input,
.input-icon-wrap:focus-within .icon-input { 
  color: var(--brand); 
  transform: scale(1.1);
}

.footer-premium { background: #f8fafc; padding: 24px; gap: 14px; border-top: 1px solid #e2e8f0 !important; }

.btn-cancel-premium {
  flex: 1; height: 50px;
  background: white; border: 1.5px solid #e2e8f0;
  border-radius: 14px; color: var(--text2);
  font-weight: 700; font-size: 14px;
  cursor: pointer; transition: all .2s;
}
.btn-cancel-premium:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

.btn-submit-premium {
  flex: 2; height: 50px;
  background: linear-gradient(135deg, var(--brand), #059669);
  color: white; border: none;
  border-radius: 14px; font-weight: 700; font-size: 15px;
  cursor: pointer; transition: all .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 20px -5px rgba(16, 185, 129, 0.4);
  position: relative; overflow: hidden;
}
.btn-submit-premium:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px -8px rgba(16, 185, 129, 0.5);
  filter: brightness(1.05);
}
.btn-submit-premium:active { transform: translateY(0); }
.btn-submit-premium:disabled { opacity: 0.7; cursor: not-allowed; transform: none; box-shadow: none; }

