﻿
/* =========================================
   TLBB - SHARED TOPBAR & FOOTER
   ========================================= */

:root {
    --tl-shell-text: #302b46;
    --tl-shell-muted: #77738d;
    --tl-shell-line: rgba(114, 91, 166, .17);
    --tl-shell-purple: #7652b5;
    --tl-shell-purple-light: #9674d5;
    --tl-shell-gold: #c49b53;
    --tl-shell-white: rgba(255, 255, 255, .84);
}

.tl-site-header,
.tl-site-footer {
    position: relative;
    z-index: 100;
    color: var(--tl-shell-text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.tl-site-header {
    width: 100%;
    background: rgba(255, 255, 255, .78);
    border-bottom: 1px solid var(--tl-shell-line);
    box-shadow: 0 4px 24px rgba(65, 48, 105, .05);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.tl-topbar {
    width: 100%;
    margin: 0;
    padding: 0;
}

.tl-topbar-inner {
    width: min(1440px, calc(100% - 64px));
    min-height: 82px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.tl-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    text-decoration: none;
}

    .tl-brand img {
        display: block;
        width: auto;
        height: 58px;
        max-width: 220px;
        object-fit: contain;
    }

.tl-topbar-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 27px;
    min-width: 0;
}

.tl-nav-link,
.tl-login-link {
    position: relative;
    color: var(--tl-shell-text);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: .045em;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s ease;
}

    .tl-nav-link::after {
        position: absolute;
        right: 0;
        bottom: -9px;
        left: 0;
        height: 2px;
        content: "";
        background: linear-gradient( 90deg, var(--tl-shell-purple), var(--tl-shell-gold) );
        transform: scaleX(0);
        transform-origin: left;
        transition: transform .2s ease;
    }

    .tl-nav-link:hover,
    .tl-login-link:hover {
        color: var(--tl-shell-purple);
    }

        .tl-nav-link:hover::after {
            transform: scaleX(1);
        }

.tl-topbar-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: 5px;
}

.tl-register-link {
    min-height: 43px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid rgba(118, 82, 181, .2);
    border-radius: 12px;
    background: linear-gradient(135deg, #8060bd, #6b4ba7);
    box-shadow: 0 6px 18px rgba(118, 82, 181, .18);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .035em;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .2s ease, box-shadow .2s ease;
}

    .tl-register-link:hover {
        color: #fff;
        transform: translateY(-2px);
        box-shadow: 0 9px 22px rgba(118, 82, 181, .25);
    }

    .tl-register-link span {
        color: #f4d69c;
        font-size: 16px;
    }

.tl-menu-toggle,
.tl-menu-button {
    display: none;
}

/* FOOTER */

.tl-site-footer {
    border-top: 1px solid var(--tl-shell-line);
    background: radial-gradient( ellipse at 15% 0%, rgba(184, 157, 236, .12), transparent 45% ), rgba(250, 249, 255, .97);
}

.tl-footer-inner {
    width: min(1280px, calc(100% - 64px));
    margin: 0 auto;
    padding: 46px 0 38px;
    display: grid;
    grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(130px, 1fr));
    gap: 44px;
}

.tl-footer-brand img {
    display: block;
    width: auto;
    height: 72px;
    max-width: 230px;
    object-fit: contain;
    object-position: left center;
}

.tl-footer-brand p {
    max-width: 330px;
    margin: 17px 0 0;
    color: var(--tl-shell-muted);
    font-size: 13px;
    line-height: 1.8;
}

.tl-footer-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 13px;
}

    .tl-footer-column h2 {
        margin: 5px 0 7px;
        color: var(--tl-shell-text);
        font-size: 12px;
        font-weight: 850;
        letter-spacing: .1em;
    }

    .tl-footer-column a {
        color: var(--tl-shell-muted);
        font-size: 13px;
        line-height: 1.6;
        text-decoration: none;
        transition: color .2s ease, transform .2s ease;
    }

        .tl-footer-column a:hover {
            color: var(--tl-shell-purple);
            transform: translateX(3px);
        }

