/* ==========================================================================
   Shop navbar (Artemis)
   Scoped under .am-* so it does not collide with the eshop template CSS.
   Paired with:
     resources/views/project/layouts/shop/includes/sections/search-bar.blade.php
     resources/views/project/layouts/shop/includes/sections/navs.blade.php
   ========================================================================== */

:root {
    --am-pink: var(--artemis-red, #ff325a);
    --am-ink: #1b1b1b;
    --am-muted: #4a4a4a;
    --am-line: #e6e6e6;
    --am-radius: 6px;
    --am-topbar-h: 74px;
}

.am-no-scroll {
    overflow: hidden;
}

/* --------------------------------------------------------- Top bar ------- */

.am-topbar {
    background: #fff;
    border-bottom: 1px solid var(--am-line);
}

.am-topbar__inner {
    /* width comes from Bootstrap .container in the markup */
    padding-top: 12px;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: var(--am-topbar-h);
}

.am-logo {
    flex: 0 1 auto;
    min-width: 0; /* allow the logo to shrink instead of forcing overflow */
    display: flex;
    align-items: center;
}

.am-logo img,
.am-logo svg {
    max-height: 42px;
    width: auto;
    display: block;
}

.am-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--am-ink);
    font-weight: 800;
    font-size: 24px;
    letter-spacing: .5px;
}

/* The logo markup comes from the `shop-logo` content record and usually carries
   .logo, which the eshop template floats and pushes down inside .header.shop. */
.am-topbar .logo {
    float: none;
    margin: 0;
    line-height: 1;
}

/* --------------------------------------------------------- Search -------- */

.am-search {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--am-pink);
    border-radius: var(--am-radius);
    background: #fff;
    overflow: hidden;
    max-width: 720px;
    margin: 0 auto;
}

.am-search input {
    flex: 1 1 auto;
    border: 0;
    outline: 0;
    padding: 11px 16px;
    font-size: 15px;
    color: var(--am-ink);
    background: transparent;
    min-width: 0;
}

.am-search input::placeholder {
    color: #9b9b9b;
}

.am-search button {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--am-pink);
    padding: 0 16px;
    font-size: 17px;
    cursor: pointer;
    line-height: 1;
}

.am-search--mobile {
    display: none;
}

/* -------------------------------------------------------- Actions -------- */

.am-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.am-action,
.am-action:visited {
    position: relative;
    color: var(--am-ink);
    font-size: 22px;
    line-height: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.am-action:hover {
    color: var(--am-pink);
}

.am-cart-count {
    position: absolute;
    top: -7px;
    right: -10px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--am-pink);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.am-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 22px;
    border: 0;
    border-radius: var(--am-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

/* The eshop reset (css/reset.css) declares `a:visited { color: inherit }`. That is
   specificity 0,1,1 and outranks a plain class rule at 0,1,0, so once a link has been
   visited its colour silently falls back to the inherited body colour (#333).
   Every anchor colour below therefore has to name :visited explicitly. */
.am-btn--primary,
.am-btn--primary:link,
.am-btn--primary:visited,
.am-btn--primary:hover,
.am-btn--primary:focus,
.am-btn--primary:active {
    background: var(--am-pink);
    color: #fff;
}

.am-btn--primary:hover,
.am-btn--primary:focus {
    background: #e02a4d;
}

/* Account dropdown */

.am-account {
    position: relative;
}

.am-account__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 180px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--am-line);
    border-radius: var(--am-radius);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all .18s ease;
    z-index: 1200;
}

.am-account.is-open .am-account__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.am-account__menu a,
.am-account__menu a:visited {
    display: block;
    padding: 9px 18px;
    font-size: 14px;
    color: var(--am-muted);
    text-decoration: none;
}

.am-account__menu a:hover {
    background: #faf7f8;
    color: var(--am-pink);
}

/* ------------------------------------------------------- Link row -------- */

.am-nav {
    position: relative; /* containing block for .am-mega */
    background: #fff;
    border-bottom: 1px solid var(--am-line);
}

.am-nav__list {
    /* width comes from Bootstrap .container in the markup */
    padding-top: 0;
    padding-bottom: 0;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
}

.am-nav__item {
    position: static;
}

.am-nav__link,
.am-nav__link:visited {
    display: block;
    padding: 13px 6px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--am-ink);
    text-decoration: none;
    white-space: nowrap;
}

.am-nav__link:hover {
    color: var(--am-pink);
}

/* --------------------------------------------------------- Mega ---------- */

