/* Light English theme (global) */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --brand: #2563eb;
  --border: #e5e7eb;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
}

/* ====== Global reset & base ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

/* Links */
a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Focus state – important for accessibility & Lighthouse */
:focus-visible {
  outline: 2px solid #facc15;
  outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #0f172a;
  color: #f9fafb;
  border-radius: 0.5rem;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
  z-index: 50;
  font-size: 0.85rem;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ====== Layout container ====== */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* ====== Header & Navigation (mobile-first) ====== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(248, 250, 252, 0.96); /* var(--bg) với opacity */
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

/* Nav wrapper */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* Brand */
.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand span {
  color: var(--brand);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-link img {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
}

/* Nav toggle (hamburger) for mobile */
.nav-toggle {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  color: #1f2933;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background-color: #e5e7eb;
}

/* Links container – mobile: hidden by default */
.nav-links {
  position: absolute;
  inset-inline: 0;
  top: 56px; /* gần bằng chiều cao header để hạn chế layout shift */
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: none;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
  gap: 0.5rem;
}

/* Khi JS thêm .is-open sẽ hiện ra */
.nav-links.is-open {
  display: flex;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  opacity: 0.95;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
}

/* tap target > 44px: tốt cho Lighthouse mobile */
.nav-links a,
.nav-toggle {
  min-height: 44px;
  min-width: 44px;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  opacity: 1;
  background-color: #eff6ff;
}

/* Nút chính trong nav */
.nav-links .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 1rem;
  padding-block: 0.6rem;
  background: var(--brand);
  color: #ffffff;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid #1d4ed8;
}

.nav-links .btn:hover,
.nav-links .btn:focus-visible {
  background: #1d4ed8;
}

/* ====== Buttons (global) ====== */
.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--brand);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn.secondary {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid var(--border);
}

/* ====== Cards, inputs, alerts, stats ====== */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

/* Form controls */
.input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #0f172a;
  font-size: 0.95rem;
}

.input:focus-visible {
  border-color: var(--brand);
}

/* Labels */
.label {
  display: block;
  margin: 12px 0 6px;
  font-size: 14px;
  color: #0f172a;
}

/* Alerts */
.alert {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  font-size: 0.9rem;
}

.success {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 0.9rem;
}

/* Grid layout (dashboard, stats, v.v.) */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

/* Stat blocks */
.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 10px;
  background: #ffffff;
}

.stat .value {
  font-size: 22px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* ====== Footer ====== */

.footer {
  margin: 40px 0 10px;
  background: #ffffff;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 1.5rem;
  font-size: 13px;
  color: #94a3b8;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
}

.footer-inner a {
  color: #0f172a;
}

/* Trường hợp site cũ không dùng .footer-inner thì giữ lại style cũ cho .footer text */
.footer:not(.has-inner) {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

/* ====== Responsive ====== */

/* Mobile & tablet: thu gọn grid */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Desktop nav (>=768px): nav-links luôn hiện ngang, không dùng menu mobile */
@media (min-width: 768px) {
  .nav {
    padding-block: 0.75rem;
  }

  .nav-toggle {
    display: none;
  }

  .nav-links {
    position: static;
    display: flex !important;
    flex-direction: row;
    background: transparent;
    border-bottom: none;
    padding: 0;
    gap: 0.75rem;
    align-items: center;
  }

  .nav-links a {
    margin-left: 0;
    font-size: 0.95rem;
    padding: 0.4rem 0.75rem;
  }

  .nav-links .btn {
    margin-left: 1rem;
  }

  .brand-link img {
    width: 48px;
    height: 48px;
  }
}

/* ====== Reduce motion (optional – good for accessibility) ====== */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
