/*
 * Digitera V4399
 * Mobile-only polish for sponsor credit + teacher logout safe area.
 * Desktop >= 768px remains untouched.
 */
@media (max-width: 767.98px) {
  /* ---------------------------------------------------------
   * PUBLIC FOOTER SPONSOR — compact, no oversized image
   * --------------------------------------------------------- */
  body.digitera-mobile-v4398 .footer .footer-bottom{
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    gap:9px!important;
    padding-bottom:16px!important;
  }

  body.digitera-mobile-v4398 .digitera-footer-sponsor{
    width:100%!important;
    max-width:100%!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:6px!important;
    margin:4px 0 0!important;
    padding:0!important;
    text-align:center!important;
    overflow:visible!important;
  }

  body.digitera-mobile-v4398 .digitera-footer-sponsor-label{
    display:block!important;
    width:100%!important;
    margin:0!important;
    color:#9a94a7!important;
    font-size:10px!important;
    font-weight:600!important;
    line-height:1.2!important;
    text-align:center!important;
  }

  body.digitera-mobile-v4398 .digitera-footer-sponsor-brand{
    width:auto!important;
    max-width:min(210px,75vw)!important;
    min-height:54px!important;
    display:inline-flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:9px!important;
    padding:5px 10px 5px 6px!important;
    margin:0 auto!important;
    border:1px solid rgba(100,73,164,.10)!important;
    border-radius:15px!important;
    background:#fff!important;
    box-shadow:0 8px 20px rgba(52,33,94,.07)!important;
    text-decoration:none!important;
    overflow:hidden!important;
  }

  body.digitera-mobile-v4398 .digitera-footer-sponsor-logo{
    display:block!important;
    width:46px!important;
    height:46px!important;
    min-width:46px!important;
    max-width:46px!important;
    max-height:46px!important;
    aspect-ratio:1/1!important;
    object-fit:contain!important;
    object-position:center!important;
    padding:3px!important;
    margin:0!important;
    border-radius:12px!important;
    background:#f7f5fc!important;
    box-shadow:none!important;
  }

  body.digitera-mobile-v4398 .digitera-footer-sponsor-brand strong{
    display:block!important;
    min-width:0!important;
    max-width:128px!important;
    margin:0!important;
    color:#514963!important;
    font-size:11px!important;
    font-weight:800!important;
    line-height:1.25!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    text-align:left!important;
  }

  /* If a sponsor has only a logo and no visible text, keep the card tiny. */
  body.digitera-mobile-v4398 .digitera-footer-sponsor-brand:has(.digitera-footer-sponsor-logo):not(:has(strong:not(:empty))){
    padding:5px!important;
    max-width:58px!important;
  }

  /* ---------------------------------------------------------
   * TEACHER — bottom navigation must never cover logout/actions
   * --------------------------------------------------------- */
  body.digitera-mobile-v4398.role-teacher{
    --dm-teacher-dock-clearance:calc(102px + max(12px, env(safe-area-inset-bottom)));
  }

  /* Real scroll clearance for buttons/actions at the end of a teacher page. */
  body.digitera-mobile-v4398.role-teacher .teacher-app-stage > main,
  body.digitera-mobile-v4398.role-teacher .teacher-app-stage main{
    padding-bottom:var(--dm-teacher-dock-clearance)!important;
    scroll-padding-bottom:var(--dm-teacher-dock-clearance)!important;
  }

  body.digitera-mobile-v4398.role-teacher .teacher-app-footer{
    position:relative!important;
    z-index:1!important;
    margin-bottom:var(--dm-teacher-dock-clearance)!important;
    padding-bottom:18px!important;
  }

  /* Sidebar footer contains the actual Keluar button. Keep it above the dock. */
  body.digitera-mobile-v4398.role-teacher .teacher-sidebar{
    padding-bottom:0!important;
    overflow:hidden!important;
  }

  body.digitera-mobile-v4398.role-teacher .teacher-sidebar nav,
  body.digitera-mobile-v4398.role-teacher .teacher-sidebar .teacher-sidebar-nav{
    padding-bottom:24px!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
  }

  body.digitera-mobile-v4398.role-teacher .teacher-sidebar-user{
    position:relative!important;
    z-index:4!important;
    flex:0 0 auto!important;
    margin-bottom:var(--dm-teacher-dock-clearance)!important;
    padding:10px 12px!important;
    border-top:1px solid rgba(79,54,132,.09)!important;
    background:rgba(255,255,255,.98)!important;
    box-shadow:0 -8px 22px rgba(46,27,91,.06)!important;
  }

  body.digitera-mobile-v4398.role-teacher .teacher-side-logout{
    width:44px!important;
    height:44px!important;
    min-width:44px!important;
    min-height:44px!important;
    display:grid!important;
    place-items:center!important;
    border-radius:14px!important;
    background:#fff1f4!important;
    color:#d53858!important;
    border:1px solid #ffd8e0!important;
    box-shadow:0 7px 16px rgba(205,50,82,.10)!important;
  }

  body.digitera-mobile-v4398.role-teacher .teacher-side-logout svg{
    width:21px!important;
    height:21px!important;
  }

  /* Generic logout/action buttons at the bottom of teacher pages also remain clickable. */
  body.digitera-mobile-v4398.role-teacher main a[href$="logout.php"],
  body.digitera-mobile-v4398.role-teacher main a[href*="logout.php?"],
  body.digitera-mobile-v4398.role-teacher main button[name="logout"]{
    position:relative!important;
    z-index:3!important;
  }

  /* Chat/FABs must also clear the dock rather than collide with it. */
  body.digitera-mobile-v4398.role-teacher .live-chat-fab,
  body.digitera-mobile-v4398.role-teacher [class*="chat-fab"]{
    bottom:calc(92px + max(12px, env(safe-area-inset-bottom)))!important;
  }
}
