@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai+Looped:wght@300;400;500;600;700&family=Google+Sans:wght@400;500;700&family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.cdnfonts.com/css/google-sans');

/* TH Sarabun New Local Fonts for Print */
@font-face {
    font-family: 'TH Sarabun New';
    src: url('../fonts/TH-Sarabun-New/THSarabunNew.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'TH Sarabun New';
    src: url('../fonts/TH-Sarabun-New/THSarabunNew%20Bold.ttf') format('truetype'),
         url('../fonts/TH-Sarabun-New/THSarabunNew Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'THSarabunNew';
    src: url('../fonts/TH-Sarabun-New/THSarabunNew.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'THSarabunNew';
    src: url('../fonts/TH-Sarabun-New/THSarabunNew%20Bold.ttf') format('truetype'),
         url('../fonts/TH-Sarabun-New/THSarabunNew Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'LINESeedSansTH';
    src: url('../font/LINESeedSansTH_W_Th.woff2') format('woff2');
    font-weight: 100;
    font-style: normal;
}

@font-face {
    font-family: 'LINESeedSansTH';
    src: url('../font/LINESeedSansTH_W_Rg.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'LINESeedSansTH';
    src: url('../font/LINESeedSansTH_W_Bd.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'LINESeedSansTH';
    src: url('../font/LINESeedSansTH_W_XBd.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
}

@font-face {
    font-family: 'LINESeedSansTH';
    src: url('../font/LINESeedSansTH_W_He.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
}

/* Screen Typography: Sarabun */
body, 
h1, h2, h3, h4, h5, h6, 
.main-header, 
.main-sidebar, 
.content-wrapper, 
.register-box, 
.login-box, 
.form-control, 
.btn, 
.badge,
.table,
.card,
.modal-content,
.select2-container,
.dropdown-menu,
input, button, select, textarea {
    font-family: 'Sarabun', 'TH Sarabun New', sans-serif !important;
}

/* Print Typography: TH Sarabun New / Sarabun */
@media print {
    body, 
    h1, h2, h3, h4, h5, h6, 
    .content-wrapper, 
    .card,
    .table,
    table, th, td, tr,
    p, span, div, a, b, strong, i, em,
    * {
        font-family: 'TH Sarabun New', 'THSarabunNew', 'Sarabun', sans-serif !important;
    }
}

/* Submenu indentation inside sidebar (Only when sidebar is expanded) */
body:not(.sidebar-collapse) .nav-sidebar .nav-treeview > .nav-item > .nav-link {
    padding-left: 2.2rem !important;
}

/* Sidebar active state override - Text and icon color change only */
.nav-sidebar .nav-item > .nav-link.active {
    background-color: transparent !important;
    color: #007bff !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.nav-sidebar .nav-item > .nav-link.active > .nav-icon {
    color: #007bff !important;
}

/* Remove gray background from parent menus of submenus (treeview headers) */
.nav-sidebar .has-treeview > .nav-link,
.nav-sidebar .has-treeview.menu-open > .nav-link,
[class*="sidebar-light-"] .nav-sidebar > .nav-item.has-treeview > .nav-link,
[class*="sidebar-light-"] .nav-sidebar > .nav-item.has-treeview.menu-open > .nav-link {
    background-color: transparent !important;
    color: #343a40 !important;
    box-shadow: none !important;
}

.nav-sidebar .has-treeview > .nav-link:hover,
[class*="sidebar-light-"] .nav-sidebar > .nav-item.has-treeview > .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
    color: #212529 !important;
}

#navbar-clock {
    cursor: default !important;
    pointer-events: none;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
}

/* Sticky bottom user card in sidebar */
.sidebar {
    padding-bottom: 70px !important;
    position: relative !important;
}

#sidebar-user-card {
    position: absolute !important;
    bottom: 8px !important;
    left: 8px !important;
    right: 8px !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-radius: 10px !important;
    z-index: 1020 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    overflow: hidden !important;
    transition: background 0.2s !important;
}

#sidebar-user-card:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
}

#sidebar-user-submenu {
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    background-color: rgba(0, 0, 0, 0.04) !important;
}

/* Collapsed sidebar: icon-only mode */
.sidebar-collapse #sidebar-user-card {
    left: 4px !important;
    right: 4px !important;
}
.sidebar-collapse #sidebar-user-toggle span,
.sidebar-collapse #sidebar-user-toggle #sidebar-user-chevron {
    display: none !important;
}
.sidebar-collapse #sidebar-user-toggle {
    justify-content: center !important;
    padding: 10px 0 !important;
}
.sidebar-collapse #sidebar-user-submenu {
    position: absolute !important;
    bottom: 0 !important;
    left: calc(100% + 4px) !important;
    width: 160px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 4px 0 15px rgba(0,0,0,0.3) !important;
}

/* Hide default AdminLTE top navbar logout button */
.navbar-nav.ml-auto a[onclick*="logout-form"],
.navbar-nav.ml-auto a[href*="logout"] {
    display: none !important;
}

/* Navbar Refresh Button */
#navbar-refresh-btn {
    display: flex !important;
    align-items: center !important;
}

#navbar-refresh-btn .nav-link {
    cursor: pointer !important;
    padding: 0.5rem 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    font-size: 1rem !important;
    border-radius: 6px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

#navbar-refresh-btn .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

#navbar-refresh-btn .nav-link:active i {
    transform: rotate(180deg);
}

@media screen and (max-width: 576px) {
    #navbar-clock {
        font-size: 0.85rem !important;
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }
    #navbar-refresh-btn .nav-link {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

/* =========================================================================
   Mobile Viewport & Focus Zoom Prevention (iOS Safari / Mobile Browsers)
   ========================================================================= */
@media screen and (max-width: 768px) {
    /* Prevent iOS Safari from auto-zooming when focusing any form field */
    .form-control,
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* =========================================================================
   Rich Text Choice Content (Pinyin, Ruby, Math Formulas, Sub/Sup)
   ========================================================================= */
.choice-box label p,
.choice-item-box p,
.choice-row .note-editable p,
.choice-item-wrong p,
.choice-item-correct p {
    margin-bottom: 0 !important;
    display: inline;
}

ruby {
    font-size: 1.15em;
    line-height: 1.8;
}

rt {
    font-size: 0.65em;
    font-weight: normal;
    color: #495057;
}

sub, sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}
sup {
    top: -0.5em;
}
sub {
    bottom: -0.25em;
}


