/**
 * Shared layout polish for all tenant skins (edu-sites).
 * Loaded after theme CSS + common.css. Safe, progressive enhancements only.
 * Does NOT replace skin look — improves structure, mobile, a11y, overflow.
 */

/* ---------- Base content hygiene ---------- */
img,
video {
  max-width: 100%;
  height: auto;
}
/* iframes: only max-width — never height:auto (collapses embeds) */
iframe {
  max-width: 100%;
}
/*
 * hCaptcha checkbox ONLY (direct child of .h-captcha).
 * Do NOT target all iframe[src*=hcaptcha] — that also hits the challenge
 * popup with pictures and forces it to 303×78 (only a top strip visible).
 */
.h-captcha > iframe {
  max-width: 100% !important;
  width: 303px !important;
  height: 78px !important;
}

#main-content img,
.main-container img,
.teacher-content img,
#content img,
.content img,
#forparentssm img {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}

.main-container,
.teacher-content,
#content,
#forparentssm,
.content {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

/* Scrollable tables on narrow screens */
.main-container table,
.teacher-content table,
#content table,
.content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Site-wide pagination (theme::_partials.paginate) ---------- */
.edu-site-pager,
.edu-feedback-pager,
.t1-pager,
.t2-pager,
.t3-pager,
.t12-pager,
.k-feedback-pager,
.k-cat__pager,
.k-gallery-page__pager,
.sport-pagination {
  margin-top: 1.15rem;
  display: flex;
  justify-content: center;
  clear: both;
  width: 100%;
}

/* Styles attach to the partial itself so any parent works */
.pager-container {
  width: 100%;
  text-align: center;
  float: none !important;
  margin: 1rem 0 0;
}
.pager-container ul {
  display: flex !important;
  flex-wrap: wrap;
  gap: .3rem;
  list-style: none !important;
  margin: 0 auto !important;
  padding: 0 !important;
  justify-content: center;
  align-items: center;
  float: none !important;
  width: auto !important;
}
.pager-container .pager-item {
  display: inline-flex !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
.pager-container .pager-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 .7rem !important;
  border-radius: 10px !important;
  border: 1px solid #cbd5e1 !important;
  background: #fff !important;
  color: #1e3a5f !important;
  font-weight: 700 !important;
  font-size: .9rem !important;
  text-decoration: none !important;
  line-height: 1 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}
.pager-container a.pager-btn:hover {
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
  background: #eff6ff !important;
}
.pager-container .pager-item.active .pager-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .25) !important;
  cursor: default;
  pointer-events: none;
}
.pager-container .pager-btn--nav {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  min-width: 2.5rem;
  padding: 0 .55rem !important;
}
.pager-container .pager-btn--dots {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #64748b !important;
  min-width: 1.6rem;
  padding: 0 .2rem !important;
}
.pager-container .pager-item.is-disabled .pager-btn {
  opacity: .45;
  cursor: default;
  pointer-events: none;
  background: #f8fafc !important;
  color: #94a3b8 !important;
  border-color: #e2e8f0 !important;
  box-shadow: none !important;
}

/* ---------- Classic shell (themes 7–11): #root / #center ---------- */
#root {
  min-height: 100vh;
}

#center {
  box-sizing: border-box;
}

#main-content .main-container {
  min-height: 280px;
}

/* Side column breathing room */
#side-content.side-content,
.side-content {
  box-sizing: border-box;
}

.side-box .header p {
  margin: 0;
}

/* Support / messages badges */
#navigation .blink,
.side-content .blink {
  color: #c0392b;
  font-weight: 700;
  animation: edu-blink 1.2s ease-in-out infinite;
}

@keyframes edu-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* Back-to-top */
.buttonup {
  z-index: 40;
  opacity: .9;
  transition: opacity .2s ease, transform .2s ease;
}
.buttonup:hover {
  opacity: 1;
  transform: translateY(-2px);
}

/* Flash / expire alerts */
.web_alert,
.alert {
  box-sizing: border-box;
}
.web_alert.show_alert {
  z-index: 100;
}