.am-mega {
    position: absolute;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--am-line);
    box-shadow: 0 18px 32px rgba(0, 0, 0, .12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all .2s ease;
    z-index: 1100;
}

.am-nav__item--has-mega:hover .am-mega,
.am-nav__item--has-mega:focus-within .am-mega {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.am-mega__inner {
    padding-top: 26px;
    padding-bottom: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 22px 26px;
    max-height: 65vh;
    overflow-y: auto;
}

.am-mega__head,
.am-mega__head:visited {
    display: block;
    margin-bottom: 9px;
    font-size: 14px;
    font-weight: 700;
    color: var(--am-ink);
    text-decoration: none;
}

.am-mega__head:hover {
    color: var(--am-pink);
}

.am-mega__sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

.am-mega__sub a,
.am-mega__sub a:visited {
    display: block;
    padding: 4px 0;
    font-size: 13.5px;
    color: var(--am-muted);
    text-decoration: none;
}

.am-mega__sub a:hover {
    color: var(--am-pink);
}

.am-mega__footer {
    padding-top: 12px;
    padding-bottom: 20px;
}

.am-mega__footer a,
.am-mega__footer a:visited {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--am-pink);
    text-decoration: none;
}

/* ------------------------------------------------------- Burger ---------- */

.am-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.am-burger span {
    display: block;
    height: 2px;
    width: 22px;
    background: var(--am-ink);
    border-radius: 2px;
}

/* ------------------------------------------------------- Drawer ---------- */

.am-drawer {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.am-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .25s ease;
}

.am-drawer.is-open .am-drawer__backdrop {
    opacity: 1;
}

.am-drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 84%;
    max-width: 330px;
    background: #fff;
    z-index: 1;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
}

.am-drawer.is-open .am-drawer__panel {
    transform: translateX(0);
}

.am-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--am-line);
    font-weight: 700;
    color: var(--am-ink);
}

.am-drawer__close {
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: var(--am-muted);
    cursor: pointer;
}

.am-drawer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1 1 auto;
}

.am-drawer__item > a,
.am-drawer__item > a:visited,
.am-drawer__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 18px;
    border: 0;
    border-bottom: 1px solid #f2f2f2;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--am-ink);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.am-drawer__caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--am-muted);
    border-bottom: 2px solid var(--am-muted);
    transform: rotate(45deg);
    transition: transform .2s ease;
}

.am-drawer__item.is-open .am-drawer__caret {
    transform: rotate(-135deg);
}

.am-drawer__sub {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #fafafa;
}

.am-drawer__item.is-open .am-drawer__sub {
    display: block;
}

.am-drawer__sub a,
.am-drawer__sub a:visited {
    display: block;
    padding: 11px 18px 11px 32px;
    font-size: 13.5px;
    color: var(--am-muted);
    text-decoration: none;
    border-bottom: 1px solid #f2f2f2;
}

/* --------------------------------------------------- Breakpoints --------- */

/* Tablet — let the link row scroll horizontally rather than wrap */
@media (max-width: 1100px) {
    .am-nav__list {
        justify-content: flex-start;
        gap: 18px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .am-nav__list::-webkit-scrollbar {
        display: none;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .am-burger {
        display: flex;
    }

    .am-topbar__inner {
        gap: 12px;
        padding: 10px 14px;
        min-height: 0;
    }

    .am-logo {
        margin-right: auto;
    }

    .am-logo img,
    .am-logo svg {
        max-height: 32px;
    }

    .am-logo a {
        font-size: 19px;
    }

    /* Inline search moves to its own row */
    .am-topbar__inner > .am-search {
        display: none;
    }

    .am-search--mobile {
        display: flex;
        max-width: none;
        margin: 0 14px 12px;
    }

    .am-actions {
        gap: 12px;
    }

    .am-btn {
        height: 34px;
        padding: 0 16px;
        font-size: 13px;
    }

    /* Desktop link row + mega menu are replaced by the drawer */
    .am-nav {
        display: none;
    }
}

/* Small phones — keep the top row on one line */
@media (max-width: 400px) {
    .am-topbar__inner {
        gap: 8px;
        padding: 10px 10px;
    }

    .am-logo img,
    .am-logo svg {
        max-height: 26px;
    }

    .am-actions {
        gap: 9px;
    }

    .am-action {
        font-size: 19px;
    }

    .am-btn {
        height: 32px;
        padding: 0 12px;
        font-size: 12.5px;
    }

    .am-search--mobile {
        margin: 0 10px 10px;
    }
}
