/* =========================================================
   ZABÚDAČIK
   app2.css
   ========================================================= */


/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: #172033;
    background:
        linear-gradient(
            135deg,
            #f7faff 0%,
            #eef4ff 45%,
            #f8fbff 100%
        );

    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}


/* =========================================================
   BACKGROUND BLOBS
   ========================================================= */

body::before,
body::after {
    content: "";
    position: fixed;

    width: 420px;
    height: 420px;

    border-radius: 50%;

    filter: blur(70px);

    opacity: 0.35;

    pointer-events: none;

    z-index: -1;
}

body::before {
    top: -180px;
    left: -120px;

    background: #cfe0ff;
}

body::after {
    right: -150px;
    bottom: -180px;

    background: #d9f3ff;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
    width: 100%;

    padding: 18px 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    background: rgba(255, 255, 255, 0.82);

    border-bottom: 1px solid rgba(35, 55, 90, 0.08);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    position: sticky;
    top: 0;

    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;

    gap: 10px;

    font-size: 24px;
    font-weight: 800;

    color: #1d63d8;

    text-decoration: none;
}

.brand:hover {
    color: #1654bc;
}


/* =========================================================
   AUTH
   ========================================================= */

.auth {
    display: flex;
    align-items: center;

    gap: 8px;

    flex-wrap: wrap;
}

#userLabel {
    font-size: 14px;
    font-weight: 600;

    color: #4b5870;

    margin-right: 5px;
}

.auth button {
    border: 1px solid #d9e2f0;

    background: #ffffff;

    color: #26344b;

    padding: 8px 14px;

    border-radius: 10px;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.auth button:hover {
    background: #f3f7fd;
    border-color: #bfd0e8;
}

.auth button:active {
    transform: translateY(1px);
}


/* =========================================================
   MAIN SHELL
   ========================================================= */

.shell {
    width: min(1180px, calc(100% - 32px));

    margin: 0 auto;

    padding: 38px 0 60px;
}


/* =========================================================
   HERO
   ========================================================= */

.hero {
    margin-bottom: 30px;
}

.hero h1 {
    margin: 0 0 10px;

    font-size: clamp(32px, 5vw, 52px);

    line-height: 1.05;

    letter-spacing: -1.5px;

    color: #17233a;
}

.hero p {
    margin: 0;

    max-width: 700px;

    font-size: 17px;

    line-height: 1.65;

    color: #627087;
}


/* =========================================================
   GRID / PANELS
   ========================================================= */

.grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1.5fr)
        minmax(300px, 0.8fr);

    gap: 24px;

    align-items: start;
}

.panel {
    background: rgba(255, 255, 255, 0.9);

    border: 1px solid rgba(30, 55, 95, 0.08);

    border-radius: 20px;

    box-shadow:
        0 14px 40px rgba(28, 57, 100, 0.08);

    padding: 22px;
}

.panel h2 {
    margin: 0 0 18px;

    font-size: 20px;

    color: #1b2b45;
}


/* =========================================================
   SEARCH
   ========================================================= */

.search-row {
    display: flex;

    gap: 10px;

    margin-bottom: 12px;
}

.search-row input,
#foodInput {
    width: 100%;

    min-height: 46px;

    padding: 11px 14px;

    border-radius: 12px;

    border: 1px solid #d6dfec;

    background: #ffffff;

    color: #18253a;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.search-row input:focus,
#foodInput:focus {
    border-color: #6da0e8;

    box-shadow:
        0 0 0 4px rgba(54, 116, 208, 0.10);
}

#addCustom {
    flex: 0 0 auto;

    min-height: 46px;

    padding: 0 18px;

    border: 0;

    border-radius: 12px;

    background: #2167d5;

    color: #ffffff;

    font-weight: 700;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

#addCustom:hover {
    background: #1858bd;
}

#addCustom:active {
    transform: translateY(1px);
}


/* =========================================================
   SUGGESTIONS
   ========================================================= */

