/**
 * 통합 네비게이션 스타일
 * Navigation Styles
 */

/* ==========================================================================
   Main Navigation
   ========================================================================== */
.divide {
    width: 1px;
    height: 24px;
    background: var(--gray300);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #E0E0E0;
    padding:0 48px;
    background: #fff;
    height:65px;

}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-left .org-badge {
    text-indent:-999em;
    width: 147px;
    height: 35px;
    background:url('/assets/imgs/common/logo.svg') center / 100% no-repeat;
    display: block;

}

.nav-left .room_name {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray900);
    padding-top: 5px;
}

.nav-center {
    display: flex;
    gap: 48px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
    align-items: flex-end;
}

.nav-link {
    font-size: 18px;
    font-weight: 600;
    color:var(--gray900);
    height: 100%;
    position: relative;
    padding:0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}


.nav-link.active {
    color:#007FF5;
}

/* ==========================================================================
   Dropdown Menu
   ========================================================================== */
.nav-dropdown {
    position: relative;
    cursor: pointer;
    height: 100%;
}

.nav-dropdown .dropdown-menu a {
    display: flex;
    align-items: center;
    gap:6px;
    padding:18px 24px;
    position: relative;
}
.nav-dropdown .dropdown-menu a:after {
    content:'';
    position: absolute;
    left:24px;
    bottom:0;
    width: calc(100% - 48px);
    background: var(--gray300);
    height: 1px;
}

.nav-dropdown .dropdown-menu a:last-child:after {
    display: none;
}
.nav-dropdown .dropdown-menu a .menu-icon {
    display: flex;
}



.nav-dropdown .dropdown-toggle {
    cursor: pointer;
    user-select: none;
}
.nav-dropdown .dropdown-toggle:after {
    display: none;
}

.nav-dropdown .dropdown-toggle .rpd_icon {
    margin-left: 2px;
    vertical-align: top;
    font-size: 13px;
    border:none !important;
    width: 16px;
    height: 16px;
    display: inline-block;
    background-size:16px;
    transition:.3s all;
}

.nav-link.dropdown-toggle:hover  .rpd_icon {
    transform:rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% - 3px);
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    margin-top: 0;
    animation: fadeIn 0.2s ease;
    pointer-events: auto;
    padding: 0;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-dropdown:hover .dropdown-menu,
.user-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
    position: relative;
    z-index: 1001;
    cursor: pointer;
    pointer-events: auto;
}

.dropdown-menu a .rpd_icon {
    width: 20px;
    height: 20px;
    background-size: 20px;
}

.dropdown-menu a span {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray900);
}

.dropdown-menu a:hover {
    background: var(--blue50);
}

.dropdown-menu a:active {
    background: #e8e8e8;
}

/* ==========================================================================
   User Menu
   ========================================================================== */
.nav-right {
    display: inline-flex;
    align-items:center;
    gap:16px;
}
.alarm_count {display: flex; align-items: center; gap:2px;}
.alarm_count .number {background: var(--red500); border-radius:50px; min-width:18px; text-align: center; padding:3px 4px; line-height: 1; font-size: 12px; font-weight: 600; color:#fff; }
.alarm_count .rpd_icon {width: 20px; height: 20px; background-size:20px auto;}


.user-dropdown {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    border: 1px solid var(--blue500);
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--blue500);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
    font-weight: 500;
}

.user-btn .dropdown-arrow {
    display: flex;
}
.user-btn .dropdown-arrow .rpd_icon {
    width: 14px;
    height: 14px;
    background-size:14px auto;
}


.user-avatar {
    font-size: 18px;
}

.dropdown-arrow {
    font-size: 14px;
    transition: transform 0.3s;
}

.user-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.user-menu {
    right: 0;
    left: auto;
    min-width: 240px;
    overflow: hidden;
}

.user-info {
    padding: 15px 20px;
    background: var(--blue500);
    color: var(--white);
}

.user-name-full {
    font-weight: 600;
    font-size: 18px;
    color: var(--white);
}

.user-role {
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
    color: var(--blue50);
}

.user-menu hr {
    margin: 0;
    border: none;
    border-top: 1px solid #e9ecef;
}

.user-menu .menu-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.logout-link {
    color: #e74c3c !important;
}

.logout-link:hover {
    background: #fee !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */


@media (max-width: 1100px) {
    .main-nav {padding:0 20px; height:auto;}
    .nav-center { display: none;}
    .nav-link { font-size: 14px;}
    .nav-dropdown .dropdown-toggle .rpd_icon {margin-top: 2px;}
}
@media (max-width: 768px) {
    .main-nav {
        flex-wrap: wrap;
        padding: 14px 24px;
        gap:5px;
    }

    .nav-left {
        padding-top: 0;
        display: flex;
        align-items: center;
    }
    .nav-left .org-badge {
        width: 118px;
        height: 28px;
    }

    .nav-center {
        padding-top: 10px;
        gap:13px;

    }

    .nav-link {
        font-size: 13px;
        padding:0 0 4px 0;
        height: auto;
    }
    .nav-link.active:after {
        border-bottom-width:2px;
    }

    .nav-right {
        padding-top: 0;
        gap:8px;
    }

    .dropdown-menu a .rpd_icon {
        width: 16px;
        height: 16px;
        background-size: 16px;
    }

    .dropdown-menu a span {
        font-size: 14px;
    }
}



/* ==========================================================================
   App Tab Navigation (하단 탭 네비게이션)
   ========================================================================== */
.app-tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    border-top: 1px solid #e1e8ed;
}

.app-tab-nav .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #666;
    flex: 1;
    padding: 8px 4px;
    transition: all 0.3s ease;
    position: relative;
    gap: 4px;
}

.app-tab-nav .tab-item:hover {
    text-decoration: none;
    color: #4a90d9;
}

.app-tab-nav .tab-item.active {
    color: #4a90d9;
    font-weight: 600;
}

.app-tab-nav .tab-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 3px;
    background: linear-gradient(135deg, #4a90d9 0%, #5ba3e0 100%);
    border-radius: 0 0 3px 3px;
}

.app-tab-nav .tab-icon {
    font-size: 24px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.app-tab-nav .tab-item.active .tab-icon {
    transform: scale(1.1);
}

.app-tab-nav .tab-label {
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

/* 앱 환경에서는 메인 컨텐츠에 하단 패딩 추가 (탭 바 높이만큼) */
body.app-platform {
    padding-bottom: 70px;
}

/* 앱 환경에서는 웹 네비게이션 숨김 */
body.app-platform .main-nav {
    display: none;
}

/* 반응형 - 탭이 많을 경우 */
@media (max-width: 480px) {
    .app-tab-nav .tab-icon {
        font-size: 22px;
    }

    .app-tab-nav .tab-label {
        font-size: 10px;
        max-width: 60px;
    }

    .app-tab-nav .tab-item {
        padding: 6px 2px;
    }
}

/* 아이폰 노치 대응 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .app-tab-nav {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
}