.tl-footer-bottom {
    width: min(1280px, calc(100% - 64px));
    min-height: 58px;
    margin: 0 auto;
    border-top: 1px solid var(--tl-shell-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--tl-shell-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
}

/* TABLET */

@media (max-width: 1100px) {
    .tl-topbar-inner {
        width: calc(100% - 40px);
        gap: 20px;
    }

    .tl-topbar-menu {
        gap: 16px;
    }

    .tl-nav-link,
    .tl-login-link {
        font-size: 11px;
    }

    .tl-register-link {
        padding: 0 12px;
        font-size: 10px;
    }

    .tl-footer-inner,
    .tl-footer-bottom {
        width: calc(100% - 40px);
    }

    .tl-footer-inner {
        grid-template-columns: 1.4fr 1fr 1fr;
        gap: 32px;
    }

    .tl-footer-brand {
        grid-column: 1 / -1;
    }
}

/* MOBILE NAVIGATION */

@media (max-width: 760px) {
    .tl-topbar-inner {
        position: relative;
        min-height: 70px;
        width: calc(100% - 32px);
        gap: 12px;
    }

    .tl-brand img {
        height: 48px;
        max-width: 190px;
    }

    .tl-menu-toggle {
        position: absolute;
        width: 1px;
        height: 1px;
        opacity: 0;
        pointer-events: none;
    }

    .tl-menu-button {
        width: 43px;
        height: 43px;
        flex: 0 0 43px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border: 1px solid var(--tl-shell-line);
        border-radius: 12px;
        background: var(--tl-shell-white);
        cursor: pointer;
    }

        .tl-menu-button span {
            display: block;
            width: 19px;
            height: 2px;
            border-radius: 2px;
            background: var(--tl-shell-purple);
            transition: transform .2s ease;
        }

    .tl-topbar-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: 0;
        z-index: 200;
        display: none;
        align-items: stretch;
        gap: 0;
        padding: 12px;
        border: 1px solid var(--tl-shell-line);
        border-radius: 16px;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 16px 38px rgba(48, 43, 70, .13);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .tl-menu-toggle:checked ~ .tl-topbar-menu {
        display: flex;
        flex-direction: column;
    }

    .tl-menu-toggle:focus-visible ~ .tl-menu-button {
        outline: 2px solid var(--tl-shell-purple);
        outline-offset: 3px;
    }

    .tl-menu-toggle:checked ~ .tl-menu-button span:first-child {
        transform: translateY(7px) rotate(45deg);
    }

    .tl-menu-toggle:checked ~ .tl-menu-button span:nth-child(2) {
        opacity: 0;
    }

    .tl-menu-toggle:checked ~ .tl-menu-button span:last-child {
        transform: translateY(-7px) rotate(-45deg);
    }

    .tl-nav-link {
        padding: 14px 10px;
        border-bottom: 1px solid var(--tl-shell-line);
        font-size: 12px;
    }

        .tl-nav-link::after {
            display: none;
        }

    .tl-topbar-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin: 14px 0 0;
    }

    .tl-login-link {
        padding: 10px;
        text-align: center;
    }

    .tl-register-link {
        min-height: 45px;
    }

    .tl-footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 30px 22px;
        padding: 34px 0;
    }

    .tl-footer-brand {
        grid-column: 1 / -1;
    }

        .tl-footer-brand img {
            height: 62px;
            max-width: 200px;
        }

    .tl-footer-bottom {
        min-height: 65px;
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        gap: 7px;
        padding: 12px 0;
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tl-site-header *,
    .tl-site-footer * {
        transition: none !important;
    }
}


/* =========================================
   TLBB - GLASS OVERLAY TOPBAR & FOOTER
   ========================================= */

/* TOPBAR: nổi trên Section 01, không chiếm chỗ */
.tl-site-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
    background: rgba(250, 249, 255, 0.66);
    border-bottom: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 8px 32px rgba(48, 43, 70, 0.08);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* Giữ nguyên chiều cao topbar, chỉ làm nền trong hơn */
.tl-topbar-inner {
    min-height: 76px;
}

/* =========================================
   FOOTER - HOMEPAGE SECTION 03
   ========================================= */

