/* 공용 상단바 — 모든 사용자 페이지 공통 정의.
   페이지별 CSS보다 나중에 로드되므로 이 파일이 최종 기준이다. */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1d23;
    color: #fff;
    flex-shrink: 0;
    min-height: 52px;
    padding: 0 10px;
    gap: 8px;
}

/* 페이지마다 다른 본문 폰트가 헤더로 흘러들지 않도록 고정한다 */
.app-topbar,
.app-topbar *,
.tb-drawer,
.tb-drawer * {
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.tb-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.tb-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.tb-left h1 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.tb-nav {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    background: #fff;
    border-radius: 4px;
    padding: 2px;
    flex: 1;
    min-width: 0;
    max-width: fit-content;
}

.tb-nav::-webkit-scrollbar { display: none; }

.tbn {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}

.tbn:hover { background: #f1f2f4; }

.tbn.is-active {
    background: #ea1b0c;
    color: #fff;
}

.tb-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1.2;
    opacity: 1;
    cursor: auto;
}

.tb-logout {
    padding: 4px 10px;
    border-radius: 3px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s;
}

.tb-logout:hover { background: rgba(255, 255, 255, 0.1); }
/* app-topbar mobile drawer — shared across user pages */

.tb-desktop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 6px;
}

.tb-mobile {
    display: none;
    width: 100%;
}

.tb-mobile-inner {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 0 8px;
}

.tb-mobile-side {
    width: 44px;
    height: 44px;
}

.tb-mobile-logo {
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.tb-mobile-logo .tb-logo {
    width: 28px;
    height: 28px;
}

.tb-hamburger {
    justify-self: end;
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tb-hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.tb-hamburger.is-active .tb-hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.tb-hamburger.is-active .tb-hamburger-line:nth-child(2) {
    opacity: 0;
}

.tb-hamburger.is-active .tb-hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* slide drawer */
.tb-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tb-drawer-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.tb-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    width: min(280px, 85vw);
    height: 100%;
    height: 100dvh;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
}

.tb-drawer.is-open {
    transform: translateX(0);
}

.tb-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #1a1d23;
    color: #fff;
    flex-shrink: 0;
}

.tb-drawer-title {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-drawer-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.tb-drawer-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tb-drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.tb-drawer-link {
    display: block;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #f0f1f3;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.tb-drawer-link:hover {
    background: #f6f7f9;
}

.tb-drawer-link.is-active {
    color: #ea1b0c;
    background: #fef2f2;
    border-left: 3px solid #ea1b0c;
    padding-left: 17px;
}

.tb-drawer-foot {
    flex-shrink: 0;
    padding: 16px;
    border-top: 1px solid #eef0f4;
}

.tb-drawer-logout {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    border-radius: 6px;
    background: #1a1d23;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
}

body.tb-drawer-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .app-topbar {
        padding: 0;
        min-height: 48px;
    }

    .tb-desktop {
        display: none;
    }

    .tb-mobile {
        display: block;
    }
}