/* ---------- Teacher shell (themes 1–3) ---------- */
.teacher-info .container.vhh,
.teacher-info .container {
  box-sizing: border-box;
}

.teacher-content {
  min-height: 240px;
}

.teacher-info aside ul {
  padding-left: 0;
}

.teacher-info .banner .search-form input[type="text"] {
  max-width: 100%;
  box-sizing: border-box;
}

/* ---------- Middle shell (themes 4–6) ---------- */
#contentBlock,
#middle,
#content.centered {
  box-sizing: border-box;
}

#contentBlock .content,
#middle #content,
#forparents {
  min-height: 240px;
}

/* ---------- Focus / a11y ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

/* Skip visual glitches from empty widgets */
.side-box.infosidelist-widget:empty {
  display: none;
}

/* ---------- Classic: mobile 3-column stack ---------- */
@media (max-width: 991px) {
  /* Many classic skins float main + side; force readable stack */
  #center {
    display: flex;
    flex-direction: column;
  }

  #main-content {
    width: 100% !important;
    float: none !important;
    max-width: 100%;
  }

  #side-content,
  .side-content#side-content {
    width: 100% !important;
    float: none !important;
    max-width: 100%;
    margin-top: 1rem;
  }

  #center .clear {
    display: none;
  }

  /* Horizontal menu: allow wrap / scroll */
  .header-menu,
  #header-menu,
  nav.header-menu,
  .top-menu {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Teacher: stack aside / content / banner */
@media (max-width: 991px) {
  .teacher-info .container.vhh,
  .teacher-info .container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .teacher-info aside,
  .teacher-info .teacher-content,
  .teacher-info .banner {
    width: 100% !important;
    float: none !important;
    max-width: 100%;
  }

  .teacher-info aside {
    order: 1;
  }

  .teacher-info .teacher-content {
    order: 2;
  }

  .teacher-info .banner {
    order: 3;
  }
}

/* Middle: stack left / content / right */
@media (max-width: 991px) {
  #contentBlock,
  #middle {
    display: flex;
    flex-direction: column;
  }

  #contentBlock .left-menu,
  #contentBlock .content,
  #contentBlock .right-menu,
  #middle .left-menu,
  #middle #content,
  #middle .right-menu,
  #content.centered .left-menu,
  #content.centered #forparents,
  #content.centered .right-menu {
    width: 100% !important;
    float: none !important;
    max-width: 100%;
  }
}

