/* 메인(index)에서 상단 네비 포함 시 히어로가 가려지지 않도록 */
body.index-with-navbar .hero-section {
    padding-top: calc(55px + max(2rem, env(safe-area-inset-top)));
}

/* 네브바 통합 스타일 (2단 레이아웃 + Aero Glass) */
.navbar {
    background: rgba(30, 58, 138, 0.85) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 2000;
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s ease, box-shadow 0.2s ease;
    transform-origin: top;
}

.navbar-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between; /* 기존 center에서 space-between으로 변경 */
    align-items: center;
    width: 100%;
    position: relative;
    overflow: visible;
}

/* 1행: 메뉴 바 */
.navbar-row.primary {
    height: 55px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow: visible;
}

.navbar-logo {
    color: white !important;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.navbar-logo i {
    color: #60a5fa;
    font-size: 1.2rem;
}

/* 1행 왼쪽 그룹: 토글 + 로고 + 글로벌 필터 */
.navbar-left-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.navbar-global-filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.navbar-global-filter-form .filter-item select {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
    height: 34px;
}

.navbar-global-filter-form .filter-item select:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(96, 165, 250, 0.5);
}

.navbar-menu {
    display: flex;
    list-style: none;
    list-style-type: none;
    list-style-image: none;
    margin: 0 20px;
    padding: 0;
    padding-inline-start: 0;
    gap: 5px;
    /* flex: 1; 을 필요시 사용하여 중앙으로 밀어낼 수 있음 */
}

/* flex ul의 li에도 마커 제거(일부 브라우저에서 시스템 관리 등 맨끝 항목 왼쪽에 검은 점 노출 방지) */
.navbar-menu > li {
    list-style: none;
    list-style-type: none;
}

.navbar-menu > li::marker {
    content: none;
}

.navbar-menu li a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
    padding: 8px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.navbar-menu li a:hover, .navbar-menu li.active a {
    background: rgba(255, 255, 255, 0.15);
    color: white !important;
}

