/* Admin Common Styles & Components */

/* 1. Custom Toggle Switch (iOS Style) - Standard for Admin Approvals */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: #28a745;
    /* Success Green */
}

input:focus+.slider {
    box-shadow: 0 0 1px #28a745;
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* 2. Mobile First Layout Adjustments */
@media (max-width: 768px) {
    .content-wrapper {
        margin-left: 0 !important;
        padding-bottom: 60px;
        /* Space for bottom navigation */
    }

    /* Table column responsiveness */
    .hide-on-mobile {
        display: none !important;
    }
}

/*
   AdminLTE default behavior on small screens is overlay sidebar.
   Requirement: when sidebar opens, content width should shrink (no overlap).
*/
@media (max-width: 991.98px) {

    /* Expanded / opened: push by full sidebar width */
    body.sidebar-open .content-wrapper,
    body.sidebar-open .main-footer,
    body.sidebar-open .main-header,
    body:not(.sidebar-collapse) .content-wrapper,
    body:not(.sidebar-collapse) .main-footer,
    body:not(.sidebar-collapse) .main-header {
        margin-left: 250px !important;
        width: calc(100% - 250px) !important;
    }

    /* Collapsed (sidebar closed): do not push content on small screens */
    body.sidebar-collapse:not(.sidebar-open) .content-wrapper,
    body.sidebar-collapse:not(.sidebar-open) .main-footer,
    body.sidebar-collapse:not(.sidebar-open) .main-header {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Keep wrapper from introducing horizontal scroll when pushed */
    body.sidebar-open,
    body:not(.sidebar-collapse) {
        overflow-x: hidden;
    }
}

/* 3. Bottom Navigation (Mobile Only) - Synced with index.html */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1050;
    padding: 0 10px;
    border-top: 1px solid #eee;
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
}

.nav-item-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none !important;
    background: none !important;
    color: #6c757d;
    gap: 4px;
    padding: 5px 0;
    transition: all 0.2s;
    outline: none !important;
    box-shadow: none !important;
}

.nav-item-btn i {
    font-size: 1.25rem;
}

.nav-item-btn span {
    font-size: 0.7rem;
    font-weight: 500;
}

.nav-item-btn.active {
    color: #007bff;
}

.nav-item-btn.active i {
    transform: translateY(-2px);
}

/* Legacy support for old classes */
.bottom-nav-item {
    display: none;
}

/* 4. Sidebar Dynamic Layout Fixes */
/* Removed conflicting clear: both styles to allow AdminLTE normal layout calculation */

/* 1.1.2.1.1 Full Screen Mode for Attendance */
.full-screen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: #fff;
    overflow: hidden !important;
}

/* 5. Custom Sidebar Navigation Distinction */
.nav-sidebar>.nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-sidebar>.nav-item>.nav-link {
    font-weight: 600 !important;
    color: #f8f9fa !important;
}

.nav-sidebar>.nav-item>.nav-link.active {
    background-color: #007bff !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .24);
    border-bottom: none;
}

.nav-treeview {
    background-color: rgba(0, 0, 0, 0.15);
    /* Darken slightly */
    padding-top: 5px;
    padding-bottom: 5px;
    /* Keep treeview in normal flow (prevents overlap) */
    position: static !important;
    float: none !important;
    overflow: visible !important;
}

/* When a treeview is open, ensure its children are not clipped */
.nav-sidebar .menu-open>.nav-treeview {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
}

/* Allow scrolling inside sidebar when menu is long */
.main-sidebar .sidebar {
    overflow-y: auto;
    /* Brand link height is ~3.5rem in AdminLTE */
    max-height: calc(100vh - 3.5rem);
}

/* Guard rails: keep sidebar items in normal flow */
.nav-sidebar .nav-item {
    float: none !important;
    height: auto !important;
}

.nav-sidebar .nav-link {
    height: auto !important;
    line-height: 1.25 !important;
}

/* Sidebar collapsed: prevent treeview chevrons from overlaying content */
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .nav-sidebar .nav-link p .right {
    display: none !important;
}

.nav-treeview>.nav-item>.nav-link {
    font-weight: 400 !important;
    padding-left: 2.5rem !important;
    /* Indent submenus */
    color: #ced4da !important;
    font-size: 0.95rem;
}

/* 단계별 들여쓰기: 2단계/3단계/4단계 메뉴 구분 */
/* 2단계(기본): .nav-treeview > .nav-item > .nav-link (2.5rem) */
.nav-sidebar .nav-treeview .nav-treeview>.nav-item>.nav-link {
    padding-left: 3.5rem !important;
}

.nav-sidebar .nav-treeview .nav-treeview .nav-treeview>.nav-item>.nav-link {
    padding-left: 4.5rem !important;
}

.nav-sidebar .nav-treeview .nav-treeview .nav-treeview .nav-treeview>.nav-item>.nav-link {
    padding-left: 5.5rem !important;
}

.nav-treeview>.nav-item>.nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-treeview>.nav-item>.nav-link.active {
    color: #ffffff !important;
    background-color: #17a2b8 !important;
    /* 약간 밝은 청록색(info)으로 하위메뉴 선택 강조 */
    font-weight: 600 !important;
}