.tl-home .tl-screen--community {
    position: relative;
}

    .tl-home .tl-screen--community > .tl-site-footer {
        position: absolute;
        z-index: 20;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        box-sizing: border-box;
        color: var(--tl-shell-text);
        background: rgba(250, 249, 255, 0.76);
        border-top: 1px solid rgba(255, 255, 255, 0.75);
        box-shadow: 0 -8px 32px rgba(48, 43, 70, 0.07);
        backdrop-filter: blur(18px) saturate(140%);
        -webkit-backdrop-filter: blur(18px) saturate(140%);
    }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-inner {
            width: min(1280px, calc(100% - 48px));
            padding: 18px 0 18px 0;
            grid-template-columns: minmax(190px, 1.45fr) repeat(3, minmax(110px, 1fr));
            gap: 22px;
            align-items: center;
        }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-brand img {
            height: 38px;
            max-width: 150px;
        }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-brand h2 {
            margin: 4px 0;
            font-size: 15px;
            line-height: 1.3;
        }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-brand p {
            display: block;
            max-width: 310px;
            margin: 4px 0 0;
            font-size: 12px;
            line-height: 1.4;
        }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-column {
            gap: 4px;
            margin-top: 18px;
            margin-bottom: auto;
        }

            .tl-home .tl-screen--community > .tl-site-footer .tl-footer-column h2 {
                font-size: 12px;
                line-height: 1.4;
            }

            .tl-home .tl-screen--community > .tl-site-footer .tl-footer-column a {
                font-size: 12px;
                line-height: 1.4;
                overflow-wrap: anywhere;
            }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-bottom {
            width: min(1280px, calc(100% - 48px));
            min-height: 30px;
            padding: 5px 0;
            box-sizing: border-box;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 6px 16px;
            font-size: 10px;
            line-height: 1.4;
        }

/* Tablet/mobile: cho Footer theo luồng nội dung để không cắt chữ */
@media (max-width: 1000px) {
    .tl-home .tl-screen--community > .tl-site-footer {
        position: relative;
        right: auto;
        bottom: auto;
        left: auto;
        margin-top: 24px;
    }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-inner {
            width: calc(100% - 32px);
            padding: 16px 0;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 18px;
        }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-brand p {
            font-size: 10px;
        }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-bottom {
            width: calc(100% - 32px);
        }
}

@media (max-width: 700px) {
    .tl-home .tl-screen--community > .tl-site-footer {
        margin-top: 20px;
    }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-inner {
            width: calc(100% - 28px);
            grid-template-columns: 1fr 1fr;
            gap: 16px 12px;
        }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-brand {
            grid-column: 1 / -1;
        }

            .tl-home .tl-screen--community > .tl-site-footer .tl-footer-brand p {
                display: block;
            }

        .tl-home .tl-screen--community > .tl-site-footer .tl-footer-bottom {
            width: calc(100% - 28px);
            justify-content: flex-start;
            font-size: 8px;
        }
}

/* Footer trang con: đặt ở cuối trang, không dùng định vị tuyệt đối */
body:not(.tl-home) .tl-site-footer {
    position: relative;
    width: 100%;
    margin-top: auto;
}

body:not(.tl-home) .tl-footer-inner {
    padding-top: 24px;
    padding-bottom: 20px;
    gap: 28px;
}

body:not(.tl-home) .tl-footer-brand img {
    height: 52px;
}

body:not(.tl-home) .tl-footer-brand p {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
}

body:not(.tl-home) .tl-footer-column {
    gap: 8px;
}

body:not(.tl-home) .tl-footer-bottom {
    min-height: 42px;
}

/* =========================================
   TOPBAR - GLASS, CENTERED NAV, ACCOUNT RIGHT
   ========================================= */

.tl-site-header {
    background: rgba(250, 249, 255, 0.38);
    border-bottom: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: 0 6px 24px rgba(48, 43, 70, 0.045);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
}

.tl-topbar-inner {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    width: min(1440px, calc(100% - 64px));
    min-height: 76px;
    gap: 20px;
}

.tl-brand {
    grid-column: 1;
    justify-self: start;
}

.tl-topbar-links {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 27px;
    white-space: nowrap;
}

.tl-topbar-actions {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: 0;
}

