/* ============================================================
   SHOPPING LIST
   Mobile-first dark UI
   ============================================================ */


/* ------------------------------------------------------------
   VARIABLES
   ------------------------------------------------------------ */

:root {
    --bg: #0f1114;
    --surface: #171a1f;
    --surface-2: #1d2127;
    --surface-3: #232830;

    --border: #292e36;
    --border-light: #343a44;

    --text: #f4f6f8;
    --text-secondary: #a5acb6;
    --text-muted: #6f7783;

    --accent: #56b9ff;
    --accent-dark: #318fd2;

    --urgent: #ff765f;
    --urgent-soft: rgba(255, 118, 95, 0.14);

    --sale: #8bd17c;
    --sale-soft: rgba(139, 209, 124, 0.14);

    --white: #ffffff;

    --radius-small: 10px;
    --radius: 16px;
    --radius-large: 22px;

    --shadow:
        0 10px 30px rgba(0, 0, 0, 0.28);

    --transition:
        160ms ease;
}


/* ------------------------------------------------------------
   RESET
   ------------------------------------------------------------ */

* {
    box-sizing: border-box;
}


html {
    min-height: 100%;
    background: var(--bg);
}


body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(
            circle at top,
            rgba(86, 185, 255, 0.045),
            transparent 38%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
}


button,
input {
    font: inherit;
}


button,
a {
    -webkit-tap-highlight-color: transparent;
}


button {
    border: 0;
}


a {
    color: inherit;
    text-decoration: none;
}


/* ------------------------------------------------------------
   APP CONTAINER
   ------------------------------------------------------------ */

.app {
    width: 100%;
    min-height: 100vh;
}


/*
   On larger displays the application behaves like
   a mobile app preview.
*/

@media (min-width: 600px) {

    body {
        display: flex;
        justify-content: center;

        /* padding: 24px; */
    }

    .app {
        width: min(100%, 460px);
        min-height: calc(100vh - 48px);

        border: 1px solid var(--border);
        border-radius: 28px;

        overflow: hidden;

        box-shadow: var(--shadow);

        background: var(--bg);
    }

}


/* ------------------------------------------------------------
   SCREEN SYSTEM
   ------------------------------------------------------------ */

.screen {
    min-height: 100vh;
}


/*
   Hide all screens by default.
   :target displays the selected screen.
*/

.screen {
    display: none;
}


.screen:target {
    display: flex;
}


/*
   Login is the default screen when there is
   no #add or #shopping target in the URL.
*/

body:not(:has(.screen:target)) #login {
    display: flex;
}


/* ------------------------------------------------------------
   LOGIN
   ------------------------------------------------------------ */

.login-screen {
    align-items: center;
    justify-content: center;

    padding:
        32px
        24px;
}


.login-container {
    width: 100%;
    max-width: 380px;
}


/* Brand */

.brand {
    text-align: center;
    margin-bottom: 46px;
}


.brand-icon {
    width: 68px;
    height: 68px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 22px;

    border-radius: 20px;

    color: var(--accent);

    background:
        linear-gradient(
            145deg,
            rgba(86, 185, 255, 0.19),
            rgba(86, 185, 255, 0.07)
        );

    border: 1px solid rgba(86, 185, 255, 0.17);
}


.brand-icon svg {
    width: 31px;
    height: 31px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.brand h1 {
    margin: 0;

    font-size: 30px;
    line-height: 1.15;

    letter-spacing: -0.8px;
}


.brand p {
    margin: 13px 0 0;

    color: var(--text-secondary);

    font-size: 14px;
    line-height: 1.6;
}


/* Login fields */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


.field label,
.field-label-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}


.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}


.small-link {
    color: var(--accent);
    font-size: 12px;
}


.field input {
    width: 100%;
    height: 52px;

    padding: 0 16px;

    border: 1px solid var(--border);
    border-radius: 13px;

    outline: 0;

    color: var(--text);
    background: var(--surface);

    transition:
        border-color var(--transition),
        background var(--transition),
        box-shadow var(--transition);
}


.field input::placeholder {
    color: var(--text-muted);
}


.field input:focus {
    border-color: var(--accent);

    background: var(--surface-2);

    box-shadow:
        0 0 0 3px rgba(86, 185, 255, 0.09);
}


