/* VPSTTT Buff Web Dashboard Stylesheet */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --font-family: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: #f1f5f9;
  color: var(--gray-900);
  min-height: 100vh;
}

/* QUY CHUẨN CĂN GIỮA QUANG HỌC (GEMINI.md Rule) */
/* Chip định vị / Kicker (chữ hoa 12px): padding: 7px 12px 4px; line-height: 1; */
.k-smc-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background-color: var(--primary-light);
  border-radius: 100px;
  padding: 7px 12px 4px;
  line-height: 1;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Tag nhãn phụ (12.5px): padding: 6.5px 12px 3.5px; line-height: 1; */
.k-smc-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 6px;
  padding: 6.5px 12px 3.5px;
  line-height: 1;
}

/* Huy hiệu nổi bật / Badge đậm (12.5px): padding: 8.5px 14px 5px; line-height: 1; */
.k-smc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 8.5px 14px 5px;
}

.k-smc-badge--success {
  background-color: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.k-smc-badge--danger {
  background-color: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
}

/* Button CTA tuân thủ căn giữa quang học */
.k-smc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
  padding: 8px 14px;
  outline: none;
}

.k-smc-button__label {
  display: inline-block;
  line-height: 1;
  transform: translateY(1px); /* Bù trừ dấu mũ tiếng Việt để cân tâm quang học */
}

.k-smc-button__icon {
  flex-shrink: 0;
}

.k-smc-button--primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}

.k-smc-button--primary:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
}

.k-smc-button--secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.k-smc-button--secondary:hover {
  background: var(--gray-100);
}

.k-smc-button--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.k-smc-button--danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  padding-top: 11px;
  padding-bottom: 10px;
}

/* Màn hình Đăng Nhập */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--gray-200);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
}

.brand-logo.sm {
  width: 32px;
  height: 32px;
  font-size: 16px;
  border-radius: 8px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gray-700);
  line-height: 1.3;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13.5px;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: #fff;
  color: var(--gray-900);
  box-sizing: border-box;
}

.form-group input:not([type="checkbox"]):not([type="radio"])::placeholder {
  color: #94a3b8;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.alert-box {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
}

.alert-error {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Dashboard Layout */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.navbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-title {
  font-size: 16px;
  font-weight: 800;
}

.nav-chip {
  margin-left: 6px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}

.main-content {
  padding: 24px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.online-icon { background: #dcfce7; }
.user-icon { background: #ede9fe; }
.gmail-icon { background: #fee2e2; }
.proxy-icon { background: #e0f2fe; }

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

.stat-label {
  font-size: 12px;
  color: var(--gray-500);
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-500);
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -4px;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Tab Panes */
.tab-pane {
  display: none;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tab-pane.active {
  display: block;
}

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

.pane-title {
  font-size: 16px;
  font-weight: 800;
}

.pane-subtitle {
  font-size: 12.5px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Data Table */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  font-weight: 700;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #fafbfc;
}

.text-center {
  text-align: center;
}

.font-mono {
  font-family: monospace;
}

/* ==========================================================================
   MODAL & FORM SYSTEM (OCD-Compliant & Optical Perfection)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 24px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.15s ease;
}

.btn-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

/* Modal Form Layout: Các trường cách nhau tăm tắp 14px */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* Grid 2 cột cân đối hoàn hảo */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

/* Checkbox Card chuẩn OCD: Hàng ngang thẳng thớm, không bị rớt dòng hay lệch tâm */
.form-checkbox-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px;
  padding: 11px 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-checkbox-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.form-checkbox-card input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  accent-color: #4f46e5;
  cursor: pointer;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
}

.form-checkbox-card label {
  margin: 0 !important;
  cursor: pointer;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  line-height: 1.35;
  user-select: none;
}

/* Khung thông báo ghi chú kịch bản */
.form-callout {
  padding: 12px 14px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  font-size: 12.5px;
  line-height: 1.55;
  color: #1e40af;
}

/* Actions Footer: Căn lề, padding và chiều cao nút bấm chuẩn xác */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.modal-actions .k-smc-button {
  height: 40px;
  padding: 0 18px;
  font-size: 13px;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}
