/* =========================================================
   FAKHIRA RECORD - MOBILE HP PROFESSIONAL FIX
   Fokus: header HP rapi, menu tidak meluber, kalender tetap pas layar.
   Aman: hanya CSS tambahan, tidak mengubah database/config.
   ========================================================= */

html,body{
  max-width:100%;
  overflow-x:hidden;
}

body.public-site main{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

@media (max-width: 860px){
  .site-header{
    position:sticky;
    top:0;
    left:0;
    right:0;
    z-index:9999;
    width:100vw;
    max-width:100vw;
    min-height:72px!important;
    margin:0!important;
    padding:10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left))!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:10px!important;
    border-radius:0!important;
    background:rgba(5,12,25,.92)!important;
    border-bottom:1px solid rgba(0,229,255,.20)!important;
    box-shadow:0 12px 42px rgba(0,0,0,.22)!important;
    backdrop-filter:blur(18px)!important;
    -webkit-backdrop-filter:blur(18px)!important;
  }

  html[data-theme="light"] .site-header{
    background:rgba(255,255,255,.94)!important;
    box-shadow:0 10px 36px rgba(31,45,78,.13)!important;
  }

  .brand{
    flex:1 1 auto!important;
    min-width:0!important;
    max-width:calc(100vw - 86px)!important;
    gap:10px!important;
    overflow:hidden!important;
  }

  .brand img,
  .brand .logo-mark{
    width:44px!important;
    height:44px!important;
    flex:0 0 44px!important;
    border-radius:14px!important;
  }

  .brand > span,
  .brand > div{
    display:block!important;
    min-width:0!important;
    overflow:hidden!important;
  }

  .brand b{
    display:block!important;
    max-width:calc(100vw - 150px)!important;
    font-size:16px!important;
    line-height:1.12!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .brand small{
    display:block!important;
    max-width:calc(100vw - 150px)!important;
    font-size:11px!important;
    line-height:1.22!important;
    margin-top:3px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    opacity:.9;
  }

  .nav-toggle{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    flex:0 0 52px!important;
    width:52px!important;
    height:52px!important;
    min-width:52px!important;
    min-height:52px!important;
    padding:0!important;
    margin:0!important;
    border-radius:17px!important;
    border:1px solid rgba(255,255,255,.12)!important;
    background:linear-gradient(135deg,rgba(255,255,255,.14),rgba(255,255,255,.08))!important;
    color:var(--heading)!important;
    font-size:24px!important;
    line-height:1!important;
    box-shadow:0 12px 30px rgba(0,0,0,.22)!important;
    -webkit-tap-highlight-color:transparent;
  }

  html[data-theme="light"] .nav-toggle{
    border-color:rgba(20,35,65,.12)!important;
    background:linear-gradient(135deg,rgba(255,255,255,.98),rgba(238,246,255,.90))!important;
    box-shadow:0 10px 26px rgba(31,45,78,.13)!important;
  }

  .nav-menu{
    position:fixed!important;
    z-index:10000!important;
    top:78px!important;
    left:max(12px, env(safe-area-inset-left))!important;
    right:max(12px, env(safe-area-inset-right))!important;
    width:auto!important;
    max-width:none!important;
    max-height:calc(100dvh - 96px)!important;
    overflow-y:auto!important;
    display:none!important;
    grid-template-columns:1fr!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:8px!important;
    padding:12px!important;
    border-radius:22px!important;
    background:rgba(5,12,25,.97)!important;
    border:1px solid rgba(0,229,255,.18)!important;
    box-shadow:0 26px 75px rgba(0,0,0,.38)!important;
    backdrop-filter:blur(20px)!important;
    -webkit-backdrop-filter:blur(20px)!important;
  }

  html[data-theme="light"] .nav-menu{
    background:rgba(255,255,255,.98)!important;
    border-color:rgba(20,35,65,.13)!important;
    box-shadow:0 24px 64px rgba(31,45,78,.20)!important;
  }

  .nav-menu.open{
    display:flex!important;
  }

  .nav-menu a,
  .nav-menu .theme-toggle,
  .nav-menu .btn,
  .nav-menu .btn-small{
    width:100%!important;
    min-height:46px!important;
    justify-content:center!important;
    text-align:center!important;
    border-radius:15px!important;
    padding:12px 14px!important;
    margin:0!important;
    font-size:13px!important;
    letter-spacing:.6px!important;
  }

  .nav-menu a{
    display:flex!important;
    align-items:center!important;
    background:rgba(255,255,255,.07)!important;
    border:1px solid rgba(255,255,255,.09)!important;
  }

  html[data-theme="light"] .nav-menu a{
    background:rgba(7,21,42,.045)!important;
    border-color:rgba(20,35,65,.10)!important;
  }

  .nav-menu a:before{display:none!important;}
  .nav-menu .theme-toggle b{display:inline!important;}
}