/* 2행: 필터 바 */
.navbar-row.secondary {
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

/* 데스크탑 기본 노출 */
@media (min-width: 901px) {
    .navbar-row.secondary {
        height: 60px;
        opacity: 1;
    }
}

/* 모바일 필터 토글 */
@media (max-width: 900px) {
    .navbar-row.secondary, .navbar-row.tertiary {
        height: 0;
        opacity: 0;
        visibility: hidden;
    }
    .navbar-row.secondary.active, .navbar-row.tertiary.active {
        height: auto;
        opacity: 1;
        visibility: visible;
        padding: 10px 0;
    }
}

.navbar-filter-form {
    display: flex;
    justify-content: center; /* 필터 중앙 정렬 */
    align-items: center;
    gap: 15px;
    width: 100%;
}

.filter-item select {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 1.05rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 180px;
}

.filter-item select:hover {
    background: rgba(255, 255, 255, 0.2);
}

.filter-item select option {
    background: #1e3a8a;
    color: white;
}

/* 3행: 액션 및 검색 바 */
.navbar-row.tertiary {
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 50px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

@media (min-width: 901px) {
    .navbar-row.tertiary {
        height: auto;
        padding: 8px 0;
    }
}

.tertiary-container {
    display: flex;
    justify-content: center; /* 액션 바 중앙 정렬 */
    align-items: center;
    width: 100%;
    gap: 30px;
}

/* 액션 버튼 그룹 */
.navbar-actions-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 네브바 전용 버튼 스타일 (텍스트 포함 타원형 스타일) */
.navbar-actions-group .btn {
    padding: 0 16px; /* 좌우 여백 확보 */
    height: 38px;
    border-radius: 20px; /* 타원형(Pill)으로 변경 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    transition: all 0.3s;
    box-shadow: none;
    text-decoration: none !important; /* 밑줄 제거 */
}

.navbar-actions-group .btn i {
    font-size: 1.1rem;
    margin: 0;
}

.navbar-actions-group .btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: #60a5fa !important;
    transform: translateY(-2px);
}

.navbar-actions-group .btn span {
    display: inline !important; /* 텍스트 다시 노출 */
    font-size: 0.8rem;
    margin-left: 6px;
    font-weight: 600;
}

/* 검색 필통(Pill) 스타일 (네브바용) */
.navbar-search-pill {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2px 2px 2px 15px;
    width: 320px;
    transition: all 0.3s;
}

.navbar-search-pill:focus-within {
    background: rgba(255, 255, 255, 0.2);
    border-color: #60a5fa;
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.navbar-search-pill input {
    background: transparent;
    border: none;
    color: white;
    font-size: 0.85rem;
    width: 100%;
    outline: none;
}

/* 본문 타이틀 영역 내 검색창 스타일 (밝은 배경용 - 명확한 테두리 강조) */
.card-container .title .navbar-search-pill {
    background: #fff !important;
    border: 2px solid #3b82f6 !important; /* 더 선명한 파란색 테두리 */
    width: 450px !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1) !important;
}

.card-container .title .navbar-search-pill input {
    color: #1e293b !important;
}

.card-container .title .navbar-search-pill input::placeholder {
    color: #94a3b8 !important;
}

.card-container .title .navbar-search-pill .btn-search,
.card-container .title .navbar-search-pill .btn-camera {
    color: #3b82f6 !important;
}

.card-container .title .navbar-search-pill:focus-within {
    border-color: #2563eb !important;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.2) !important;
}

.navbar-search-pill input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.navbar-search-pill .btn-search, .navbar-search-pill .btn-camera {
    background: transparent;
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.navbar-search-pill .btn-camera {
    color: #10b981;
}

.navbar-search-pill .btn-search:hover, .navbar-search-pill .btn-camera:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 사용자 정보 및 우측 메뉴 */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.navbar-user-info {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-filter-toggle, .navbar-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #60a5fa !important; /* 아이콘 색상 통일 */
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-user-info i {
    color: #60a5fa;
    font-size: 1.2rem;
}

/* 데스크톱: 우측 로그아웃 아이콘 */
a.navbar-logout-desktop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* 모바일 계정 드롭다운 — 데스크톱에서 숨김 */
.navbar-account-mobile {
    display: none;
    position: relative;
}

.navbar-account-mobile__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    color: #93c5fd !important;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    transition: background 0.2s, border-color 0.2s;
}

.navbar-account-mobile__btn:hover,
.navbar-account-mobile__btn:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(96, 165, 250, 0.5);
    outline: none;
}

.navbar-account-mobile__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    max-width: min(92vw, 280px);
    max-height: min(70dvh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: rgba(30, 58, 138, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    z-index: 3500;
}

.navbar-account-mobile__panel[hidden] {
    display: none !important;
}

.navbar-account-mobile__user {
    font-size: 0.92rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    padding: 6px 4px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 10px;
    word-break: break-all;
}

.navbar-account-mobile__logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fecaca !important;
    text-decoration: none !important;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.25);
    transition: background 0.2s;
}

.navbar-account-mobile__logout:hover {
    background: rgba(248, 113, 113, 0.22);
    color: #fee2e2 !important;
}

@media (min-width: 901px) {
    .navbar-account-mobile {
        display: none !important;
    }
    .navbar-user-info--desktop {
        display: flex;
    }
    a.navbar-logout-desktop {
        display: inline-flex;
    }
}

.logout-link i {
    color: #fca5a5 !important; /* 로그아웃은 유지하되 크기 최적화 */
    font-size: 1.2rem;
}