/* Custom checkbox */

.checkbox-row {
    display: flex;
    align-items: center;

    gap: 11px;

    color: var(--text-secondary);

    font-size: 13px;

    cursor: pointer;
}


.checkbox-row input {
    position: absolute;
    opacity: 0;
}


.custom-checkbox {
    width: 19px;
    height: 19px;

    flex: 0 0 19px;

    border: 1px solid var(--border-light);
    border-radius: 6px;

    background: var(--surface);

    position: relative;

    transition:
        background var(--transition),
        border-color var(--transition);
}


.checkbox-row input:checked + .custom-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}


.checkbox-row input:checked + .custom-checkbox::after {
    content: "";

    position: absolute;

    width: 5px;
    height: 9px;

    left: 6px;
    top: 3px;

    border:
        solid #081018;

    border-width:
        0 2px 2px 0;

    transform: rotate(45deg);
}


/* Primary button */

.primary-button {
    min-height: 54px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    border-radius: 14px;

    color: #071018;

    background: var(--accent);

    font-size: 14px;
    font-weight: 750;
    letter-spacing: 0.1px;

    transition:
        transform var(--transition),
        background var(--transition);
}


.primary-button:hover {
    background: #6ac2ff;
}


.primary-button:active {
    transform: scale(0.985);
}


.primary-button svg {
    width: 18px;
    height: 18px;

    fill: none;
    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Login footer */

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    margin-top: 34px;

    color: var(--text-muted);

    font-size: 11px;
}


.status-dot {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--sale);
}


/* ------------------------------------------------------------
   APPLICATION SCREEN
   ------------------------------------------------------------ */

.app-screen {
    position: relative;

    flex-direction: column;

    padding-bottom: 86px;
}


/* ------------------------------------------------------------
   TOP BAR
   ------------------------------------------------------------ */

.top-bar {
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding:
        26px
        20px
        18px;
}


.eyebrow {
    margin-bottom: 5px;

    color: var(--text-muted);

    font-size: 10px;
    font-weight: 750;

    letter-spacing: 1.6px;
    text-transform: uppercase;
}


.top-bar h2 {
    margin: 0;

    font-size: 25px;
    line-height: 1.15;

    letter-spacing: -0.55px;
}


.avatar-button {
    width: 40px;
    height: 40px;

    border-radius: 50%;

    color: var(--accent);

    background: rgba(86, 185, 255, 0.10);

    border: 1px solid rgba(86, 185, 255, 0.16);

    font-size: 11px;
    font-weight: 750;

    cursor: pointer;
}


.shopping-count {
    display: flex;
    align-items: baseline;

    gap: 5px;

    color: var(--text-muted);

    font-size: 11px;
}


.shopping-count strong {
    color: var(--text);
    font-size: 25px;
}


/* ------------------------------------------------------------
   CONTENT
   ------------------------------------------------------------ */

.content {
    flex: 1;

    padding:
        4px
        20px
        28px;
}


/* ------------------------------------------------------------
   MODE SELECTOR
   ------------------------------------------------------------ */

.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 7px;

    padding: 5px;

    margin-bottom: 18px;

    border:
        1px solid var(--border);

    border-radius: 15px;

    background: var(--surface);
}


.mode-selector input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}


.mode-selector label {
    min-height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    border-radius: 11px;

    color: var(--text-muted);

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;

    transition:
        color var(--transition),
        background var(--transition);
}


#mode-urgent:checked + label {
    color: var(--urgent);
    background: var(--urgent-soft);
}


#mode-sale:checked + label {
    color: var(--sale);
    background: var(--sale-soft);
}


.mode-icon {
    width: 21px;
    height: 21px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 7px;

    font-size: 12px;
    font-weight: 800;
}


.urgent-icon {
    color: var(--urgent);
    background: rgba(255, 118, 95, 0.12);
}


.sale-icon {
    color: var(--sale);
    background: rgba(139, 209, 124, 0.12);
}


/* ------------------------------------------------------------
   SEARCH
   ------------------------------------------------------------ */

.search-box {
    height: 52px;

    display: flex;
    align-items: center;

    gap: 11px;

    padding: 0 15px;

    margin-bottom: 25px;

    border:
        1px solid var(--border);

    border-radius: 14px;

    background: var(--surface);
}


