/* ============================================================================
 * admin-dashboard/public/styles.css - GIAO DIỆN QUẢN TRỊ ADMIN TU TIÊN 2D
 * TỐI ƯU TOÀN DIỆN CHO CẢ MOBILE & DESKTOP (COMPACT & MODERN UI)
 * ==========================================================================*/
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Noto+Serif:wght@600;700&display=swap');

:root {
  --bg-base: #070a0f;
  --bg-surface: #0f1623;
  --bg-card: #172234;
  --bg-card-sub: #1b283d;
  --bg-hover: #23334d;
  --border: #263852;
  --border-light: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fbbf24;
  --accent-emerald: #10b981;
  --accent-cyan: #06b6d4;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Noto Serif', serif;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-ui);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* 1. MÀN HÌNH ĐĂNG NHẬP */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at center, #172554 0%, #070a0f 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(15, 22, 35, 0.95);
  border: 1px solid var(--accent-gold);
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 0 50px rgba(245, 158, 11, 0.2);
  backdrop-filter: blur(10px);
}

.login-head {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo {
  font-size: 38px;
  margin-bottom: 6px;
}

.login-head h1 {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--accent-gold-light);
  letter-spacing: 0.5px;
}

.login-head p {
  font-size: 12px;
  color: var(--text-muted);
}

/* FORM CONTROLS */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #e2e8f0;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border: 1px solid var(--accent-gold-light);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* 2. BỐ CỤC CHÍNH DASHBOARD */
#dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* SIDEBAR DESKTOP */
.sidebar {
  width: 250px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  font-size: 24px;
}

.brand-text h2 {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--accent-gold-light);
}

.brand-text span {
  font-size: 11px;
  color: var(--accent-emerald);
  font-weight: 600;
}

.sidebar-nav {
  list-style: none;
  padding: 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-link.active {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-badge {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-backdrop {
  display: none;
}

/* TOPBAR */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-mobile-menu {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.topbar-title h2 {
  font-size: 16px;
  font-weight: 700;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.12);
  padding: 4px 8px;
  border-radius: 16px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

.content-pane {
  padding: 20px;
  flex: 1;
}

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

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.players { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); }
.stat-icon.database { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.stat-icon.server { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.stat-icon.logs { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

.stat-info h3 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-info p {
  font-size: 11px;
  color: var(--text-muted);
}

/* 4. PHẦN BẢNG DỮ LIỆU & BỘ LỌC */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.table-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-search {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

@media (min-width: 768px) {
  .table-search {
    width: auto;
  }
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.data-table th {
  padding: 10px 12px;
  background: #0a0e17;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(38, 56, 82, 0.5);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* BADGES */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-gold { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-green { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-blue { background: rgba(6, 182, 212, 0.18); color: #38bdf8; border: 1px solid rgba(6, 182, 212, 0.35); }
.badge-purple { background: rgba(139, 92, 246, 0.18); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.35); }
.badge-rose { background: rgba(244, 63, 94, 0.18); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.35); }
.badge-gray { background: #263852; color: #94a3b8; }

/* NÚT THAO TÁC */
.btn-sm {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-sm:hover {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold-light);
}

.btn-buff {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}
.btn-buff:hover {
  background: var(--accent-emerald);
  color: #000;
}

.btn-gift {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #c084fc;
}
.btn-gift:hover {
  background: var(--accent-purple);
  color: #fff;
}

.btn-danger-sm {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
}
.btn-danger-sm:hover {
  background: var(--accent-rose);
  color: #fff;
}

/* 5. MODALS (TỐI ƯU CẢ MOBILE & DESKTOP) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 12px;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 780px;
}

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

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

.btn-close:hover {
  color: #fff;
}

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

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #0a0e17;
}

.btn-secondary {
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-submit {
  padding: 7px 16px;
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid var(--accent-gold-light);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* TOAST */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 90vw;
}

.toast {
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: slideIn 0.25s ease-out;
}

.toast.success { border-color: var(--accent-emerald); color: #34d399; }
.toast.error { border-color: var(--accent-rose); color: #fda4af; }

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

/* 6. THIẾT KẾ ĐẶC BIỆT CHO MOBILE (< 768px) */
@media (max-width: 768px) {
  .btn-mobile-menu {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 95;
    backdrop-filter: blur(2px);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .topbar {
    padding: 10px 14px;
  }

  .content-pane {
    padding: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }

  .stat-info h3 {
    font-size: 16px;
  }

  .table-card {
    padding: 12px;
  }

  .modal-card {
    max-height: 96vh;
    border-radius: 10px;
  }

  .modal-header, .modal-body, .modal-footer {
    padding: 12px 14px;
  }

  .status-indicator {
    display: none; /* Ẩn dòng status dài trên mobile */
  }
}
