/* ==========================================================
   방콕PC — 계정 네비 (헤더 퀵 링크 + 유저 드롭다운)
   includes/header.php에서 항상 로드. main.css/subpages.css와
   동일한 토큰 alias를 가정한다(이 두 파일에서 :root에 정의됨).
   ========================================================== */

/* Public top-level menu normalization. Loaded after main/subpage CSS. */
.site-header .nav-center {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.site-header .nav-center > .nav-link-direct,
.site-header .nav-center > .nav-item > .nav-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 0;
    color: var(--text-mute);
    background: transparent;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0;
}

.site-header .nav-center > .nav-item > .nav-trigger {
    gap: 6px;
}

.site-header .nav-center > .nav-link-direct:hover,
.site-header .nav-center > .nav-link-direct.is-current,
.site-header .nav-center > .nav-item:hover > .nav-trigger,
.site-header .nav-center > .nav-item.is-open > .nav-trigger,
.site-header .nav-center > .nav-item.is-current > .nav-trigger {
    color: var(--text);
    background: transparent;
}

.site-header .nav-center > .nav-link-direct.is-current,
.site-header .nav-center > .nav-item.is-current > .nav-trigger {
    color: var(--accent);
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--accent);
}

/* 헤더 우측 퀵 링크 — legacy helper */
.nav-quick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-1);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    transition: color .15s, background .15s, border-color .15s, transform .12s var(--ease);
}
.nav-quick i { font-size: 14px; color: var(--text-mute); transition: color .15s; }
.nav-quick:hover {
    color: var(--text);
    border-color: var(--line-strong);
    background: var(--bg-2);
    transform: translateY(-1px);
}
.nav-quick:hover i { color: var(--accent); }
.nav-quick.is-active {
    color: var(--accent);
    border-color: rgba(138, 92, 255, 0.4);
    background: var(--accent-soft);
}
.nav-quick.is-active i { color: var(--accent); }

.nav-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    color: #a57612;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(138, 92, 255, .24), rgba(44, 141, 255, .16));
    border: 1px solid rgba(138, 92, 255, .42);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
    transition: transform .12s var(--ease), border-color .15s, background .15s;
}
.nav-time-badge i {
    color: var(--accent);
    font-size: 14px;
}
.nav-time-badge small {
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 600;
}
.nav-time-badge:hover {
    color: #151525;
    border-color: rgba(138, 92, 255, .7);
    transform: translateY(-1px);
}

.nav-franchise {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    color: #a57412;
    background: linear-gradient(135deg, rgba(255, 171, 51, 0.22), rgba(255, 120, 60, 0.18));
    border: 1px solid rgba(255, 184, 74, 0.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
    transition: transform .12s var(--ease), border-color .15s, background .15s, color .15s;
}
.nav-franchise i { font-size: 14px; color: #a57312; }
.nav-franchise:hover {
    color: #151525;
    border-color: rgba(255, 210, 120, 0.7);
    background: linear-gradient(135deg, rgba(255, 176, 64, 0.28), rgba(255, 128, 64, 0.2));
    transform: translateY(-1px);
}
.nav-franchise.is-active {
    color: #151525;
    border-color: rgba(255, 220, 148, 0.92);
    background: linear-gradient(135deg, rgba(255, 189, 89, 0.34), rgba(255, 143, 68, 0.24));
}

/* 유저 버튼 + 드롭다운 (.nav-item hover 규칙을 그대로 재활용) */
.nav-account { position: relative; }

.nav-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s, background .15s;
}
.nav-account:hover .nav-user,
.nav-account.is-open .nav-user {
    border-color: var(--line-strong);
    background: var(--bg-2);
}

.nav-user-caret {
    font-size: 11px;
    opacity: 0.6;
    transition: transform .2s var(--ease);
}
.nav-account:hover .nav-user-caret,
.nav-account.is-open .nav-user-caret {
    transform: rotate(180deg);
}

/* 드롭다운 본체 */
.nav-account-menu {
    /* .nav-menu가 갖는 show/hide 트랜지션과 위치 규칙을 베이스로,
       우측 정렬 + 폭만 덮어쓴다. */
    left: auto !important;
    right: 0;
    min-width: 220px;
    padding: 6px;
}

.nav-account-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 9px 12px !important;
    color: var(--text-mute);
    font-size: 13.5px;
    border-radius: 6px;
    transition: color .15s, background .15s;
    text-decoration: none;
}
.nav-account-item i {
    font-size: 14px;
    width: 16px;
    text-align: center;
    color: var(--text-faint);
    transition: color .15s;
}
.nav-account-item:hover {
    color: var(--text);
    background: var(--bg-2);
}
.nav-account-item:hover i { color: var(--accent); }
.nav-account-item.is-active {
    color: var(--accent);
    background: var(--accent-soft);
}
.nav-account-item.is-active i { color: var(--accent); }

