/* =========================================================
   EHS Campaign – Suntory PepsiCo
   Shared styles (layout, sidebar, topbar, cards, buttons, modal)
   Font: Montserrat (css/fonts.css)
   ========================================================= */
:root {
  --navy: #00375d;
  --navy-2: #12365a;
  --ink: #151d48;
  --ink-2: #17233c;
  --ink-3: #0f172b;
  --muted: #737791;
  --muted-2: #73839a;
  --orange: #fe5d02;
  --green: #008f21;
  --green-2: #0d9d68;
  --blue: #216be8;
  --danger: #e11d48;
  --line: #e2e8f0;
  --line-2: #dfe7f1;
  --page-bg: #fafbfc;
  --sidebar-w: 17.25rem;
  --topbar-h: 6rem;
  --radius-card: 1rem;
  --shadow-card: 0 0.2rem 0.9rem rgba(0, 18, 45, .04);
}

*, *::before, *::after { box-sizing: border-box; }
/* Cỡ chữ gốc (1rem) theo từng khổ màn hình: xem css/responsive.css */
   /* tablet / mobile: cố định để chữ không quá nhỏ */
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; }
p, h1, h2, h3, h4 { margin: 0; }

/* ---------------- App shell ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: var(--sidebar-w);
  background: #fff;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar__logo { display: block; margin: 1.3rem 0 0 2.35rem; width: 13.55rem; height: 5.15rem; }
.sidebar__logo img { width: 13.55rem; height: 5.15rem; }

.nav { list-style: none; margin: 1.05rem 0 0 2.35rem; padding: 0; width: 12.6rem; display: flex; flex-direction: column; gap: 1rem; }
.nav__link {
  display: flex; align-items: center; gap: 1.2rem;
  height: 3.2rem; padding: 0 1.2rem; border-radius: 0.8rem;
  font-size: 0.9rem; font-weight: 400; color: var(--muted);
  transition: background-color .2s, color .2s;
}
.nav__link img { width: 1.6rem; height: 1.6rem; flex: none; }
.nav__link .ic-active { display: none; }
.nav__link:hover { background: #f1f5f9; }
.nav__link.is-active { background: #dde6ee; color: var(--navy-2); font-weight: 600; gap: 1rem; }
.nav__link.is-active .ic-default { display: none; }
.nav__link.is-active .ic-active { display: block; }

.promo { display: block; margin: 1.65rem 0 2rem 1.5rem; width: 13.45rem; height: 22.5rem; border-radius: 1rem; overflow: hidden; transition: transform .25s, box-shadow .25s; }
.promo img { width: 13.45rem; height: 22.5rem; }
.promo:hover { transform: translateY(-0.15rem); box-shadow: 0 0.6rem 1.5rem rgba(0, 55, 93, .18); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 15;
  height: var(--topbar-h); background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2.2rem 0 2rem;
}
/* Logo trong topbar chỉ hiện ở mobile/tablet (xem responsive.css) – desktop đã có logo to
   trong sidebar, không cần lặp lại ở topbar. */
.topbar__logo { display: none; }
.topbar__title { flex: 1; min-width: 0; font-size: 1.3rem; font-weight: 600; line-height: 1.4; color: var(--ink); }
.topbar__title--md { font-weight: 500; color: var(--ink-3); letter-spacing: -.75px; line-height: 1.8rem; padding-left: 0; }