@media (max-width: 900px) {
    /* 모바일: 지역·학교 셀렉트+우측 묶음이 한 행에서 넘치지 않도록 왼쪽 묶음 수축·select min-width 완화 */
    .navbar {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .navbar-row.primary {
        min-width: 0;
        width: 100%;
    }
    .navbar-container {
        min-width: 0;
        max-width: 100% !important;
    }
    .navbar-left-group {
        flex: 1 1 auto;
        min-width: 0;
        flex-shrink: 1;
        gap: 8px;
    }
    /* 모바일: 로고(아이콘·I-NET/IITMS 문구) 전체 숨김 — 햄버거·필터·우측만 */
    .navbar-logo {
        display: none !important;
    }
    .navbar-global-filter-form {
        flex: 1 1 auto;
        min-width: 0;
        gap: 6px;
    }
    .navbar-global-filter-form .filter-item {
        min-width: 0;
        flex: 1 1 0;
    }
    .navbar-global-filter-form .filter-item select {
        min-width: 0 !important;
        max-width: 100%;
        width: 100%;
    }
    .navbar-right {
        flex-shrink: 0;
    }
    .navbar-user-info--desktop,
    a.navbar-logout-desktop {
        display: none !important;
    }
    .navbar-account-mobile {
        display: block;
    }
    .navbar-filter-toggle, .navbar-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .navbar-menu {
        position: absolute;
        top: 55px; /* primary row 높이 */
        left: 0;
        width: 100%;
        background: rgba(30, 58, 138, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        gap: 0;
        margin: 0;
        height: 0;
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        overflow: hidden;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s, max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }
    .navbar-menu.active {
        height: auto;
        max-height: min(100dvh - 55px, 85dvh);
        opacity: 1;
        visibility: visible;
        padding: 10px 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
    .navbar-menu li {
        width: 100%;
        list-style: none;
        list-style-type: none;
    }

    .navbar-menu li::marker {
        content: none;
    }
    .navbar-menu li a {
        padding: 12px 25px;
        border-radius: 0;
        width: 100%;
        font-size: 1rem;
    }
    .navbar-menu li.has-dropdown .dropdown-menu {
        position: static;
        width: 100%;
        background: rgba(255, 255, 255, 0.05);
        border: none;
        box-shadow: none;
        padding-left: 20px;
        max-height: min(55dvh, 420px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
    .navbar-menu li.has-dropdown:hover .dropdown-menu {
        display: block;
    }
    .navbar-filter-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .tertiary-container {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }
    .navbar-search-pill {
        width: 100%;
    }
    .navbar-actions-group {
        justify-content: center;
    }
}

.logout-link {
    color: #fca5a5 !important;
    font-size: 1.1rem;
    text-decoration: none;
}

/* 시스템 관리 드롭다운 하단 로그아웃 */
.dropdown-menu a.navbar-dropdown-logout {
    color: #fca5a5 !important;
    font-size: 0.85rem;
}

.dropdown-menu a.navbar-dropdown-logout:hover {
    color: #fecaca !important;
    background: rgba(248, 113, 113, 0.15) !important;
}

.dropdown-menu a.navbar-dropdown-logout i {
    color: inherit !important;
    font-size: 0.85rem;
}

/* 드롭다운 */
.has-dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1e3a8a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    min-width: 180px;
    margin: 0;
    padding: 8px 0;
    padding-inline-start: 0;
    list-style: none;
    list-style-type: none;
    z-index: 3000;
}

.dropdown-menu > li {
    list-style: none;
    list-style-type: none;
}

.dropdown-menu > li::marker {
    content: none;
}
.has-dropdown:hover .dropdown-menu { display: block; }

/* 정렬 아이콘 시인성 개선 (노란색) */
.device-table th i.fa-sort-up,
.device-table th i.fa-sort-down {
    color: #fcd34d !important;
    opacity: 1 !important;
}

.device-table th i.fa-sort {
    color: rgba(255, 255, 255, 0.4);
}

/* 테이블 모드에서의 필터 바 수동 노출 설정 */
.navbar-row.secondary.table-mode-filter {
    display: none; 
}

@media (min-width: 901px) {
    .navbar-row.secondary.table-mode-filter.show-manual {
        display: flex !important;
        height: 50px !important;
        opacity: 1 !important;
    }
}
.dropdown-menu li.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}
.dropdown-menu li a { border-radius: 0; font-size: 0.85rem; }