/* === BIẾN THIẾT KẾ === */
:root {
  --primary: #6C63FF;
  --primary-light: #8B83FF;
  --primary-dark: #4A42E0;
  --accent: #00D9FF;
  --bg-dark: #0F0E17;
  --text-primary: #FFFFFE;
  --text-secondary: #A7A9BE;
  --success: #2CB67D;
  --warning: #FF8906;
  --danger: #E53170;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === NỀN GRADIENT ĐỘNG === */
.bg-gradient {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0F0E17 0%, #1A1A2E 40%, #16213E 70%, #0F0E17 100%);
  z-index: -2;
}
.bg-gradient::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background:
    radial-gradient(circle at 25% 40%, rgba(108,99,255,0.15) 0%, transparent 50%),
    radial-gradient(circle at 75% 70%, rgba(0,217,255,0.08) 0%, transparent 50%);
  animation: bgShift 25s ease-in-out infinite;
}
@keyframes bgShift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-3%, -3%) rotate(1deg); }
}

/* === CONTAINER === */
.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.container-wide {
  max-width: 900px;
}

/* === HEADER === */
.header {
  text-align: center;
  margin-bottom: 28px;
  animation: fadeDown 0.6s ease;
}
.header .badge {
  display: inline-block;
  padding: 6px 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.header h1 {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}
.header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

/* === CARD GLASS === */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-bottom: 20px;
  animation: fadeUp 0.5s ease;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .icon {
  font-size: 18px;
}

/* === THÔNG TIN BUỔI HỌC === */
.session-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(108,99,255,0.1);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  animation: fadeUp 0.5s ease 0.1s both;
}
.session-dot {
  width: 12px; height: 12px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
  flex-shrink: 0;
}
.session-dot.offline { background: var(--text-secondary); animation: none; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(44,182,125,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(44,182,125,0); }
}
.session-text { font-size: 13px; line-height: 1.5; }
.session-text strong { color: var(--accent); font-size: 14px; }

/* === FORM === */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  outline: none;
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
  background: rgba(255,255,255,0.08);
}
.form-group input::placeholder {
  color: rgba(255,255,255,0.25);
}
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

/* === NÚT === */
.btn {
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108,99,255,0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.btn-success {
  background: linear-gradient(135deg, var(--success), #34d58e);
  color: white;
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(44,182,125,0.4);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.btn-sm {
  width: auto;
  padding: 10px 20px;
  font-size: 13px;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* === MÀN HÌNH THÀNH CÔNG === */
.success-screen {
  text-align: center;
  animation: fadeUp 0.6s ease;
}
.success-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--success), #34d58e);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
.success-screen h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
.success-screen p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}
.zoom-link-box {
  padding: 16px;
  background: rgba(0,217,255,0.08);
  border: 1px solid rgba(0,217,255,0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.zoom-link-box a {
  color: var(--accent);
  font-weight: 600;
  word-break: break-all;
  font-size: 14px;
  text-decoration: none;
}
.zoom-link-box a:hover { text-decoration: underline; }
.zoom-link-box .hint {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* === LỊCH HỌC === */
.schedule-list {
  list-style: none;
}
.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 14px;
  transition: background 0.2s;
}
.schedule-item:hover { background: rgba(255,255,255,0.03); }
.schedule-item .num {
  width: 28px; height: 28px;
  background: rgba(108,99,255,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-light);
  flex-shrink: 0;
}
.schedule-item.active {
  background: rgba(44,182,125,0.1);
  border: 1px solid rgba(44,182,125,0.2);
}
.schedule-item.active .num {
  background: var(--success);
  color: white;
}
.schedule-item.past { opacity: 0.5; }
.schedule-item .date { flex: 1; }
.schedule-item .time {
  font-size: 12px;
  color: var(--text-secondary);
}

/* === TRANG ADMIN === */
.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
}
.login-card h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 20px;
}
.login-error {
  padding: 10px 14px;
  background: rgba(229,49,112,0.1);
  border: 1px solid rgba(229,49,112,0.2);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* === DASHBOARD === */
.dashboard { display: none; }
.dashboard.active { display: block; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  padding: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.stat-card .stat-number {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === TABS BUỔI HỌC === */
.session-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.session-tabs::-webkit-scrollbar { display: none; }
.session-tab {
  padding: 10px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.session-tab:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}
.session-tab.active {
  background: rgba(108,99,255,0.15);
  border-color: rgba(108,99,255,0.3);
  color: var(--primary-light);
}

/* === BẢNG DỮ LIỆU === */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead {
  background: rgba(255,255,255,0.05);
}
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
tr:hover td {
  background: rgba(255,255,255,0.02);
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}
.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* === TOOLBAR === */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.search-box:focus {
  border-color: var(--primary);
}
.search-box::placeholder { color: rgba(255,255,255,0.25); }

/* === FOOTER === */
.footer {
  margin-top: auto;
  padding-top: 20px;
  text-align: center;
}
.footer a {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s;
}
.footer a:hover { color: var(--primary-light); }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* === ANIMATION KEYFRAMES === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .container { padding: 16px 12px; }
  .card { padding: 20px 16px; }
  .header h1 { font-size: 22px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  th, td { padding: 10px 12px; font-size: 13px; }
  .toolbar { flex-direction: column; }
  .search-box { min-width: 100%; }
}

/* === ADMIN NAV === */
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-nav h2 {
  font-size: 18px;
}
.nav-actions {
  display: flex;
  gap: 8px;
}

/* === ẨN/HIỆN VIEW === */
.view { display: none; }
.view.active { display: block; }

/* === LOADING SPINNER === */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