@media (max-width: 760px){
  .tech-hero,
  .hero,
  .calendar-page,
  .player-wrap,
  .section{
    padding-left:14px!important;
    padding-right:14px!important;
  }

  .calendar-page{
    padding-top:26px!important;
    padding-bottom:36px!important;
  }

  .calendar-page .badge{
    font-size:11px!important;
    padding:7px 10px!important;
  }

  .calendar-page h1,
  .tech-hero h1,
  .hero h1{
    font-size:clamp(30px,9vw,42px)!important;
    line-height:1.04!important;
    letter-spacing:-1.3px!important;
  }

  .calendar-page p,
  .tech-hero p,
  .hero p{
    font-size:14px!important;
    line-height:1.6!important;
  }

  .calendar-tools{
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:10px!important;
    align-items:center!important;
    margin:16px 0 12px!important;
  }

  #calendarTitle{
    grid-column:1 / -1!important;
    order:-1!important;
    margin:0!important;
    text-align:center!important;
    font-size:24px!important;
    line-height:1.18!important;
  }

  .calendar-tools .btn,
  .calendar-tools .btn-soft,
  #prevMonth,
  #nextMonth{
    width:100%!important;
    min-height:48px!important;
    padding:10px 12px!important;
    border-radius:18px!important;
    font-size:13px!important;
  }

  #todayMonth{
    min-height:44px!important;
    padding:10px 16px!important;
    border-radius:16px!important;
    margin-top:4px!important;
  }

  .calendar-legend{
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    margin:12px 0 14px!important;
  }

  .calendar-legend span{
    justify-content:center!important;
    text-align:center!important;
    min-height:38px!important;
    padding:8px 8px!important;
    font-size:10px!important;
    line-height:1.15!important;
    border-radius:14px!important;
  }

  .calendar{
    width:100%!important;
    max-width:100%!important;
    gap:4px!important;
    padding:8px!important;
    border-radius:22px!important;
  }

  .cal-head{
    font-size:10px!important;
    padding:6px 1px!important;
  }

  .cal-day{
    min-height:56px!important;
    padding:6px!important;
    border-radius:12px!important;
  }

  .cal-num{
    font-size:16px!important;
    line-height:1!important;
  }

  .cal-jawa{
    top:5px!important;
    right:5px!important;
    font-size:6.5px!important;
    max-width:34px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .cal-job-badge{
    right:4px!important;
    bottom:4px!important;
    padding:2px 5px!important;
    font-size:6.5px!important;
  }

  .cal-red-label{
    left:4px!important;
    bottom:4px!important;
    padding:2px 5px!important;
    font-size:6px!important;
    max-width:36px!important;
  }

  .cal-day.has-job .cal-red-label{bottom:21px!important;}

  .cal-tooltip{
    width:calc(100vw - 38px)!important;
    max-width:calc(100vw - 38px)!important;
    max-height:250px!important;
    left:50%!important;
    right:auto!important;
    top:50%!important;
    transform:translate(-50%,-50%) scale(.96)!important;
    transform-origin:center!important;
    position:fixed!important;
    border-radius:18px!important;
    z-index:20000!important;
  }

  .cal-day.has-info:hover .cal-tooltip,
  .cal-day.has-info:focus .cal-tooltip,
  .cal-day.show-tooltip .cal-tooltip{
    transform:translate(-50%,-50%) scale(1)!important;
  }

  .player-stage-shell{grid-template-columns:1fr!important;}
}

@media (max-width: 390px){
  .brand img,
  .brand .logo-mark{
    width:40px!important;
    height:40px!important;
    flex-basis:40px!important;
  }
  .brand b{font-size:15px!important;max-width:calc(100vw - 140px)!important;}
  .brand small{font-size:10px!important;max-width:calc(100vw - 140px)!important;}
  .nav-toggle{width:48px!important;height:48px!important;min-width:48px!important;flex-basis:48px!important;}
  .calendar-legend span{font-size:9px!important;}
  .cal-day{min-height:52px!important;padding:5px!important;}
  .cal-num{font-size:15px!important;}
}

