/* Shared site chrome — Codami-styled header, footer, cookie, buttons.
   Requires design_tokens.css loaded first. */

.pl-body-offset {
  padding-top: var(--header-height);
}

/* Ensure dropdown menus work even if Tailwind utilities load late */
.pl-header .hidden {
  display: none !important;
}

/* ----- Buttons ----- */
.pl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  box-sizing: border-box;
}

.pl-btn-primary {
  background: var(--accent);
  color: #fff !important;
}

.pl-btn-primary:hover {
  background: var(--accent-hover);
}

.pl-btn-secondary {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink) !important;
}

.pl-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
}

.pl-btn:focus-visible,
.pl-header button:focus-visible,
.pl-header a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ----- Shared header ----- */
header.pl-header[data-site-header] {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 max(16px, calc((100vw - 1320px) / 2));
  box-sizing: border-box;
  background: var(--panel);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
}

header.pl-header[data-site-header].pl-header--renewal {
  height: auto;
  min-height: var(--header-height);
  padding-top: 10px;
  padding-bottom: 10px;
}

.pl-header__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  justify-self: start;
}

.pl-header__brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink) !important;
  text-decoration: none !important;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.pl-header__brand-link img {
  width: 39px;
  height: 39px;
  object-fit: contain;
  border-radius: var(--radius);
  flex: none;
}

.pl-header__brand-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-header__renewal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-left: 49px;
}

.pl-header__renewal-btn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: #d97706;
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none !important;
}

.pl-header__renewal-btn:hover {
  background: #b45309;
}

.pl-header__renewal-note {
  color: #92400e;
  font-size: 12px;
  white-space: nowrap;
}

.pl-header__nav {
  justify-self: center;
}

.pl-header__menu-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.pl-header__menu-btn:hover {
  background: var(--soft);
  color: var(--accent);
}

.pl-header__dropdown {
  position: relative;
}

.pl-header__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 60;
  width: 224px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 42px #0d203944;
  transform: translateX(-50%);
  color: var(--ink);
}

.pl-header__menu a,
.pl-header__menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted) !important;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none !important;
  cursor: pointer;
}

.pl-header__menu a:hover,
.pl-header__menu button:hover {
  background: var(--soft);
  color: var(--accent) !important;
}

.pl-header__menu .pl-header__logout {
  color: #dc2626 !important;
}

.pl-header__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.pl-header__icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.pl-header__icon-btn:hover {
  background: var(--soft);
}

.pl-header__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--panel);
}

.pl-header__avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.pl-header__avatar-btn img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.pl-header__menu--end {
  left: auto;
  right: 0;
  transform: none;
  width: min(320px, calc(100vw - 1.5rem));
}

.pl-header__menu--avatar {
  width: 192px;
}

.pl-header__notify-body {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.pl-header__notify-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.pl-header__notify-body strong,
.pl-header__notify-body .pl-header__notify-title {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.pl-header__notify-meta {
  margin-top: 8px !important;
  color: #92400e !important;
  font-size: 12px !important;
}

.pl-header__notify-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
}

/* ----- Footer ----- */
.pl-footer {
  background: #e9edf3;
  color: var(--ink);
  border-top: 1px solid var(--line);
  font-family: var(--font-sans);
}

html[data-theme="dark"] .pl-footer {
  background: #1b2430;
}

.pl-footer__inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  max-width: 1238px;
  margin: 0 auto;
  padding: 40px max(22px, calc((100vw - 1238px) / 2)) 28px;
}

.pl-footer__col h4 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.pl-footer__col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pl-footer__col a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--muted) !important;
  font-size: 14px;
  text-decoration: none !important;
}

.pl-footer__col a:hover {
  color: var(--accent) !important;
}

.pl-footer__col p,
.pl-footer__col address {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  font-style: normal;
}

.pl-footer__col strong {
  color: var(--ink);
}

.pl-footer__bottom {
  max-width: 1238px;
  margin: 0 auto;
  padding: 14px max(22px, calc((100vw - 1238px) / 2)) 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ----- Cookie banner ----- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: none;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-radius: 0.75rem 0.75rem 0 0;
  background: #111827;
  color: #f9fafb;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.2);
  box-sizing: border-box;
  font-family: var(--font-sans);
}

.cookie-banner__content {
  font-size: 0.875rem;
  line-height: 1.45;
}

.cookie-banner__content a {
  color: #93c5fd;
  font-weight: 600;
}

.cookie-banner__content a:hover,
.cookie-banner__content a:focus {
  text-decoration: underline;
}

.cookie-banner__actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.cookie-banner__accept {
  flex: 1 1 0;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.cookie-banner__accept:hover,
.cookie-banner__accept:focus {
  background: var(--accent-hover);
}

.cookie-banner__decline {
  flex: 1 1 0;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(229, 231, 235, 0.4);
  border-radius: var(--radius);
  background: transparent;
  color: #e5e7eb;
  font-weight: 700;
  cursor: pointer;
}

.cookie-banner__decline:hover,
.cookie-banner__decline:focus {
  border-color: rgba(229, 231, 235, 0.8);
  color: #f3f4f6;
}

.cookie-banner--hidden {
  display: none;
}

@media (min-width: 640px) {
  .cookie-banner {
    bottom: 1.5rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(92%, 640px);
    max-width: 640px;
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.25);
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
  }

  .cookie-banner__content {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .cookie-banner__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 0 0 auto;
  }

  .cookie-banner__accept,
  .cookie-banner__decline {
    flex: 0 0 auto;
    padding: 0.6rem 1.4rem;
  }
}

@media (max-width: 900px) {
  .pl-footer__inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
  }
}

@media (max-width: 700px) {
  header.pl-header[data-site-header] {
    height: 66px;
    min-height: 66px;
    padding: 0 16px;
    gap: 8px;
  }

  :root {
    --header-height: 66px;
  }

  .pl-header__brand-link {
    font-size: 15px;
    gap: 6px;
  }

  .pl-header__brand-link img {
    width: 31px;
    height: 31px;
  }

  .pl-header__renewal {
    padding-left: 0;
  }

  .pl-header__brand-link span {
    max-width: 42vw;
  }

  .pl-footer__inner {
    grid-template-columns: 1fr;
    padding: 30px 22px 20px;
  }

  .pl-footer__bottom {
    padding: 14px 22px 18px;
  }
}

@media (max-width: 350px) {
  .pl-header__brand-link span {
    display: none;
  }
}