.search-box svg {
    width: 19px;
    height: 19px;

    flex: 0 0 auto;

    fill: none;
    stroke: var(--text-muted);

    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}


.search-box input {
    width: 100%;

    border: 0;
    outline: 0;

    color: var(--text);

    background: transparent;

    font-size: 14px;
}


.search-box input::placeholder {
    color: var(--text-muted);
}


/* ------------------------------------------------------------
   SECTION HEADINGS
   ------------------------------------------------------------ */

.section-heading {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-bottom: 12px;

    color: var(--text-muted);

    font-size: 11px;
    font-weight: 750;

    letter-spacing: 0.9px;
    text-transform: uppercase;
}


.recent-heading {
    margin-top: 27px;
}


.section-count {
    margin-left: auto;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 22px;
    height: 22px;

    padding: 0 7px;

    border-radius: 20px;

    color: var(--text-secondary);

    background: var(--surface-2);

    font-size: 10px;
    letter-spacing: 0;
}


/* ------------------------------------------------------------
   FREQUENT ITEMS
   ------------------------------------------------------------ */

.quick-items {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 10px;
}


.quick-item {
    min-height: 73px;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;

    gap: 8px;

    padding: 12px 14px;

    border:
        1px solid var(--border);

    border-radius: 15px;

    color: var(--text);

    background: var(--surface);

    cursor: pointer;

    text-align: left;

    transition:
        transform var(--transition),
        border-color var(--transition),
        background var(--transition);
}


.quick-item:hover {
    border-color: var(--border-light);
    background: var(--surface-2);
}


.quick-item:active {
    transform: scale(0.98);
}


.product-icon {
    font-size: 21px;
    line-height: 1;
}


.quick-item span:last-child {
    font-size: 12px;
    font-weight: 650;
}


/* ------------------------------------------------------------
   SUGGESTIONS
   ------------------------------------------------------------ */

.suggestions {
    display: flex;
    flex-direction: column;

    border:
        1px solid var(--border);

    border-radius: 15px;

    overflow: hidden;
}


.suggestion {
    min-height: 55px;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 0 13px;

    color: var(--text);

    background: var(--surface);

    border-bottom:
        1px solid var(--border);

    text-align: left;

    cursor: pointer;
}


.suggestion:last-child {
    border-bottom: 0;
}


.suggestion:hover {
    background: var(--surface-2);
}


.suggestion-icon {
    width: 25px;

    text-align: center;

    font-size: 19px;
}


.suggestion-name {
    flex: 1;

    font-size: 13px;
}


.suggestion-add {
    width: 27px;
    height: 27px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;

    color: var(--accent);

    background:
        rgba(86, 185, 255, 0.08);

    font-size: 20px;
    line-height: 1;
}


/* ------------------------------------------------------------
   SHOW/HIDE ADD MODES
   ------------------------------------------------------------ */

.sale-content {
    display: none;
}


#mode-sale:checked ~
.search-box ~
.sale-content {
    display: block;
}


#mode-sale:checked ~
.search-box ~
.urgent-content {
    display: none;
}


/* ------------------------------------------------------------
   SHOPPING LIST
   ------------------------------------------------------------ */

.shopping-content {
    padding-top: 4px;
}


.shopping-section {
    margin-bottom: 26px;
}


.heading-indicator {
    width: 8px;
    height: 8px;

    border-radius: 50%;
}


.urgent-indicator {
    background: var(--urgent);

    box-shadow:
        0 0 0 4px rgba(255, 118, 95, 0.08);
}


.sale-indicator {
    background: var(--sale);

    box-shadow:
        0 0 0 4px rgba(139, 209, 124, 0.08);
}


/* Shopping list */

.shopping-list {
    display: flex;
    flex-direction: column;

    border:
        1px solid var(--border);

    border-radius: 15px;

    overflow: hidden;
}


.shopping-item {
    position: relative;

    min-height: 64px;

    display: flex;
    align-items: center;

    gap: 11px;

    padding:
        0
        13px;

    background: var(--surface);

    border-bottom:
        1px solid var(--border);

    cursor: pointer;

    transition:
        background var(--transition),
        opacity var(--transition);
}