.tl-account-name {
    display: inline-flex;
    align-items: center;
    max-width: 190px;
    min-height: 42px;
    padding: 0 15px;
    overflow: hidden;
    border: 1px solid rgba(118, 82, 181, .22);
    border-radius: 12px;
    background: rgba(255, 255, 255, .48);
    color: var(--tl-shell-purple);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .tl-account-name:hover {
        color: var(--tl-shell-purple);
        background: rgba(255, 255, 255, .7);
    }

@media (max-width: 1100px) {
    .tl-topbar-inner {
        width: calc(100% - 40px);
        grid-template-columns: auto minmax(0, 1fr);
        gap: 18px;
    }

    .tl-topbar-links {
        grid-column: 2;
        justify-content: flex-end;
        gap: 16px;
    }

    .tl-topbar-actions {
        grid-column: 2;
    }
}

@media (max-width: 760px) {
    .tl-topbar-inner {
        display: flex;
        justify-content: space-between;
        min-height: 66px;
        width: calc(100% - 32px);
    }

    .tl-topbar-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: 0;
        z-index: 200;
        display: none;
        padding: 12px;
        border: 1px solid var(--tl-shell-line);
        border-radius: 16px;
        background: rgba(250, 249, 255, .94);
        box-shadow: 0 16px 38px rgba(48, 43, 70, .13);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .tl-menu-toggle:checked ~ .tl-topbar-menu {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .tl-topbar-links {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

        .tl-topbar-links .tl-nav-link {
            padding: 14px 10px;
            border-bottom: 1px solid var(--tl-shell-line);
        }

    .tl-topbar-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-top: 12px;
    }

    .tl-account-name {
        justify-content: center;
        max-width: 100%;
    }
}


/* TOPBAR: 3 vùng độc lập */
.tl-topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    width: calc(100% - 64px);
    max-width: 1600px;
    gap: 24px;
}

.tl-brand {
    grid-column: 1;
    justify-self: start;
}

.tl-topbar-menu {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 0;
}

.tl-topbar-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
}

.tl-topbar-actions {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0;
}

.tl-logout-form {
    display: inline-flex;
    margin: 0;
}

.tl-logout-button {
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid rgba(118, 82, 181, .22);
    border-radius: 10px;
    background: rgba(255, 255, 255, .5);
    color: var(--tl-shell-purple);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .03em;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

    .tl-logout-button:hover {
        background: rgba(255, 255, 255, .85);
        transform: translateY(-1px);
    }

.tl-account-name {
    max-width: 170px;
}

/* Màn hình vừa */
@media (max-width: 1100px) and (min-width: 761px) {
    .tl-topbar-inner {
        width: calc(100% - 32px);
        grid-template-columns: auto minmax(0, 1fr);
        gap: 16px;
    }

    .tl-topbar-menu {
        grid-column: 2;
        justify-content: flex-end;
        gap: 12px;
    }

    .tl-topbar-links {
        gap: 14px;
    }

    .tl-topbar-actions {
        grid-column: auto;
    }
}

/* Điện thoại: tài khoản và đăng xuất nằm trong menu mở rộng */
@media (max-width: 760px) {
    .tl-topbar-inner {
        display: flex;
        justify-content: space-between;
        width: calc(100% - 32px);
        gap: 12px;
    }

    .tl-topbar-menu {
        align-items: stretch;
    }

    .tl-topbar-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .tl-logout-form,
    .tl-logout-button {
        width: 100%;
    }

    .tl-account-name {
        justify-content: center;
        max-width: none;
    }
}

/* =========================================
   FOOTER TRANG CON - STICKY FOOTER LAYOUT
   ========================================= */
@supports selector(body:has(.tl-home)) {
    body:not(.tl-home) {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        margin: 0;
    }

        body:not(.tl-home) #main-content {
            flex: 1 0 auto;
            width: 100%;
            min-width: 0;
        }

        body:not(.tl-home) > .tl-site-footer {
            flex-shrink: 0;
            margin-top: auto;
        }
}

/* =========================================
   TOPBAR TRANG CHỦ: NẰM ĐÈ LÊN SECTION 1
   ========================================= */
body.tl-home .tl-site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
}

body.tl-home .tl-topbar {
    background: transparent;
}

/* =========================================
   TOPBAR TRANG CON: NẰM TRÊN MAIN
   ========================================= */

body.tl-inner-page .tl-site-header {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    z-index: 100;
    width: 100%;
}

body.tl-inner-page .tl-topbar {
    position: relative;
    top: auto;
}