#suggestions {
    display: none;

    margin-top: 6px;

    background: #ffffff;

    border: 1px solid #dbe4f0;

    border-radius: 12px;

    box-shadow:
        0 14px 35px rgba(28, 57, 100, 0.12);

    overflow: hidden;

    position: relative;

    z-index: 20;
}

.suggestion-item {
    width: 100%;

    display: block;

    padding: 10px 13px;

    text-align: left;

    border: 0;

    border-bottom: 1px solid #eef2f7;

    background: #ffffff;

    color: #27364e;
}

.suggestion-item:last-child {
    border-bottom: 0;
}

.suggestion-item:hover {
    background: #f4f8fd;
}


/* =========================================================
   QUICK BUTTONS
   ========================================================= */

.quick-buttons {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin: 14px 0 20px;
}

.quick-buttons button {
    padding: 8px 12px;

    border-radius: 999px;

    border: 1px solid #d7e1ef;

    background: #f8fbff;

    color: #315071;

    font-size: 14px;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.quick-buttons button:hover {
    background: #edf4fd;
    border-color: #bfd1e8;
}

.quick-buttons button:active {
    transform: translateY(1px);
}


/* =========================================================
   SHOPPING LIST HEADER
   ========================================================= */

.shopping-list-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 12px;
}

.shopping-list-title {
    display: flex;
    align-items: center;

    gap: 8px;
}

.count-badge,
#countBadge {
    min-width: 28px;
    height: 28px;

    padding: 0 8px;

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

    border-radius: 999px;

    background: #e8f1ff;

    color: #2167d5;

    font-size: 13px;
    font-weight: 800;
}


/* =========================================================
   SHOPPING LIST
   ========================================================= */

#shoppingList {
    display: flex;

    flex-direction: column;

    gap: 8px;

    min-height: 10px;
}


/* =========================================================
   SHOPPING ITEM
   ========================================================= */

