/* Fixed Navbar */
.navbar, .navbar-premium {
    position: fixed !important;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}
/* Bootstrap sticky-top: iOS 노치 아래로 밀어내기 */
.sticky-top {
    top: env(safe-area-inset-top, 0px) !important;
}
body {
    padding-top: calc(75px + env(safe-area-inset-top, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Sidebar Navigation Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px; /* Hidden by default */
    width: 280px;
    height: 100%;
    background: #fff;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    z-index: 2000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 14px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-header .user-name {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 2px;
    line-height: 1.3;
}

.sidebar-header .user-email {
    font-size: 0.85rem;
    opacity: 0.8;
    line-height: 1.3;
}

.sidebar-chips {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.sidebar-chips .sb-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}
.sidebar-chips .sb-chip i {
    font-size: 0.78rem;
    opacity: 0.95;
}
.sidebar-chips .sb-chip strong {
    font-weight: 800;
}

.sidebar-menu {
    padding: 20px 10px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #2d3436;
    text-decoration: none !important;
    font-weight: 700;
    border-radius: 15px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.menu-item i {
    width: 25px;
    margin-right: 15px;
    font-size: 1.1rem;
    color: #b2bec3;
    transition: all 0.2s;
}

.menu-item:hover {
    background: #f1f4f9;
    color: #667eea;
}

.menu-item:hover i {
    color: #667eea;
    transform: scale(1.1);
}

.menu-item.active {
    background: #eef2ff;
    color: #667eea;
}

.menu-item.active i {
    color: #667eea;
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid #f1f4f9;
}

.btn-logout-side {
    color: #eb4d4b;
    font-weight: 800;
    font-size: 0.95rem;
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    display: none;
    backdrop-filter: blur(3px);
}

.sidebar-overlay.active {
    display: block;
}

/* Hamburger Toggle Button */
.hamburger-toggle {
    width: 45px;
    height: 45px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: none;
    transition: all 0.2s;
}

.hamburger-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.12);
}

.hamburger-toggle i {
    font-size: 1.25rem;
    color: #2d3436;
}

/* Floating Back Button */
.floating-back-btn {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    transition: all 0.2s;
}
.floating-back-btn:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}
.floating-back-btn i {
    font-size: 1.1rem;
    color: #2d3436;
}

/* ─── 모바일 하단 탭 바 (5개 탭, 768px 이하 전용) ─────────── */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #edf2f7;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
    z-index: 1500;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 4px 10px;
    color: #94a3b8;
    text-decoration: none !important;
    font-size: 0.7rem;
    font-weight: 700;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: color 0.15s;
    min-width: 0;
}
.bottom-nav .bn-item i {
    font-size: 1.2rem;
    line-height: 1;
}
.bottom-nav .bn-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.bottom-nav .bn-item.active { color: #667eea; }
.bottom-nav .bn-item.active i { color: #667eea; }
.bottom-nav .bn-item:active { background: #f9fafb; }

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    /* 본문 끝이 하단 탭에 가려지지 않게 패딩 보강 */
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
    /* 좌하단 뒤로가기 FAB 을 탭 바 위로 띄우기 */
    .floating-back-btn { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
    /* 사이드바 하단 로그아웃 버튼이 탭 바에 가려지지 않게 사이드바 내부 패딩 보강 */
    .sidebar { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}