/* Admin panel mobile agar header/topbar juga rapi di HP */
@media (max-width: 980px){
  .admin-shell{display:block!important;}
  .sidebar{
    position:fixed!important;
    top:0!important;
    left:0!important;
    bottom:0!important;
    z-index:12000!important;
    width:min(86vw,310px)!important;
    height:100dvh!important;
    transform:translateX(-108%)!important;
    transition:transform .22s ease!important;
    border-radius:0 24px 24px 0!important;
    box-shadow:0 28px 80px rgba(0,0,0,.42)!important;
  }
  .sidebar.open{transform:translateX(0)!important;}
  .admin-main{padding:12px!important;}
  .admin-topbar{
    position:sticky!important;
    top:0!important;
    z-index:1000!important;
    display:grid!important;
    grid-template-columns:auto 1fr!important;
    gap:10px!important;
    align-items:center!important;
    padding:12px!important;
    border-radius:20px!important;
  }
  .sidebar-toggle{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:48px!important;
    height:48px!important;
    padding:0!important;
    flex:0 0 48px!important;
  }
  .admin-topbar h1{font-size:20px!important;line-height:1.15!important;}
  .admin-topbar p{font-size:11px!important;line-height:1.35!important;}
  .top-actions{
    grid-column:1 / -1!important;
    width:100%!important;
    justify-content:space-between!important;
  }
  .user-pill{min-width:0!important;max-width:calc(100vw - 120px)!important;}
  .user-pill b,.user-pill small{max-width:130px!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
}

/* =========================================================
   UPDATE 2 - TOOLTIP KALENDER HP SELALU MASUK LAYAR
   + Hilangkan label RTMP di player live.
   ========================================================= */

/* Hilangkan tulisan RTMP SERVER FAKHIRA pada kotak player */
.fakhira-video-player::before,
.fakhira-video-player:before{
  content:none!important;
  display:none!important;
}

@media (max-width: 760px){
  /* Jangan beri transform pada kotak tanggal saat tooltip aktif,
     supaya position:fixed pada tooltip benar-benar mengikuti layar HP. */
  .cal-day.has-info:hover,
  .cal-day.has-info:focus,
  .cal-day.show-tooltip{
    transform:none!important;
    z-index:999999!important;
  }

  .calendar,
  .cal-day{
    overflow:visible!important;
  }

  /* Tooltip dibuat seperti popup tengah layar HP: selalu terlihat, bisa discroll di dalam popup */
  .cal-tooltip{
    position:fixed!important;
    left:50%!important;
    top:50%!important;
    right:auto!important;
    bottom:auto!important;
    width:calc(100vw - 28px)!important;
    max-width:420px!important;
    min-width:0!important;
    max-height:calc(100dvh - 170px)!important;
    overflow-y:auto!important;
    transform:translate(-50%,-50%) scale(.96)!important;
    transform-origin:center center!important;
    z-index:2147483647!important;
    padding:16px 16px 17px!important;
    border-radius:20px!important;
    -webkit-overflow-scrolling:touch!important;
    box-sizing:border-box!important;
  }

  .cal-day.tip-left .cal-tooltip{
    left:50%!important;
    right:auto!important;
    transform-origin:center center!important;
  }

  .cal-day.has-info:hover .cal-tooltip,
  .cal-day.has-info:focus .cal-tooltip,
  .cal-day.show-tooltip .cal-tooltip,
  .cal-day.tip-left.has-info:hover .cal-tooltip,
  .cal-day.tip-left.has-info:focus .cal-tooltip,
  .cal-day.tip-left.show-tooltip .cal-tooltip{
    opacity:1!important;
    visibility:visible!important;
    transform:translate(-50%,-50%) scale(1)!important;
  }

  .cal-tooltip strong{
    font-size:13px!important;
    line-height:1.25!important;
    padding-right:0!important;
  }

  .cal-tooltip span{
    font-size:12px!important;
    line-height:1.45!important;
    word-break:break-word!important;
    overflow-wrap:anywhere!important;
  }

  .cal-tooltip b{
    font-size:10px!important;
  }

  /* Area kalender diberi ruang supaya popup tidak terasa menabrak konten bawah */
  .calendar-page{
    overflow:visible!important;
  }

  body.public-site main{
    overflow-x:hidden!important;
    overflow-y:visible!important;
  }
}

@media (max-width: 380px){
  .cal-tooltip{
    width:calc(100vw - 18px)!important;
    max-height:calc(100dvh - 150px)!important;
    padding:14px!important;
  }
}

/* =========================================================
   UPDATE 3 - INFO JOB HP SELALU DI TENGAH LAYAR
   Old tooltip kalender disembunyikan di HP. Isi info dipindahkan
   ke popup fixed center agar tidak kepotong kiri/kanan.
   ========================================================= */
@media (max-width: 860px){
  /* Sembunyikan tooltip lama yang menempel di kotak tanggal */
  .calendar .cal-day .cal-tooltip,
  .cal-day.has-info:hover .cal-tooltip,
  .cal-day.has-info:focus .cal-tooltip,
  .cal-day.show-tooltip .cal-tooltip,
  .cal-day.tip-left.has-info:hover .cal-tooltip,
  .cal-day.tip-left.has-info:focus .cal-tooltip,
  .cal-day.tip-left.show-tooltip .cal-tooltip{
    display:none!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }

  .fr-mobile-tooltip-backdrop{
    position:fixed!important;
    inset:0!important;
    z-index:2147483600!important;
    background:rgba(0,0,0,.38)!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    transition:opacity .16s ease, visibility .16s ease!important;
    backdrop-filter:blur(3px)!important;
    -webkit-backdrop-filter:blur(3px)!important;
  }

  .fr-mobile-tooltip-backdrop.is-open{
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }

  .fr-mobile-job-popup{
    position:fixed!important;
    left:50%!important;
    top:50%!important;
    right:auto!important;
    bottom:auto!important;
    z-index:2147483647!important;
    width:calc(100vw - 30px)!important;
    max-width:440px!important;
    min-width:0!important;
    max-height:calc(100dvh - 150px)!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    box-sizing:border-box!important;
    padding:18px 17px 18px!important;
    border-radius:22px!important;
    background:rgba(5,14,30,.98)!important;
    color:#fff!important;
    border:1px solid rgba(0,213,255,.28)!important;
    box-shadow:0 28px 90px rgba(0,0,0,.50),0 0 0 1px rgba(255,255,255,.05) inset!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    transform:translate(-50%,-50%) scale(.96)!important;
    transform-origin:center center!important;
    transition:opacity .16s ease, transform .16s ease, visibility .16s ease!important;
    text-align:left!important;
    white-space:pre-line!important;
  }

  .fr-mobile-job-popup.is-open{
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
    transform:translate(-50%,-50%) scale(1)!important;
  }

  html[data-theme="light"] .fr-mobile-job-popup{
    background:rgba(255,255,255,.98)!important;
    color:#0b1424!important;
    border-color:rgba(0,170,255,.26)!important;
    box-shadow:0 28px 80px rgba(20,35,65,.28)!important;
  }

  .fr-mobile-job-popup .fr-popup-close{
    position:sticky!important;
    top:0!important;
    float:right!important;
    width:38px!important;
    height:38px!important;
    margin:-7px -6px 6px 10px!important;
    border:0!important;
    border-radius:14px!important;
    display:grid!important;
    place-items:center!important;
    background:linear-gradient(135deg,rgba(0,213,255,.22),rgba(255,46,138,.20))!important;
    color:inherit!important;
    font-size:22px!important;
    line-height:1!important;
    font-weight:1000!important;
    cursor:pointer!important;
    -webkit-tap-highlight-color:transparent!important;
  }

  .fr-mobile-job-popup strong{
    display:block!important;
    margin:0 42px 11px 0!important;
    color:inherit!important;
    font-size:15px!important;
    line-height:1.25!important;
    letter-spacing:.3px!important;
    word-break:break-word!important;
    overflow-wrap:anywhere!important;
  }

  .fr-mobile-job-popup span{
    display:block!important;
    color:rgba(255,255,255,.88)!important;
    font-size:13px!important;
    line-height:1.5!important;
    padding-top:10px!important;
    margin-top:10px!important;
    border-top:1px solid rgba(255,255,255,.13)!important;
    word-break:break-word!important;
    overflow-wrap:anywhere!important;
  }

  .fr-mobile-job-popup span:first-of-type{
    border-top:0!important;
    margin-top:0!important;
    padding-top:0!important;
  }

  .fr-mobile-job-popup b{
    display:block!important;
    margin-bottom:5px!important;
    color:#9cebff!important;
    font-size:11px!important;
    line-height:1.25!important;
    letter-spacing:.4px!important;
  }

  html[data-theme="light"] .fr-mobile-job-popup span{
    color:#31435f!important;
    border-top-color:rgba(20,35,65,.12)!important;
  }

  html[data-theme="light"] .fr-mobile-job-popup b{
    color:#057ca5!important;
  }

  /* Supaya popup tidak tertutup header/menu Safari/iPhone */
  body.fr-job-popup-open{
    overflow-x:hidden!important;
  }
}

@media (max-width: 380px){
  .fr-mobile-job-popup{
    width:calc(100vw - 18px)!important;
    max-height:calc(100dvh - 132px)!important;
    padding:15px!important;
    border-radius:19px!important;
  }
  .fr-mobile-job-popup strong{font-size:14px!important;}
  .fr-mobile-job-popup span{font-size:12px!important;}
}