/* ---------- Print ---------- */
@media print {
  .buttonup,
  .bvi_eye,
  #side-content .auth-widget,
  .side-box.auth-widget {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  #main-content,
  .teacher-content,
  #content,
  .content {
    width: 100% !important;
    float: none !important;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .buttonup,
  #navigation .blink,
  .side-content .blink {
    animation: none !important;
    transition: none !important;
  }
}

/*
 * Cookie / personal-data banner (baseline for all skins)
 * Was previously only in public/css/style.css and per-theme CSS.
 * Modern skins that drop legacy style.css still need this.
 * Skins may override with higher-specificity rules.
 */
.personal-data-processing-agreement-widget,
.site-pd-notice {
  display: block !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20000;
  width: 100%;
  box-sizing: border-box;
  padding: 0 0.75rem 0.85rem;
  background: transparent;
  pointer-events: none;
}

html.pd-ok .personal-data-processing-agreement-widget,
html.pd-ok .site-pd-notice {
  display: none !important;
}

.personal-data-processing-agreement-widget .wrapper {
  pointer-events: auto;
  box-sizing: border-box;
  width: min(100%, 1040px);
  max-width: 1040px;
  margin: 0 auto;
  padding: 0.95rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  background: linear-gradient(115deg, #0f3a4f 0%, #0d7a72 100%);
  color: #f4fbfa;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 40px rgba(7, 32, 51, 0.32);
}

.personal-data-processing-agreement-widget .acceptance-text {
  flex: 1 1 240px;
  width: auto;
  margin: 0;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
  color: #f4fbfa;
  max-height: min(46vh, 320px);
  overflow-y: auto;
}

.personal-data-processing-agreement-widget .acceptance-text p {
  margin: 0;
}

.personal-data-processing-agreement-widget .acceptance-text p + p {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.personal-data-processing-agreement-widget .acceptance-text a {
  color: #ffe08a;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.personal-data-processing-agreement-widget .acceptance-text a:hover {
  color: #ffffff;
}

.personal-data-processing-agreement-widget .acceptance-button {
  flex: 0 0 auto;
  margin: 0;
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  color: #0b2430;
  background: linear-gradient(180deg, #ffe08a, #f0b429);
  box-shadow: 0 8px 18px rgba(240, 180, 41, 0.32);
  white-space: nowrap;
}

.personal-data-processing-agreement-widget .acceptance-button:hover {
  filter: brightness(1.05);
}

@media (max-width: 640px) {
  .personal-data-processing-agreement-widget .wrapper {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .personal-data-processing-agreement-widget .acceptance-button {
    width: 100%;
  }
}

/* Header cog «Администрирование» — slow spin + soft pulse so it is noticed */
@keyframes admin-gear-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes admin-gear-ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 214, 80, 0.72); }
  70% { box-shadow: 0 0 0 10px rgba(255, 214, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 214, 80, 0); }
}

a.admin-gear {
  position: relative;
  z-index: 1;
}
a.admin-gear::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  pointer-events: none;
  animation: admin-gear-ring 2.2s ease-out infinite;
}
a.admin-gear .fa-cog {
  display: inline-block;
  animation: admin-gear-spin 5.5s linear infinite;
  transform-origin: 50% 50%;
}
a.admin-gear:hover::after {
  animation: none;
}
a.admin-gear:hover .fa-cog {
  animation: admin-gear-spin 1.1s linear infinite;
}

a.admin-gear-link .fa-cog {
  display: inline-block;
  margin-right: 0.35rem;
  color: #eab308;
  animation: admin-gear-spin 5.5s linear infinite;
  transform-origin: 50% 50%;
}
a.admin-gear-link:hover .fa-cog {
  animation: admin-gear-spin 1.1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  a.admin-gear::after,
  a.admin-gear .fa-cog,
  a.admin-gear-link .fa-cog {
    animation: none !important;
  }
}

/* ---------- /about — site passport (all skins) ---------- */
.about-site {
  max-width: 920px;
  margin: 0 auto 0.4rem;
  color: #12323a;
}
.about-site__hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem 1.5rem;
  margin: 0 0 1rem;
  padding: 1.45rem 1.5rem;
  border-radius: 22px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    linear-gradient(125deg, var(--navy, #0a3d4d) 0%, var(--teal, #0b8f7a) 52%, var(--teal2, #12c4a8) 100%);
  box-shadow: 0 18px 44px rgba(6, 42, 36, 0.14);
}
.about-site__glow {
  position: absolute;
  width: 220px;
  height: 220px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.about-site__logo {
  position: relative;
  z-index: 1;
  width: 108px;
  height: 108px;
  border-radius: 28px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  background: #fff;
  flex: 0 0 auto;
}
.about-site__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.about-site__hero-text {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1 1 220px;
}
.about-site__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  color: #fff;
}
.about-site__title {
  margin: 0 0 0.4rem !important;
  font-size: clamp(1.3rem, 2.5vw, 1.85rem) !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  color: #fff !important;
  letter-spacing: -0.02em;
}
.about-site__url {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  flex-wrap: wrap;
}
.about-site__url a {
  color: #fff !important;
  font-weight: 700;
  text-decoration: none !important;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.45);
}
.about-site__url a:hover {
  border-bottom-color: #fff;
}
.about-site__copy {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.about-site__copy:hover,
.about-site__copy.is-copied {
  background: #fff;
  color: #06705f;
}
.about-site__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.about-site__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}
.about-site__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.about-site__btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
  font-size: 0.88rem !important;
  text-decoration: none !important;
  border: 0 !important;
  line-height: 1.15;
}
.about-site__btn--light {
  background: #fff !important;
  color: #06705f !important;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}
.about-site__btn--ghost {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
}
.about-site__btn:hover {
  filter: brightness(1.05);
  text-decoration: none !important;
}
.about-site__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0 0 1rem;
}
.about-site__stat {
  background: #fff;
  border: 1px solid #d7ece7;
  border-radius: 16px;
  padding: 0.85rem 1rem;
  box-shadow: 0 8px 20px rgba(6, 42, 36, 0.06);
  min-width: 0;
}
.about-site__stat-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a6b63;
  margin-bottom: 0.25rem;
}
.about-site__stat-value {
  display: block;
  font-size: 1.02rem;
  font-weight: 800;
  color: #0a3d4d;
  overflow-wrap: anywhere;
}
.about-site__card {
  background: #fff;
  border: 1px solid #c5e5de;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(6, 42, 36, 0.07);
  overflow: hidden;
  margin: 0 0 1rem;
}
.about-site__block {
  padding: 1.05rem 1.25rem 1.15rem;
  border-top: 1px solid #e5e7eb;
}
.about-site__block:first-child {
  border-top: 0;
}
.about-site__h {
  margin: 0 0 0.4rem !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a6b63 !important;
}
.about-site__text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  font-weight: 600;
  color: #12323a;
  overflow-wrap: anywhere;
}
.about-site__rows {
  padding: 0.2rem 0;
}
.about-site__row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 0.78rem 1.25rem;
  border-top: 1px solid #e5e7eb;
}
.about-site__row:first-child {
  border-top: 0;
}
.about-site__label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a6b63;
  padding-top: 0.15rem;
}
.about-site__value {
  font-weight: 700;
  color: #12323a;
  overflow-wrap: anywhere;
}
.about-site__value a {
  color: #0b8f7a;
  font-weight: 800;
  text-decoration: none;
}
.about-site__value a:hover {
  text-decoration: underline;
}
.about-site__help {
  background: #fff;
  border: 1px solid #c5e5de;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(6, 42, 36, 0.07);
  overflow: hidden;
}
.about-site__help > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1.2rem;
  font-weight: 800;
  color: #0a3d4d;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.about-site__help > summary::-webkit-details-marker {
  display: none;
}
.about-site__help > summary::after {
  content: "▾";
  margin-left: auto;
  color: #0b8f7a;
  font-size: 0.9rem;
}
.about-site__help[open] > summary::after {
  transform: rotate(180deg);
}
.about-site__help-body {
  padding: 0 1.2rem 1.2rem;
  border-top: 1px solid #e5e7eb;
  overflow-wrap: anywhere;
}
.about-site__help-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