.shopping-item {
    display: grid;

    /*
     * drag
     * checkbox
     * name
     * quantity
     * price
     * compare
     * remove
     */
    grid-template-columns:
        34px
        34px
        minmax(130px, 1fr)
        auto
        minmax(70px, 100px)
        38px
        38px;

    align-items: center;

    gap: 8px;

    min-height: 58px;

    padding: 8px 10px;

    border: 1px solid #e0e7f0;

    border-radius: 14px;

    background: #ffffff;

    box-shadow:
        0 4px 14px rgba(29, 53, 88, 0.045);

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        opacity 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.shopping-item:hover {
    border-color: #cbd8e8;

    box-shadow:
        0 7px 20px rgba(29, 53, 88, 0.075);
}


/* =========================================================
   DISABLED ITEM
   ========================================================= */

.shopping-item.disabled-item {
    opacity: 0.52;

    background: #f6f8fb;
}

.shopping-item.disabled-item
.shopping-item-name {
    text-decoration: line-through;

    color: #78869a;
}


/* =========================================================
   DRAG HANDLE
   ========================================================= */

.drag-handle {
    width: 32px;
    height: 38px;

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

    padding: 0;

    border: 0;

    border-radius: 8px;

    background: transparent;

    color: #91a0b4;

    font-size: 21px;
    line-height: 1;

    cursor: grab;

    touch-action: none;

    user-select: none;
    -webkit-user-select: none;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.drag-handle:hover {
    background: #eef4fb;

    color: #48709d;
}

.drag-handle:active {
    cursor: grabbing;
}

.shopping-item.drag-pressed {
    background: #f2f7fd;
}

.shopping-item.dragging {
    opacity: 0.72;
    border-color: #6f9ed8;
    box-shadow: 0 12px 30px rgba(29, 53, 88, 0.16);
    transform: none;
    transition: none;
    position: relative;
    z-index: 50;
}


/*
 * Keď práve presúvame položku,
 * nechceme aby browser interpretoval
 * dotyk ako scrollovanie cez handle.
 */
.zabudacik-dragging {
    user-select: none;
    -webkit-user-select: none;
}


/* =========================================================
   CHECKBOX
   ========================================================= */

.item-enable {
    width: 32px;
    height: 38px;

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

    cursor: pointer;
}

.item-enable input {
    width: 19px;
    height: 19px;

    margin: 0;

    accent-color: #2167d5;

    cursor: pointer;
}


/* =========================================================
   ITEM NAME
   ========================================================= */

.shopping-item-name {
    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    color: #24334a;

    font-size: 15px;
    font-weight: 650;
}


/* =========================================================
   QUANTITY
   ========================================================= */

.quantity-controls {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 5px;

    white-space: nowrap;
}

.quantity-controls button {
    width: 30px;
    height: 30px;

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

    padding: 0;

    border: 1px solid #d8e1ec;

    border-radius: 8px;

    background: #f7f9fc;

    color: #34465f;

    font-size: 18px;
    line-height: 1;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.quantity-controls button:hover {
    background: #edf3fa;

    border-color: #c3d1e1;
}

.quantity-value {
    min-width: 28px;

    text-align: center;

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

    color: #33445c;
}


/* =========================================================
   PRICE
   ========================================================= */

.item-price {
    min-width: 70px;

    text-align: right;

    color: #1e3554;

    font-size: 14px;

    font-weight: 800;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.item-price[data-shop="lidl"] {
    color: #174f9d;
}

.item-price[data-shop="kaufland"] {
    color: #a32020;
}

.item-price[data-shop="billa"] {
    color: #23722d;
}


/* =========================================================
   COMPARE BUTTON
   ========================================================= */

.compare-item {
    width: 34px;
    height: 34px;

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

    padding: 0;

    border: 1px solid #cad8e9;

    border-radius: 50%;

    background: #f5f9ff;

    color: #2167d5;

    font-size: 16px;
    font-weight: 800;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.compare-item:hover {
    background: #e8f2ff;

    border-color: #8fb2df;

    transform: scale(1.05);
}

.compare-item:active {
    transform: scale(0.97);
}


/* =========================================================
   REMOVE BUTTON
   ========================================================= */

.remove-item {
    width: 34px;
    height: 34px;

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

    padding: 0;

    border: 0;

    border-radius: 50%;

    background: transparent;

    color: #9aa7b8;

    font-size: 22px;
    line-height: 1;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.remove-item:hover {
    background: #fff0f0;

    color: #d44949;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

#empty {
    padding: 25px 10px;

    text-align: center;

    color: #8491a4;

    font-size: 14px;
}


/* =========================================================
   CLEAR BUTTON
   ========================================================= */

#clearAll {
    padding: 8px 12px;

    border: 1px solid #e0d7d7;

    border-radius: 9px;

    background: #fffafa;

    color: #a04b4b;

    font-size: 13px;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

#clearAll:hover {
    background: #fff2f2;

    border-color: #e5bebe;
}


/* =========================================================
   HELP
   ========================================================= */

.help-panel {
    margin-top: 22px;

    padding-top: 20px;

    border-top: 1px solid #e5ebf3;
}

.help-panel h3 {
    margin: 0 0 10px;

    color: #24354d;

    font-size: 17px;
}

.help-panel p {
    margin: 0 0 14px;

    color: #6d7b8e;

    font-size: 14px;

    line-height: 1.6;
}

.help-panel button {
    padding: 9px 13px;

    border: 1px solid #d4dfed;

    border-radius: 10px;

    background: #f8fbff;

    color: #315172;
}

.help-panel button:hover {
    background: #edf4fc;
}

#offers {
    margin-top: 14px;
}


/* =========================================================
   DIALOGS
   ========================================================= */

dialog {
    width: min(460px, calc(100% - 30px));

    padding: 0;

    border: 0;

    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 25px 80px rgba(16, 38, 70, 0.25);
}

dialog::backdrop {
    background: rgba(15, 29, 50, 0.38);

    backdrop-filter: blur(3px);
}

dialog form {
    padding: 25px;
}

dialog h2 {
    margin: 0 0 18px;

    color: #1e2d43;
}

dialog label {
    display: block;

    margin-bottom: 14px;

    color: #4e5e74;

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

dialog input {
    width: 100%;

    margin-top: 6px;

    padding: 11px 12px;

    border: 1px solid #d5dfeb;

    border-radius: 10px;

    outline: none;
}

dialog input:focus {
    border-color: #6b9cdb;

    box-shadow:
        0 0 0 3px rgba(54, 116, 208, 0.10);
}

dialog button {
    padding: 9px 14px;

    border: 1px solid #d5dfeb;

    border-radius: 10px;

    background: #ffffff;

    color: #30435e;
}

dialog button[type="submit"] {
    border-color: #2167d5;

    background: #2167d5;

    color: #ffffff;
}

dialog button[type="submit"]:hover {
    background: #1858bd;
}


/* =========================================================
   ERROR
   ========================================================= */

.error {
    margin-top: 10px;

    padding: 10px 12px;

    border-radius: 10px;

    background: #fff2f2;

    border: 1px solid #f0cccc;

    color: #a33d3d;

    font-size: 14px;
}


/* =========================================================
   RESPONSIVE - TABLET
   ========================================================= */

@media (max-width: 900px) {

    .grid {
        grid-template-columns: 1fr;
    }

    .shell {
        width: min(760px, calc(100% - 28px));

        padding-top: 28px;
    }

}


/* =========================================================
   RESPONSIVE - MOBILE
   ========================================================= */

@media (max-width: 650px) {

    .topbar {
        padding: 14px 16px;

        align-items: flex-start;

        flex-direction: column;
    }

    .auth {
        width: 100%;
    }

    .auth button {
        flex: 1;
    }

    .shell {
        width: calc(100% - 20px);

        padding-top: 22px;
    }

    .panel {
        padding: 15px;

        border-radius: 16px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .hero p {
        font-size: 15px;
    }

    .search-row {
        flex-direction: column;
    }

    #addCustom {
        width: 100%;
    }


    /*
     * Na mobile trochu zjednodušíme riadok.
     *
     * názov dostane väčšinu priestoru,
     * ostatné ovládacie prvky zostávajú dostupné.
     */
    .shopping-item {
        grid-template-columns:
            30px
            30px
            minmax(90px, 1fr)
            auto
            auto
            34px
            34px;

        gap: 5px;

        padding: 7px 6px;

        min-height: 54px;

        border-radius: 12px;
    }

    .shopping-item-name {
        font-size: 14px;
    }

    .quantity-controls {
        gap: 2px;
    }

    .quantity-controls button {
        width: 28px;
        height: 28px;
    }

    .quantity-value {
        min-width: 22px;
    }

    .item-price {
        min-width: 55px;

        font-size: 12px;
    }

    .compare-item,
    .remove-item {
        width: 30px;
        height: 30px;
    }

    .drag-handle {
        width: 28px;
    }

    .item-enable {
        width: 28px;
    }

}


/* =========================================================
   RESPONSIVE - SMALL PHONE
   ========================================================= */

/* =========================================================
   RESPONSIVE - SMALL PHONE
   ========================================================= */

@media (max-width: 430px) {

    .shopping-item {
        grid-template-columns:
            24px
            24px
            minmax(0, 1fr)
            auto
            48px
            28px
            28px;

        gap: 2px;

        width: 100%;
        min-width: 0;

        padding: 6px 3px;
    }

    .shopping-item-name {
        min-width: 0;

        font-size: 13px;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .quantity-controls {
        gap: 1px;
    }

    .quantity-controls button {
        width: 24px;
        height: 27px;

        font-size: 16px;
    }

    .quantity-value {
        min-width: 17px;

        font-size: 12px;
    }

    .item-price {
        min-width: 0;
        width: 48px;

        font-size: 11px;
    }

    .compare-item,
    .remove-item {
        width: 28px;
        height: 28px;
    }

    .drag-handle {
        width: 24px;

        font-size: 18px;
    }

    .item-enable {
        width: 24px;
    }

    .item-enable input {
        width: 17px;
        height: 17px;
    }
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

button:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(33, 103, 213, 0.25);

    outline-offset: 2px;
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

}