.user-chip { display: flex; align-items: center; height: 3rem; }
.user-chip__avatar {
  width: 3rem; height: 3rem; border-radius: 50%; flex: none;
  background: #e6eeff; color: var(--navy);
  display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 600; letter-spacing: -.5px;
}
.user-chip__info { width: 8.3rem; padding: 0.5rem; font-size: 0.8rem; line-height: 1.2rem; }
.user-chip__name { font-weight: 500; color: var(--ink); }
.user-chip__id { color: var(--muted); }
.user-chip__action { width: 1.2rem; height: 1.2rem; display: grid; place-items: center; border-radius: 0.3rem; transition: background-color .2s; }
.user-chip__action:hover { background: #f1f5f9; }
/* Icon thoát dùng mask thay vì <img> để tô màu --danger (đỏ), đồng bộ với nút/modal xác nhận
   đăng xuất (PNG gốc icon-logout.png là icon đơn sắc, không tự đổi màu qua CSS filter chính xác). */
.user-chip__action-icon {
  display: block; width: 1.2rem; height: 1.2rem; background-color: var(--danger);
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.login-chip { display: flex; align-items: center; gap: 0.8rem; height: 3rem; font-size: 0.8rem; font-weight: 500; line-height: 1.2rem; color: var(--ink); }
.login-chip .user-chip__avatar { margin-right: 0; }
.login-chip__label { display: flex; align-items: center; gap: 0.15rem; }
.login-chip__label img { width: 1.2rem; height: 1.2rem; }
.login-chip:hover .login-chip__label { color: var(--navy); }

.content { flex: 1; padding: 1.55rem 2.2rem 0 1.5rem; }

.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 1.2rem;
  padding: 0.9rem 0 1.4rem; margin-left: 0.4rem;
  font-size: max(0.6rem, var(--fs-min, 0px)); line-height: 0.6rem; color: #718198; white-space: pre;
}
.footer__brand { font-weight: 500; }
.footer__links a:hover { color: var(--navy); }

/* ---------------- Generic card ---------------- */
.card {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  position: relative;
}
.card__title { font-size: 1rem; font-weight: 600; line-height: 1.3rem; color: var(--ink-2); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.5rem; padding: 0 1rem; border-radius: 5rem;
  font-size: 0.8rem; line-height: 0.8rem; font-weight: 400; white-space: nowrap;
  transition: background-color .2s, box-shadow .2s, transform .2s;
}
.btn--white { background: #fff; color: var(--navy); }
.btn--white:hover { box-shadow: 0 0.3rem 0.9rem rgba(0, 55, 93, .18); }
.btn--orange { background: var(--orange); color: #fff; }
.btn--orange:hover { background: #e95400; box-shadow: 0 0.3rem 0.9rem rgba(254, 93, 2, .35); }
.btn--navy { background: var(--navy); color: #fff; }
.btn--navy:hover { background: #002c4b; box-shadow: 0 0.3rem 0.9rem rgba(0, 55, 93, .3); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #c8173e; }
.btn--outline { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn--outline:hover { background: #f2f7fc; }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { background: #f2f7fc; }

/* Arrow icon with slide animation (2 arrows like the Figma component) */
.arrow { position: relative; width: 1.25rem; height: 1.25rem; overflow: hidden; flex: none; }
.arrow img { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform .3s ease; }
.arrow img + img { transform: translate(-100%, 100%); }
.btn:hover .arrow img:first-child, a:hover > .arrow img:first-child { transform: translate(100%, -100%); }
.btn:hover .arrow img + img, a:hover > .arrow img + img { transform: translate(0, 0); }
.arrow--sm { width: 0.95rem; height: 0.95rem; }

/* ---------------- Pills / progress ---------------- */
.pill { display: inline-flex; align-items: center; justify-content: center; border-radius: 0.75rem; font-size: max(0.6rem, var(--fs-min, 0px)); font-weight: 500; line-height: 0.8rem; white-space: nowrap; }
.track { height: 0.35rem; border-radius: 0.2rem; background: #e7edf4; overflow: hidden; }
.track__value { height: 100%; border-radius: 0.2rem; min-width: 0.3rem; transition: width .6s ease; }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field__label { padding-left: 0.25rem; font-size: max(0.7rem, var(--fs-min2, 0px)); line-height: 1.4; color: #2d3748; }
.field__control {
  height: 2rem; width: 100%; padding: 0 1rem;
  border: 1px solid var(--line); border-radius: 0.4rem; background: #fff;
  font-size: max(0.7rem, var(--fs-min2, 0px)); line-height: 1.4; color: var(--navy);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.field__control::placeholder { color: #a0aec0; }
.field__control:focus { border-color: var(--navy); box-shadow: 0 0 0 0.15rem rgba(0, 55, 93, .1); }
.field__control.is-invalid { border-color: var(--danger); }
.field__control.is-locked,
.field__control:disabled,
.field__control[readonly] { background: #eef1f5; color: var(--muted-2, #718096); cursor: not-allowed; }
.field__hint { display: flex; align-items: center; gap: 0.2rem; font-size: max(0.6rem, var(--fs-min, 0px)); line-height: 1.4; color: var(--muted-2); }
.field__hint img { width: 0.75rem; height: 0.75rem; }
.field--select .field__control {
  appearance: none; -webkit-appearance: none; padding: 0 1.7rem 0 0.5rem; cursor: pointer;
  background: #fff url('../images/icon-chevron-down.png') no-repeat right 0.5rem center / 0.8rem 0.8rem;
}
.field--select .field__control:invalid { color: #a0aec0; }
.field--select option { color: var(--navy); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

/* ---------------- Modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: rgba(0, 0, 0, .68); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.modal.is-open { opacity: 1; visibility: visible; }
.modal__dialog { transform: translateY(0.8rem) scale(.98); transition: transform .25s ease; }
.modal.is-open .modal__dialog { transform: none; }

/* Panel with coloured header (login / logout) */
.panel { width: 22.35rem; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 0.2rem 1rem rgba(238, 238, 238, .5); overflow: hidden; position: relative; }
.panel__head { display: flex; align-items: center; gap: 0.4rem; height: 3rem; padding: 0.8rem 1.2rem; background: var(--navy); color: #fff; font-size: 1rem; font-weight: 500; line-height: 1.4rem; letter-spacing: -.45px; }
.panel__head img { width: 1.2rem; height: 1.2rem; }
.panel__head--danger { background: var(--danger); }
.panel__close { position: absolute; top: 0.8rem; right: 0.95rem; width: 1.4rem; height: 1.4rem; padding: 0.2rem; border-radius: 0.3rem; display: grid; place-items: center; transition: background-color .2s; }
.panel__close:hover { background: rgba(255, 255, 255, .15); }
.panel__close img { width: 1rem; height: 1rem; }
.panel__body { padding: 1rem 1.1rem 1.4rem 1.1rem; }

.login-form { display: flex; flex-direction: column; justify-content: space-between; gap: 0.5rem; min-height: 15.75rem; }
.login-form__fields { display: flex; flex-direction: column; gap: 0.5rem; }
.login-form__fields > .field:first-child { gap: 0.25rem; }
.login-form .btn { width: 100%; }
.login-form__error { display: none; font-size: max(0.6rem, var(--fs-min, 0px)); color: var(--danger); padding-left: 0.25rem; }
.login-form.has-error .login-form__error { display: block; }

.logout-confirm { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.9rem; }
.logout-confirm__avatar { width: 3.75rem; height: 3.75rem; font-size: 1.7rem; }
.logout-confirm__text { font-size: max(0.8rem, var(--fs-min2, 0px)); line-height: 1.3rem; color: var(--ink); }
.logout-confirm__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; width: 100%; }
.logout-confirm__actions .btn { width: 100%; }

[hidden] { display: none !important; }
.field__control[name="fullName"]:not(:placeholder-shown) { font-size: 0.8rem; line-height: 1.2rem; }
.topbar--inner { padding-left: 1.75rem; }
.topbar > .user-chip { margin-right: 1rem; }

/* ---------------- Danh sách tin (dùng ở Trang chủ & Chi tiết bài viết) ---------------- */
.news-list { position: absolute; left: 0.7rem; right: 0.75rem; top: 2.75rem; bottom: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0 0 0.6rem; scrollbar-width: thin; scrollbar-color: #dfe7f1 transparent; }
.news-list::-webkit-scrollbar { width: 0.2rem; }
.news-list::-webkit-scrollbar-thumb { background: #dfe7f1; border-radius: 0.2rem; }
.news-item + .news-item { border-top: 1px solid #e5e9ee; margin-top: 0.45rem; padding-top: 0.45rem; }
.news-item a { display: flex; align-items: center; gap: 0.5rem; }
.news-item__thumb { width: 6.65rem; height: 3.55rem; flex: none; border-radius: 0.5rem; overflow: hidden; background: #efefef; }
.news-item__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.news-item a:hover .news-item__thumb img { transform: scale(1.06); }
.news-item__text { min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.news-item__meta { display: flex; align-items: center; gap: 0.7rem; font-size: max(0.6rem, var(--fs-min, 0px)); font-weight: 300; line-height: 0.7rem; color: #020202; }
.news-item__meta i { width: 0.15rem; height: 0.15rem; border-radius: 50%; background: #020202; }
.news-item__title { font-size: max(0.7rem, var(--fs-min2, 0px)); line-height: 1.1rem; color: #020202; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-item a:hover .news-item__title { color: var(--navy); }


/* ---------------- Nút menu (chỉ hiện ở tablet / mobile) ---------------- */
.menu-btn { display: none; flex: none; width: 2.4rem; height: 2.4rem; margin-right: 0.6rem; border-radius: 0.6rem; place-items: center; align-content: center; gap: 0.25rem; transition: background-color .2s; }
.menu-btn:hover { background: #f1f5f9; }
.menu-btn span { display: block; width: 1.2rem; height: 2px; border-radius: 2px; background: var(--navy); transition: transform .25s, opacity .25s; }
.menu-open .menu-btn span:nth-child(1) { transform: translateY(calc(0.25rem + 2px)) rotate(45deg); }
.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
.menu-open .menu-btn span:nth-child(3) { transform: translateY(calc(-0.25rem - 2px)) rotate(-45deg); }
.sidebar-backdrop { display: none; }

/* ---------------- Tap/press feedback – cảm giác "app" khi bấm (xem barba-init.js cho hiệu ứng chuyển trang) ---------------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav__link, .ptab, .act__cta, .news-item a, .promo, .menu-btn, .login-chip,
  .user-chip__action, .panel__close, .plant-filter button, .answer:not(:disabled), .result__btn {
    -webkit-tap-highlight-color: transparent;
    transition: background-color .2s, color .2s, box-shadow .2s, transform .12s ease-out;
  }
  .btn:active, .nav__link:active, .ptab:active, .act__cta:active, .news-item a:active,
  .promo:active, .menu-btn:active, .login-chip:active, .user-chip__action:active,
  .panel__close:active, .plant-filter button:active, .answer:not(:disabled):active, .result__btn:active {
    transform: scale(.96);
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Ripple – gợn sóng lan từ điểm bấm trên các nút chính (.btn), xem main.js (mục "Ripple") */
.btn { position: relative; overflow: hidden; }
.btn__ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .5); transform: scale(0); opacity: .7; pointer-events: none;
  animation: btnRipple .5s ease-out forwards;
}
.btn--white .btn__ripple, .btn--outline .btn__ripple, .btn--ghost .btn__ripple { background: rgba(0, 55, 93, .18); }
@keyframes btnRipple { to { transform: scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .btn__ripple { display: none; } }

/* ---------------- Trang nội dung đơn giản (Hỗ trợ/Quy định/Bảo mật/Liên hệ...) — templates/static.php.
   Dùng layout .ehs-home (2 cột, xem home.css) + class .card chung, chỉ thêm phần typography nội dung. ---------------- */
.static-page__card { padding: 1.8rem 2rem 2.2rem; }
.static-page__title { font-size: 1.5rem; font-weight: 700; line-height: 1.9rem; color: var(--ink); margin: 0 0 1.3rem; }
.static-page__body { font-size: 0.85rem; line-height: 1.7; color: var(--ink-2); }
.static-page__body h2 { font-size: 1.15rem; font-weight: 600; line-height: 1.5rem; color: var(--navy); margin: 1.8rem 0 0.7rem; }
.static-page__body h2:first-child { margin-top: 0; }
.static-page__body h3 { font-size: 0.95rem; font-weight: 600; line-height: 1.3rem; color: var(--ink); margin: 1.4rem 0 0.5rem; }
.static-page__body p { margin: 0 0 0.9rem; }
.static-page__body ul, .static-page__body ol { margin: 0 0 0.9rem; padding-left: 1.3rem; }
.static-page__body li { margin-bottom: 0.35rem; }
.static-page__body li:last-child { margin-bottom: 0; }
.static-page__body a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.static-page__body a:hover { color: var(--navy); }
.static-page__body strong { font-weight: 600; color: var(--ink); }
.static-page__body em { font-style: italic; color: var(--muted-2); }

.wp-video {
  width: 100% !important;
  height: auto;
}

.wp-video video {
  width: 100% !important;
  height: auto;
}
.static-page__body img {
  height: auto;
}
/* Vai trò Quản lý: không áp dụng Game */
body.ehs-manager [data-game-only],
body.ehs-manager .act[data-act="game"] { display: none !important; }
