/* ==========================================================================
   Shared responsive styles for DineFlow (live app).
   Linked from views/includes/navBar.ejs, so it loads on every page AFTER the
   page-specific stylesheet — letting these rules win same-specificity ties.
   ========================================================================== */

/* Lay out the nav link group as a flex row (matches the previous look where
   each link was a direct flex child of <nav>). */
.nav-menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

/* Hamburger toggle button: hidden on desktop, shown on small screens. */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 10px;
}

/* Never let media force horizontal scrolling. */
img {
    max-width: 100%;
}

/* --------------------------------------------------------------------------
   Shared navbar + footer. Lives here (loaded on every page via navBar.ejs) so
   pages that don't ship their own copy of these rules — e.g. payment and order
   confirmation — still render the bar consistently. Scoped under `header` so it
   never touches page content links.
   -------------------------------------------------------------------------- */
header {
    padding: 5px 10px;
    position: sticky;
    top: 0;
    z-index: 10;
}

header nav {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    gap: 20px;
    background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(36,34,30,1) 50%, rgba(0,212,255,1) 100%);
    border: 2px solid black;
    border-radius: 15px;
}

header .nav-logo {
    position: absolute;
    left: 10px;
    margin-left: 20px;
    height: 100%;
    width: auto;
}

header .nav-links {
    padding: 20px;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 500;
    font-size: 1em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
}

header .nav-links:hover {
    text-decoration: underline;
}

header button.logout-btn.nav-links {
    all: unset;
    cursor: pointer;
    padding: 20px;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 500;
    font-size: 1em;
    text-transform: uppercase;
    color: #fff;
}

header button.logout-btn.nav-links:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    background-color: rgb(41, 52, 61);
    color: #fff;
    padding: 20px 0;
}

/* Cart count badge in the navbar: a red pill with the item count inside it,
   floating just past the top-right of the "Cart" label (left:100% + margin
   keeps a gap so it never overlaps the text, and it grows rightward for 2+
   digits). Explicit width neutralises page-level generic rules like menu.css's
   `span { width: 100%; display: flex }`, which would otherwise distort it only
   on the menu route. */
.cart-label {
    position: relative;
    display: inline-block;
    width: auto;
}

.cart-count {
    position: absolute;
    left: 100%;
    top: -10px;
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 999px;
    background: #f02849;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* display:inline-flex overrides the [hidden] attribute, so re-hide explicitly. */
.cart-count[hidden] {
    display: none;
}

/* --------------------------------------------------------------------------
   Tablet and below
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* Top bar: logo on the left, hamburger on the right. */
    header nav {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0;
        padding: 6px 12px;
    }

    /* Logo flows inline (it is absolutely positioned on desktop). */
    nav img,
    .nav-logo {
        position: static;
        height: 42px;
        margin: 0;
    }

    .nav-toggle {
        display: block;
    }

    /* Collapse the link group into a stacked dropdown, toggled by .show. */
    .nav-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        order: 3;
        gap: 0;
        padding-bottom: 6px;
    }

    .nav-menu.show {
        display: flex;
    }

    .nav-menu .nav-links,
    .nav-menu .logout-btn {
        display: block;
        width: 100%;
        padding: 12px 10px;
        box-sizing: border-box;
        text-align: left;
    }

    .nav-menu form {
        width: 100%;
    }

    /* ---- Home page ---- */
    .bg {
        height: 60vh;
    }

    .bg h1 {
        font-size: 2em;
        padding: 24px;
        top: 20px;
    }

    .contact_us {
        padding: 16px;
    }

    .contact_us h2 {
        font-size: 2em;
    }

    .details {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        padding: 24px;
        margin: 24px;
    }

    /* ---- About page (uses .container inside <main>) ---- */
    main .container {
        flex-direction: column;
        height: auto;
        padding: 24px;
        margin: 24px;
    }

    main .container img {
        height: auto;
        width: 100%;
        margin-top: 16px;
    }

    /* ---- Menu page ---- */
    main h2 {
        margin-left: 0;
    }

    .menu-item {
        width: 90%;
        max-width: 350px;
        height: auto;
    }

    /* ---- Offers page ---- */
    .offer-card {
        width: 100%;
        max-width: 340px;
    }

    /* ---- Cart page (table) ---- */
    .cart-table {
        width: 100%;
    }

    .cart-table th,
    .cart-table td {
        padding: 10px 8px;
        font-size: 0.9em;
    }

    .cart-main h1 {
        font-size: 2em;
    }
}

/* --------------------------------------------------------------------------
   Phones
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .bg h1 {
        font-size: 1.6em;
    }

    .menu-item {
        width: 100%;
    }

    .review {
        margin: 24px 16px;
        padding: 28px 20px;
    }

    .cart-table th,
    .cart-table td {
        padding: 8px 5px;
        font-size: 0.82em;
    }

    footer h3 {
        font-size: 0.95em;
    }
}