.shopping-item:last-child {
    border-bottom: 0;
}


.shopping-item:hover {
    background: var(--surface-2);
}


/*
   Hide actual checkbox.
*/

.shopping-item > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}


/* Check circle */

.shopping-check {
    width: 23px;
    height: 23px;

    flex: 0 0 23px;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1.5px solid #404752;

    border-radius: 50%;

    transition:
        background var(--transition),
        border-color var(--transition),
        transform var(--transition);
}


.shopping-check svg {
    width: 13px;
    height: 13px;

    opacity: 0;

    fill: none;
    stroke: #081018;

    stroke-width: 2.5;

    stroke-linecap: round;
    stroke-linejoin: round;

    transition: opacity var(--transition);
}


/* Product icon */

.shopping-product-icon {
    width: 27px;

    flex: 0 0 27px;

    text-align: center;

    font-size: 20px;
}


.shopping-name {
    flex: 1;

    min-width: 0;

    color: var(--text);

    font-size: 14px;
    font-weight: 580;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    transition:
        color var(--transition),
        text-decoration var(--transition);
}


.shopping-arrow {
    color: var(--text-muted);

    font-size: 22px;
    font-weight: 300;
}


.sale-label {
    flex: 0 0 auto;

    padding:
        5px
        7px;

    border-radius: 6px;

    color: var(--sale);

    background: var(--sale-soft);

    font-size: 8px;
    font-weight: 800;

    letter-spacing: 0.7px;
}


/* Purchased state */

.shopping-item > input:checked
~ .shopping-check {
    background: var(--sale);
    border-color: var(--sale);

    transform: scale(1.03);
}


.shopping-item > input:checked
~ .shopping-check svg {
    opacity: 1;
}


.shopping-item > input:checked
~ .shopping-name {
    color: var(--text-muted);

    text-decoration:
        line-through;

    text-decoration-thickness:
        1px;
}


.shopping-item > input:checked
~ .shopping-arrow {
    opacity: 0.25;
}


/* ------------------------------------------------------------
   SHOPPING FOOTER MESSAGE
   ------------------------------------------------------------ */

.shopping-footer-message {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    margin-top: 21px;

    color: var(--text-muted);

    font-size: 11px;
}


.footer-check {
    width: 18px;
    height: 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    color: var(--sale);

    background: var(--sale-soft);

    font-size: 10px;
    font-weight: 800;
}


/* ------------------------------------------------------------
   BOTTOM NAVIGATION
   ------------------------------------------------------------ */

.bottom-nav {
    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    height: 76px;

    display: grid;
    grid-template-columns: 1fr 1fr;

    padding:
        8px
        10px
        max(8px, env(safe-area-inset-bottom));

    border-top:
        1px solid var(--border);

    background:
        rgba(15, 17, 20, 0.94);

    backdrop-filter: blur(18px);

    z-index: 50;
}


@media (min-width: 600px) {

    .bottom-nav {
        position: absolute;

        left: 0;
        right: 0;
        bottom: 0;
    }

}


/* Navigation item */

.nav-item {
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 4px;

    border-radius: 13px;

    color: var(--text-muted);

    font-size: 10px;
    font-weight: 650;

    transition:
        color var(--transition),
        background var(--transition);
}


.nav-item:hover {
    background: rgba(255, 255, 255, 0.025);
}


.nav-item.active {
    color: var(--accent);
}


.nav-icon {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;
}


.nav-icon svg {
    width: 21px;
    height: 21px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Badge */

.nav-badge {
    position: absolute;

    top: 8px;
    left: calc(50% + 7px);

    min-width: 15px;
    height: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 4px;

    border-radius: 20px;

    color: #071018;
    background: var(--accent);

    font-size: 8px;
    font-weight: 800;

    line-height: 1;
}


/* ------------------------------------------------------------
   MOBILE SAFE AREAS
   ------------------------------------------------------------ */

@supports (padding: max(0px)) {

    .login-screen {
        padding-top:
            max(32px, env(safe-area-inset-top));

        padding-bottom:
            max(32px, env(safe-area-inset-bottom));
    }

}


/* ------------------------------------------------------------
   REDUCE MOTION
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }

}