/* LibraMed Mobile Learning 1.2.0 — уроки і тести на телефоні.
   Діє лише на відкритому уроці/тесті (body.course-item-popup) і лише на телефоні:
   вертикально (ширина до 767 px) або горизонтально (висота до 520 px).
   Дані курсів, тестів і сертифікатів не змінює. */

html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

/* ================= СПІЛЬНЕ: телефон вертикально і горизонтально ================= */
@media (max-width:767px), (orientation:landscape) and (max-height:520px) and (pointer:coarse){

  /* 1. Порожнеча над шапкою: тема тримає місце під стару шапку, яку на телефоні
        замінює шапка «Кабінет · Програма», і під стару дворядну смугу знизу */
  html.lm-mhead-on body.course-item-popup #popup-course{padding-top:8px!important;--thim-ekit-popup-header-height:0px!important;--thim-ekit-popup-footer-height:0px!important}
  html.lm-mhead-on body.course-item-popup #popup-course #popup-content{height:calc(100vh - 8px - var(--wp-admin--admin-bar--height,0px))!important;height:calc(100dvh - 8px - var(--wp-admin--admin-bar--height,0px))!important}
  html.lm-mhead-on body.course-item-popup #popup-content .elementor-widget-thim-ekits-course-item-data{margin-top:0!important}
  html.lm-mhead-on body.course-item-popup #popup-content .elementor-widget-thim-ekits-course-item-data>.elementor-widget-container{margin-top:0!important}
  html.lm-mhead-on body.course-item-popup #popup-content .elementor-widget-thim-ekits-course-item-data .thim-ekit-single-item__data{top:0!important}
  /* бірюзовий «язичок» бокової панелі: на телефоні є кнопка «Програма» */
  html.lm-mhead-on body.course-item-popup .elementor-widget-thim-ekits-course-close-sidebar,
  html.lm-mhead-on body.course-item-popup .elementor-element-317c91b{opacity:0!important;pointer-events:none!important}
  html.lm-mhead-on body.course-item-popup .lm-mhead{margin-bottom:10px!important}

  /* 2. Нижня навігація: одна тонка смуга, «Попередній» і «Наступний» поруч */
  body.course-item-popup .ekit-popup-footer{padding:6px 10px calc(6px + env(safe-area-inset-bottom,0px))!important;min-height:0!important;height:auto!important;box-shadow:0 -1px 0 rgba(15,42,61,.08),0 -6px 16px rgba(15,42,61,.06)}
  body.course-item-popup .ekit-popup-footer>.e-con-inner,
  body.course-item-popup .ekit-popup-footer .elementor-widget-thim-ekits-course-item-nav,
  body.course-item-popup .ekit-popup-footer .elementor-widget-thim-ekits-course-item-nav>.elementor-widget-container{padding:0!important;margin:0!important;width:100%!important;max-width:none!important;min-height:0!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation{display:flex!important;flex-direction:row!important;gap:8px!important;align-items:stretch!important;min-height:0!important;height:auto!important;padding:0!important;margin:0!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__link{flex:1 1 0!important;min-width:0!important;min-height:0!important;height:auto!important;margin:0!important;padding:0!important;float:none!important;max-width:none!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__link:not(:has(a)){display:none!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__link a{display:flex!important;align-items:center!important;gap:6px!important;width:100%!important;height:46px!important;min-height:0!important;padding:0 8px!important;border:1px solid #cfe3e6!important;border-radius:12px!important;background:#fff!important;text-decoration:none!important;box-sizing:border-box!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__next a{flex-direction:row!important;justify-content:space-between!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__next .thim-ekit-single-course-item__navigation__arrow{order:2}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__arrow{width:28px!important;height:28px!important;min-width:28px!important;border:0!important;font-size:18px!important;margin:0!important;color:#0f8f8c!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__link__content{display:block!important;min-width:0!important;margin:0!important;padding:0!important;text-align:left!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__link__content--label{font-size:14px!important;line-height:1.2!important;font-weight:700!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;margin:0!important;color:#0f3d52!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__link__content--title{display:none!important}
  /* місце під смугу, щоб останній блок не ховався під нею */
  html body.course-item-popup #popup-course #popup-content{padding-bottom:calc(84px + env(safe-area-inset-bottom,0px))!important}
  /* кнопка налаштувань cookie перекривала кнопки уроку; тут прихована, на решті сайту лишається */
  body.course-item-popup #lm-consent-manage{display:none!important}

  /* 3. Відео: правильні пропорції 16:9 */
  body.course-item-popup .lmml-video .elementor-widget-container{margin:0!important}
  body.course-item-popup .lmml-video:not(.lmbsv-outer) iframe,body.course-item-popup .lmml-video:not(.lmbsv-outer) video{width:100%!important;max-width:100%!important;display:block}
  @supports (aspect-ratio:16/9){
    body.course-item-popup .lmml-video:not(.lmbsv-outer) iframe,body.course-item-popup .lmml-video:not(.lmbsv-outer) video{height:auto!important;aspect-ratio:16/9}
  }

  /* 4. Результат тесту: компактно, бали і кнопка «Завершити курс» видно одразу */
  body.course-item-popup .quiz-result{display:flex!important;flex-direction:column!important;align-items:stretch!important;margin:0 0 14px!important;padding:14px 14px 4px!important;border:1px solid #e3edf0;border-radius:16px;background:#fff;text-align:center}
  /* порядок: заголовок, коло, «Пройдено/Не вдалося», «Завершити курс», цифри */
  body.course-item-popup .quiz-result>*{order:6}
  body.course-item-popup .quiz-result>.result-heading{order:1}
  body.course-item-popup .quiz-result>.result-grade{order:2;align-self:center}
  body.course-item-popup .quiz-result>.result-message{order:3;align-self:center}
  body.course-item-popup .quiz-result>[data-lp-custom-finish]{order:4}
  body.course-item-popup .quiz-result>.result-statistic{order:5}
  body.course-item-popup .quiz-result [data-lp-custom-finish]{display:block!important;width:100%!important;min-height:50px!important;margin:0 0 12px!important;border-radius:12px!important;font-size:16px!important;font-weight:800!important;letter-spacing:.02em;line-height:1.2!important;padding:13px 16px!important;box-shadow:0 6px 16px rgba(40,167,69,.28)}
  body.course-item-popup .quiz-result .result-heading{font-size:15px!important;line-height:1.3!important;margin:0 0 6px!important;font-weight:700!important;color:#5b7180!important}
  body.course-item-popup .quiz-result .result-grade{position:relative!important;width:120px!important;height:120px!important;margin:0 auto 8px!important;padding:0!important}
  body.course-item-popup .quiz-result .result-grade svg{width:120px!important;height:120px!important;overflow:visible;position:absolute!important;top:0!important;left:0!important;margin:0!important}
  body.course-item-popup .quiz-result .result-grade::before{width:120px!important;height:120px!important;border-width:6px!important;top:0!important;left:0!important;right:auto!important;bottom:auto!important;margin:0!important;box-sizing:border-box!important;position:absolute!important}
  body.course-item-popup .quiz-result .result-grade .result-achieved{position:absolute!important;left:0;right:0;top:34px!important;margin:0!important;font-size:24px!important;line-height:1!important;font-weight:800!important;color:#0f3d52!important;border:0!important;padding:0!important;transform:none!important}
  body.course-item-popup .quiz-result .result-grade .result-require{position:absolute!important;left:0;right:0;top:66px!important;margin:0!important;font-size:11px!important;line-height:1.2!important;color:#6b7f8c!important;transform:none!important}
  body.course-item-popup .quiz-result .result-grade .result-require::before{content:"прохідний ";}
  body.course-item-popup .quiz-result .result-message{display:inline-block!important;width:auto!important;margin:0 auto 10px!important;padding:6px 16px!important;border-radius:999px!important;font-size:14px!important;line-height:1.2!important;font-weight:700!important}
  body.course-item-popup .quiz-result .result-statistic{display:grid!important;grid-template-columns:1fr 1fr!important;gap:6px!important;margin:0 0 10px!important;padding:0!important;list-style:none!important}
  body.course-item-popup .quiz-result .result-statistic-field{display:flex!important;flex-direction:column!important;align-items:flex-start!important;justify-content:center!important;gap:2px!important;margin:0!important;padding:8px 10px!important;border:0!important;border-radius:10px!important;background:#f3f8f9!important;text-align:left!important;min-height:0!important}
  body.course-item-popup .quiz-result .result-statistic-field::before,body.course-item-popup .quiz-result .result-statistic-field::after{display:none!important}
  body.course-item-popup .quiz-result .result-statistic-field span{font-size:12px!important;line-height:1.2!important;color:#5b7180!important;margin:0!important}
  body.course-item-popup .quiz-result .result-statistic-field p{font-size:16px!important;line-height:1.2!important;font-weight:700!important;color:#0f3d52!important;margin:0!important}
  /* «Очки» — головне: на всю ширину і великим */
  body.course-item-popup .quiz-result .result-statistic-field.result-point{grid-column:1/-1;order:-1;flex-direction:row!important;align-items:center!important;justify-content:space-between!important;background:#e7f6f4!important;padding:10px 14px!important}
  body.course-item-popup .quiz-result .result-statistic-field.result-point span{font-size:14px!important;font-weight:700!important;color:#0f3d52!important}
  body.course-item-popup .quiz-result .result-statistic-field.result-point p{font-size:22px!important}
  body.course-item-popup .quiz-result.failed .result-statistic-field.result-point{background:#fdeeee!important}
  /* кнопки під результатом */
  body.course-item-popup .lp-quiz-completed .quiz-buttons,body.course-item-popup .lp-quiz-result-wrap>.quiz-buttons{display:flex!important;flex-wrap:wrap!important;gap:8px!important;margin:0 0 14px!important;justify-content:stretch!important}
  body.course-item-popup .lp-quiz-completed .quiz-buttons .lp-button{flex:1 1 140px!important;margin:0!important;min-height:44px!important;font-size:14px!important;padding:10px 12px!important;border-radius:10px!important;white-space:normal!important}
  /* таблиця «Остання спроба» — не обрізається */
  body.course-item-popup .quiz-attempts{margin:0 0 14px!important}
  body.course-item-popup .quiz-attempts .attempts-heading{font-size:15px!important;margin:0 0 6px!important}
  body.course-item-popup .quiz-attempts .lp-table-wrap{overflow-x:auto!important;-webkit-overflow-scrolling:touch}
  body.course-item-popup .quiz-attempts table{width:100%!important;min-width:0!important;margin:0!important;font-size:12px!important}
  body.course-item-popup .quiz-attempts th,body.course-item-popup .quiz-attempts td{padding:6px 4px!important;font-size:12px!important;line-height:1.25!important;white-space:normal!important;word-break:normal!important}
}

/* ================= ЛИШЕ ВЕРТИКАЛЬНО ================= */
@media (max-width:767px){
  /* на тесті шапка не липка: липкою лишається лише панель таймера */
  html.lm-mhead-on body.course-item-lp_quiz .lm-mhead{position:relative!important;top:auto!important}
  /* відео від краю до краю екрана */
  body.course-item-popup .lmml-video{width:auto!important;max-width:none!important;margin-left:-16px!important;margin-right:-16px!important;--container-widget-width:auto!important}
}

/* ================= ЛИШЕ ГОРИЗОНТАЛЬНО ================= */
@media (orientation:landscape) and (max-height:520px) and (pointer:coarse){
  /* вміст з'їжджав праворуч на ширину схованої бокової панелі */
  html.lm-mhead-on body.course-item-popup #popup-course #popup-content{left:0!important;right:auto!important;margin-left:0!important;width:100%!important;max-width:100%!important;padding-bottom:calc(64px + env(safe-area-inset-bottom,0px))!important}
  html.lm-mhead-on body.course-item-popup #popup-course .wrapper-popup-content-right{width:100%!important;max-width:100%!important;margin-left:0!important}
  html.lm-mhead-on body.course-item-popup #popup-content .elementor-widget-thim-ekits-course-item-data{padding-left:16px!important;padding-right:16px!important}
  /* шапка не липка: на низькому екрані вона забирала третину висоти */
  html.lm-mhead-on body.course-item-popup .lm-mhead{position:relative!important;top:auto!important}
  /* смуга знизу тонша */
  body.course-item-popup .ekit-popup-footer{padding-top:4px!important;padding-bottom:calc(4px + env(safe-area-inset-bottom,0px))!important}
  body.course-item-popup .ekit-popup-footer .thim-ekit-single-course-item__navigation__link a{height:40px!important}
}

/* ================= «Завершити курс», перенесена зі схованої шапки ================= */
.lmml-finish{display:none}
html.lmml-has-finish .lmml-finish{display:block;margin:0 0 14px;padding:14px;border:1px solid #bfe6df;border-radius:16px;background:#e9f8f5;text-align:center}
.lmml-finish__text{margin:0 0 10px;font-size:14px;line-height:1.35;color:#0f3d52;font-weight:600}
.lmml-finish form.form-button-finish-course{display:block!important;margin:0!important;float:none!important;position:static!important}
.lmml-finish .lp-btn-finish-course{display:block!important;width:100%!important;min-height:48px!important;margin:0!important;border:0!important;border-radius:12px!important;background:#0f8f8c!important;color:#fff!important;font-size:16px!important;font-weight:700!important;line-height:1.2!important;padding:12px 16px!important;opacity:1!important;visibility:visible!important}

/* ================= 1.1.0 — панель «Програма» на телефоні ================= */
/* Відкрита: бічна панель на всю висоту зліва, зверху — шапка з кнопкою «Закрити»,
   праворуч затемнення, дотик по ньому теж закриває. */
@media (max-width:767px), (orientation:landscape) and (max-height:520px) and (pointer:coarse){
  html.lm-mhead-on body.course-item-popup.lp-sidebar-toggle__open .elementor-widget-thim-ekits-course-curricilum{position:fixed!important;top:0!important;left:0!important;right:auto!important;bottom:0!important;width:min(88vw,380px)!important;max-width:none!important;height:100vh!important;height:100dvh!important;max-height:none!important;margin:0!important;padding:0!important;transform:none!important;z-index:2147483001!important;background:#fff!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch;box-shadow:8px 0 32px rgba(15,42,61,.22)!important;opacity:1!important;visibility:visible!important;display:block!important}
  html.lm-mhead-on body.course-item-popup.lp-sidebar-toggle__open .elementor-widget-thim-ekits-course-curricilum>.elementor-widget-container{margin:0!important;padding:0 0 calc(24px + env(safe-area-inset-bottom,0px))!important;top:auto!important;transform:none!important;height:auto!important}
  html.lm-mhead-on body.course-item-popup.lp-sidebar-toggle__open .elementor-widget-thim-ekits-course-curricilum .thim-ekit-single-course__curriculum,
  html.lm-mhead-on body.course-item-popup.lp-sidebar-toggle__open .elementor-widget-thim-ekits-course-curricilum .lp-course-curriculum,
  html.lm-mhead-on body.course-item-popup.lp-sidebar-toggle__open .elementor-widget-thim-ekits-course-curricilum .course-curriculum{margin:0!important;padding-top:0!important;top:auto!important;height:auto!important;max-height:none!important;overflow:visible!important}
  /* закрита — не видно і не заважає */
  html.lm-mhead-on body.course-item-popup:not(.lp-sidebar-toggle__open) .elementor-widget-thim-ekits-course-curricilum{visibility:hidden!important;pointer-events:none!important}
  /* шапка панелі */
  .lmml-sb-head{display:none}
  html.lm-mhead-on body.course-item-popup.lp-sidebar-toggle__open .lmml-sb-head{display:flex;align-items:center;justify-content:space-between;gap:10px;position:sticky;top:0;z-index:5;min-height:56px;padding:calc(8px + env(safe-area-inset-top,0px)) 12px 8px 16px;background:#fff;border-bottom:1px solid #e3edf0;box-sizing:border-box}
  .lmml-sb-head__title{font-size:17px;line-height:1.2;font-weight:800;color:#0f3d52}
  html body .lmml-sb-close,html body .lmml-sb-close:hover,html body .lmml-sb-close:focus,html body .lmml-sb-close:active{display:inline-flex!important;align-items:center!important;gap:6px!important;min-height:40px!important;width:auto!important;margin:0!important;padding:0 14px!important;border:1px solid #cfe3e6!important;border-radius:999px!important;background:#f3f8f9!important;color:#0f3d52!important;font-size:15px!important;font-weight:700!important;line-height:1!important;text-transform:none!important;box-shadow:none!important;cursor:pointer;-webkit-tap-highlight-color:transparent}
  html body .lmml-sb-close span{font-size:18px!important;line-height:1!important;color:#0f3d52!important}
  /* затемнення */
  .lmml-sb-backdrop{display:none}
  html.lm-mhead-on body.course-item-popup.lp-sidebar-toggle__open .lmml-sb-backdrop{display:block;position:fixed;inset:0;z-index:2147483000;background:rgba(15,42,61,.45);-webkit-tap-highlight-color:transparent}
}

/* ================= 1.2.0 — відео: оформлення і повний екран при повороті ================= */
.lmml-vfs-exit{display:none!important}
/* Вертикально: відео від краю до краю на темному тлі, під ним підказка «Поверніть телефон» */
@media (max-width:767px){
  body.course-item-popup .lmml-video{background:#0b2233!important;margin-top:4px!important;margin-bottom:0!important}
  body.course-item-popup .lmml-video.lmbsv-outer .lmbsv-wrap{background:#0b2233!important}
  .lmml-vhint{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 -16px 16px;padding:9px 14px;background:#0b2233;color:#bfe9e4;font-size:13px;line-height:1.3;font-weight:600;letter-spacing:.01em;border-top:1px solid rgba(255,255,255,.08)}
  .lmml-vhint svg{flex:0 0 18px;width:18px;height:18px}
}
@media (min-width:768px){ .lmml-vhint{display:none!important} }

/* Горизонтально на телефоні: відео, яке дивились, — на весь екран.
   Ті самі умови, що в плагіні LibraMed Bunny Secure Video (висота до 600 px, сенсорний екран). */
@media (orientation:landscape) and (max-height:600px) and (pointer:coarse){
  .lmml-vhint{display:none!important}
  html:not(.lmml-vfs-off) body.course-item-popup .lmml-video.lmml-vfs{position:fixed!important;inset:0!important;left:0!important;top:0!important;width:100vw!important;max-width:none!important;height:100vh!important;height:100dvh!important;margin:0!important;padding:0!important;z-index:2147483000!important;background:#000!important;transform:none!important}
  html:not(.lmml-vfs-off) body.course-item-popup .lmml-video.lmml-vfs .elementor-widget-container,
  html:not(.lmml-vfs-off) body.course-item-popup .lmml-video.lmml-vfs .elementor-wrapper,
  html:not(.lmml-vfs-off) body.course-item-popup .lmml-video.lmml-vfs .lmbsv-wrap{position:relative!important;width:100%!important;height:100%!important;max-width:none!important;aspect-ratio:auto!important;margin:0!important;padding:0!important;background:#000!important;overflow:hidden!important}
  html:not(.lmml-vfs-off) body.course-item-popup .lmml-video.lmml-vfs iframe,
  html:not(.lmml-vfs-off) body.course-item-popup .lmml-video.lmml-vfs video{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;max-width:none!important;aspect-ratio:auto!important;border:0!important;background:#000}
  /* інші відео в цьому уроці (і всі — після «Згорнути») лишаються на сторінці */
  body.course-item-popup .lmml-video.lmbsv-outer:not(.lmml-vfs),
  html.lmml-vfs-off body.course-item-popup .lmml-video.lmbsv-outer{position:static!important;inset:auto!important;width:100%!important;max-width:calc((100vh - 24px) * 16 / 9)!important;max-width:calc((100dvh - 24px) * 16 / 9)!important;height:auto!important;margin:8px auto!important;z-index:auto!important}
  body.course-item-popup .lmml-video.lmbsv-outer:not(.lmml-vfs) .lmbsv-wrap,
  html.lmml-vfs-off body.course-item-popup .lmml-video.lmbsv-outer .lmbsv-wrap{width:100%!important;height:auto!important;aspect-ratio:16/9!important}
  body.course-item-popup .lmml-video.lmbsv-outer:not(.lmml-vfs) .lmbsv-wrap iframe,
  html.lmml-vfs-off body.course-item-popup .lmml-video.lmbsv-outer .lmbsv-wrap iframe{position:absolute!important;inset:0!important;width:100%!important;height:100%!important}
  body.course-item-popup .lmml-video:not(.lmbsv-outer):not(.lmml-vfs),
  html.lmml-vfs-off body.course-item-popup .lmml-video:not(.lmbsv-outer){width:100%!important;max-width:calc((100vh - 24px) * 16 / 9)!important;max-width:calc((100dvh - 24px) * 16 / 9)!important;margin-left:auto!important;margin-right:auto!important;--container-widget-width:100%!important}
  /* кнопка «Згорнути» (✕) */
  html:not(.lmml-vfs-off) body.course-item-popup .lmml-video.lmml-vfs .lmml-vfs-exit{display:inline-flex!important;align-items:center!important;justify-content:center!important;position:absolute!important;z-index:3!important;top:calc(8px + env(safe-area-inset-top,0px))!important;left:calc(8px + env(safe-area-inset-left,0px))!important;width:36px!important;height:36px!important;min-height:0!important;padding:0!important;margin:0!important;border:1px solid rgba(255,255,255,.3)!important;border-radius:50%!important;background:rgba(11,34,51,.55)!important;color:#fff!important;font-size:16px!important;font-weight:700!important;line-height:1!important;box-shadow:none!important;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);opacity:.75}
  html.lmml-vfs-on:not(.lmml-vfs-off) #lm-consent-manage{display:none!important}
  /* поки відео на весь екран — сторінка під ним не прокручується */
  html.lmml-vfs-on:not(.lmml-vfs-off),html.lmml-vfs-on:not(.lmml-vfs-off) body{overflow:hidden!important}
}