body.theme-kids .about-site__hero,
body.kinder-theme .about-site__hero {
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    linear-gradient(125deg, #0ea5a4 0%, #22c55e 48%, #84cc16 100%);
  border-radius: 28px;
}
body.theme-kids .about-site__logo,
body.kinder-theme .about-site__logo {
  border-radius: 50%;
}
body.theme-kids .about-site__stat,
body.kinder-theme .about-site__stat,
body.theme-kids .about-site__card,
body.kinder-theme .about-site__card,
body.theme-kids .about-site__help,
body.kinder-theme .about-site__help {
  border-radius: 22px;
}

/* Horizontal site menu: no dead gap so the submenu does not vanish on the way down */
@media (min-width: 992px) {
  [class*="-nav__list"] > li > ul,
  .teacher-menu .container > ul > li > ul,
  .kinder-nav__list > li > .list-level-2,
  .k-nav > li > ul {
    top: 100% !important;
    margin-top: 0 !important;
  }

  [class*="-nav__list"] > li > ul::before,
  .teacher-menu .container > ul > li > ul::before,
  .kinder-nav__list > li > .list-level-2::before,
  .k-nav > li > ul::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -14px;
    height: 14px;
  }

  [class*="-nav__list"] > li:focus-within > ul,
  .teacher-menu li:focus-within > ul,
  .kinder-nav__list li:focus-within > ul,
  .kinder-nav__list li:focus-within > .list-level-2 {
    display: block !important;
  }
}

@media (max-width: 720px) {
  .about-site__stats {
    grid-template-columns: 1fr;
  }
  .about-site__row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
  .about-site__hero {
    padding: 1.15rem 1.1rem;
  }
}