.nav-account-item.is-logout { color: var(--text-faint); }
.nav-account-item.is-logout:hover { color: var(--warn, #a54d12); background: var(--bg-2); }
.nav-account-item.is-logout:hover i { color: var(--warn, #a54d12); }

.nav-account-divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--line);
}

/* 좁은 폭에선 유저 이름 숨기고 아바타만 노출 */
@media (max-width: 1024px) {
    .nav-quick span { display: none; }
    .nav-quick { padding: 7px 10px; }
    .nav-time-badge small { display: none; }
    .nav-franchise span { display: none; }
    .nav-franchise { padding: 8px 10px; }
    .nav-user-name { display: none; }
    .nav-user { padding: 6px 8px 6px 6px; }
}

/* 모바일에선 헤더 퀵/계정은 드로어로 대체 */
@media (max-width: 767px) {
    .site-header .nav-center { display: none !important; }
    .nav-right .nav-quick,
    .nav-right .nav-time-badge,
    .nav-right .nav-franchise,
    .nav-right .nav-account,
    .nav-right .nav-admin { display: none; }
}

/* 전역 토스트 (세션 flash · franchise 차단 등) */
.global-flash {
    position: fixed;
    top: calc(var(--header-h, 64px) + 16px);
    right: 24px;
    z-index: 1500;
    max-width: 420px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: 0 24px 40px -12px rgba(45,32,80,0.09);
    cursor: pointer;
    animation: globalFlashIn .25s var(--ease) both;
}
.global-flash i { font-size: 16px; flex-shrink: 0; }
.global-flash-close {
    background: transparent;
    border: none;
    color: var(--text-faint);
    padding: 2px 4px;
    margin-left: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.global-flash-close:hover { color: var(--text); background: var(--bg-2); }

.global-flash-success { border-color: var(--color-accent); }
.global-flash-success i { color: var(--color-accent); }
.global-flash-info    { border-color: rgba(96,165,250,.45); }
.global-flash-info i    { color: #1254a5; }
.global-flash-warn    { border-color: rgba(255,184,74,.5); }
.global-flash-warn i    { color: #a56c12; }
.global-flash-danger  { border-color: rgba(255,107,107,.5); }
.global-flash-danger i  { color: #a51212; }

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

@media (max-width: 767px) {
    .global-flash { right: 12px; left: 12px; max-width: none; top: 76px; }
}

/* Public business footer */
.dt-business-footer {
    margin-top: 64px;
    border-top: 1px solid rgba(138, 92, 255, .18);
    background: linear-gradient(180deg, rgba(255,255,255,0.92), #ffffff);
    color: var(--text-mute);
}

.dt-business-footer-inner {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 28px;
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 18px 28px;
    align-items: start;
}

.dt-business-brand {
    color: var(--accent);
    font-size: 14px;
    font-weight: 900;
}

.dt-business-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 12px;
    line-height: 1.8;
}

.dt-business-meta span {
    color: var(--text-faint);
}

.dt-business-meta b {
    margin-right: 6px;
    color: var(--text-mute);
    font-weight: 800;
}

.dt-business-address {
    flex-basis: 100%;
}

@media (max-width: 767px) {
    .dt-business-footer {
        margin-top: 44px;
    }

    .dt-business-footer-inner {
        width: min(100% - 28px, 1180px);
        grid-template-columns: 1fr;
        padding: 22px 0 26px;
    }

    .dt-business-meta {
        gap: 6px 12px;
        font-size: 11.5px;
    }
}

/* Public floating live chat widget */
.dt-chat-widget {
    position: fixed;
    right: 28px;
    bottom: 132px;
    z-index: 1400;
}

.dt-chat-float {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 84px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.dt-chat-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #090b10;
    background: linear-gradient(135deg, #8a5cff, #2c8dff);
    box-shadow: 0 18px 36px rgba(45,32,80,0.09);
    font-size: 23px;
    transition: transform .15s var(--ease), box-shadow .15s;
}

.dt-chat-float:hover .dt-chat-icon {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 22px 44px rgba(45,32,80,0.09);
}

.dt-chat-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    text-shadow: 0 1px 8px rgba(0,0,0,.45);
}

.dt-chat-badge {
    position: absolute;
    top: -2px;
    right: 10px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ff5d5d;
    color: #151525;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
}

.dt-chat-panel {
    position: absolute;
    right: 0;
    bottom: 92px;
    width: min(360px, calc(100vw - 32px));
    height: 460px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}

.dt-chat-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
}

.dt-chat-head strong,
.dt-chat-head span {
    display: block;
}

.dt-chat-head strong {
    font-size: 14px;
}

.dt-chat-head span {
    margin-top: 4px;
    color: var(--text-mute);
    font-size: 12px;
}

.dt-chat-head button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-1);
    color: var(--text-mute);
}

.dt-chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: var(--bg-0);
}

.dt-chat-empty,
.dt-chat-system {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text-mute);
    background: var(--bg-1);
    font-size: 13px;
    line-height: 1.55;
}

.dt-chat-message {
    display: flex;
    margin-bottom: 10px;
}

.dt-chat-message.is-mine {
    justify-content: flex-end;
}

.dt-chat-bubble {
    max-width: 82%;
    padding: 9px 11px;
    border-radius: 12px;
    background: var(--bg-1);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

.dt-chat-message.is-mine .dt-chat-bubble {
    color: #090b10;
    background: linear-gradient(135deg, #8a5cff, #2c8dff);
    border-color: transparent;
}

.dt-chat-meta {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--text-faint);
}

.dt-chat-message.is-mine .dt-chat-meta {
    color: rgba(8,17,14,.68);
}

.dt-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--line);
    background: var(--bg-1);
}

.dt-chat-form input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-0);
    color: var(--text);
}

.dt-chat-form button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    color: #08110e;
    background: var(--accent);
}

@media (max-width: 767px) {
    .dt-chat-widget {
        right: 18px;
        bottom: 104px;
    }
    .dt-chat-panel {
        right: -2px;
        bottom: 86px;
        height: min(460px, 68vh);
    }
}
