/* =========================================================
   GAG 2 GUILDS — SHARED TOPBAR
   Load this AFTER styles.css
   ========================================================= */

#siteTopbar {
    position: sticky;
    top: 0;
    z-index: 40000;

    width: 100%;
}

/* Main bar */

.site-topbar {
    width: 100%;
    height: 76px;

    padding-inline: max(
        18px,
        calc((100vw - 1180px) / 2)
    );

    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;

    background:
        linear-gradient(
            180deg,
            rgba(19, 27, 63, 0.88),
            rgba(12, 18, 46, 0.78)
        );

    border-bottom: 1px solid rgba(255, 255, 255, 0.1);

    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.22),
        inset 0 1px rgba(255, 255, 255, 0.05);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* =========================
   BRAND
   ========================= */

.topbar-brand {
    min-width: 0;

    display: inline-flex;
    align-items: center;
    gap: 10px;

    color: white;
    text-decoration: none;

    font-size: 19px;
    font-weight: 700;

    white-space: nowrap;
}

.brand-icon {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;

    display: grid;
    place-items: center;

    font-size: 22px;

    background:
        linear-gradient(
            145deg,
            #8bea65,
            #3eb63d
        );

    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;

    box-shadow:
        inset 0 2px rgba(255, 255, 255, 0.26),
        0 8px 20px rgba(42, 167, 50, 0.25);

    transition:
        transform 0.2s ease,
        filter 0.2s ease;
}

.topbar-brand:hover .brand-icon {
    transform: rotate(-5deg) scale(1.04);
    filter: brightness(1.05);
}

.brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   NAVIGATION
   ========================= */

.topbar-navigation {
    min-width: 0;

    display: flex;
    justify-content: center;
    align-items: center;
}

.topbar-links {
    max-width: 100%;

    display: flex;
    align-items: center;
    gap: 4px;

    padding: 5px;

    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.topbar-link {
    position: relative;

    padding: 10px 14px;

    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    white-space: nowrap;

    border-radius: 11px;

    font-size: 15px;
    font-weight: 700;

    transition:
        color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.topbar-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.09);
}

.topbar-link.active {
    color: white;

    background:
        linear-gradient(
            145deg,
            rgba(111, 139, 255, 0.42),
            rgba(73, 101, 224, 0.35)
        );

    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.13);
}

/* =========================
   CART BUTTON
   ========================= */

.topbar-cart-button {
    min-height: 47px;
    padding: 8px 9px 8px 14px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    color: white;

    background:
        linear-gradient(
            145deg,
            #6d8dff,
            #405fd8
        );

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 15px;

    font-family: "Fredoka", sans-serif;
    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        inset 0 2px rgba(255, 255, 255, 0.2),
        0 9px 20px rgba(42, 69, 178, 0.28);

    transition:
        transform 0.2s ease,
        filter 0.2s ease,
        box-shadow 0.2s ease;
}

.topbar-cart-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);

    box-shadow:
        inset 0 2px rgba(255, 255, 255, 0.2),
        0 12px 24px rgba(42, 69, 178, 0.34);
}

.topbar-cart-button:active {
    transform: translateY(1px);
}

.cart-icon {
    font-size: 18px;
    line-height: 1;
}

.cart-count {
    min-width: 29px;
    height: 29px;
    padding: 0 7px;

    display: grid;
    place-items: center;

    color: #3e59c7;
    background: white;

    border-radius: 999px;

    font-size: 14px;
    font-weight: 700;
}

/* Animate count when cart changes */

.cart-count.bump {
    animation: cartBadgeBump 0.3s ease;
}

@keyframes cartBadgeBump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.25);
    }

    100% {
        transform: scale(1);
    }
}

/* =========================
   TABLET
   ========================= */

@media (max-width: 880px) {
    .site-topbar {
        height: 70px;
        padding-inline: 13px;
        gap: 10px;
    }

    .brand-text {
        display: none;
    }

    .topbar-links {
        gap: 2px;
    }

    .topbar-link {
        padding: 9px 11px;
        font-size: 14px;
    }

    .cart-label {
        display: none;
    }
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 650px) {
    .site-topbar {
        height: 65px;

        grid-template-columns: auto minmax(0, 1fr) auto;

        padding-inline: 9px;
        gap: 7px;
    }

    .brand-icon {
        width: 39px;
        height: 39px;
        flex-basis: 39px;

        border-radius: 12px;
        font-size: 20px;
    }

    .topbar-navigation {
        min-width: 0;
        overflow: hidden;
    }

    .topbar-links {
        width: 100%;

        justify-content: flex-start;

        overflow-x: auto;
        overscroll-behavior-x: contain;

        scrollbar-width: none;
    }

    .topbar-links::-webkit-scrollbar {
        display: none;
    }

    .topbar-link {
        flex: 0 0 auto;

        padding: 8px 9px;
        font-size: 13px;
    }

    .topbar-cart-button {
        min-width: 41px;
        min-height: 41px;

        padding: 6px;

        gap: 4px;
        border-radius: 12px;
    }

    .cart-icon {
        display: none;
    }

    .cart-count {
        min-width: 27px;
        height: 27px;
    }
}

/* Very small phones */

@media (max-width: 390px) {
    .site-topbar {
        padding-inline: 7px;
        gap: 5px;
    }

    .brand-icon {
        width: 37px;
        height: 37px;
        flex-basis: 37px;
    }

    .topbar-links {
        padding: 4px;
    }

    .topbar-link {
        padding: 8px 7px;
        font-size: 12px;
    }

    .topbar-cart-button {
        min-width: 38px;
        min-height: 38px;
    }

    .cart-count {
        min-width: 25px;
        height: 25px;
        font-size: 13px;
    }
}
