/* ============================================================
   Pastificio Ancora - Portale Ordini
   style.css
   ============================================================ */

/* ── RESET & BASE ── */
*, *::before, *::after
{
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html, body
{
    background: #faf8f5;
    color: #1a1a1a;
    font-family: 'Inter',sans-serif;
    min-height: 100vh;
    overflow-x: hidden
}

input, select, textarea, button
{
    font-family: 'Inter',sans-serif
}

::-webkit-scrollbar
{
    width: 5px;
    height: 5px
}

::-webkit-scrollbar-thumb
{
    background: #e5ded6;
    border-radius: 3px
}

input[type="date"]::-webkit-calendar-picker-indicator
{
    opacity: .4;
    cursor: pointer
}

.twrap
{
    overflow-x: auto
}

/* ── ANIMATIONS ── */
@keyframes fu
{
    from
    {
        opacity: 0;
        transform: translateY(8px)
    }

    to
    {
        opacity: 1;
        transform: translateY(0)
    }
}

.fa
{
    animation: fu .22s ease both
}

.fb
{
    animation: fu .22s .06s ease both
}

.fc2
{
    animation: fu .22s .12s ease both
}

/* ── PAGES ── */
.pg
{
    display: none
}

    .pg.on
    {
        display: block
    }

/* ── LAYOUT ── */
.mc, .fo, .nc
{
    padding-top: 90px !important
}

.pg-conf-inner
{
    padding-top: 90px
}

.mc
{
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 16px
}

.fo
{
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 16px
}

.nc
{
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 16px
}

/* ── HEADER ── */
.hdr
{
    background: #c0392b;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 62px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(192,57,43,.3)
}

/* ── CARD ── */
.card
{
    background: #fff;
    border: 1px solid #e5ded6;
    border-radius: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06)
}

/* ── BUTTONS ── */
.btn
{
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s
}

.br
{
    background: #c0392b;
    color: #fff;
    padding: 9px 20px;
    font-size: 14px
}

    .br:hover
    {
        background: #962d22
    }

    .br.lg
    {
        padding: 12px 28px;
        font-size: 15px
    }

    .br.fw
    {
        width: 100%
    }

.bg
{
    background: #fff;
    color: #4a4a4a;
    border: 1px solid #e5ded6;
    padding: 6px 14px;
    font-size: 13px
}

    .bg:hover
    {
        background: #f3f0ee
    }

.btn:disabled
{
    opacity: .5;
    cursor: not-allowed
}

.bk
{
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    display: inline-block
}

    .bk:hover
    {
        text-decoration: underline
    }

/* ── FORM ── */
.lbl
{
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4a4a4a;
    margin-bottom: 5px
}

.inp
{
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    border-radius: 8px;
    border: 1.5px solid #e5ded6;
    background: #fff;
    color: #1a1a1a;
    outline: none;
    transition: border .15s
}

    .inp:focus
    {
        border-color: #c0392b
    }

textarea.inp
{
    resize: vertical
}

.iro
{
    background: #faf8f5;
    color: #9a9a9a;
    cursor: default
}

/* ── BADGES ── */
.badge
{
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap
}

.bI
{
    background: #eef3ff;
    color: #3d7fff
}

.bC
{
    background: #f1f8f2;
    color: #2e7d32
}

.bA
{
    background: #fef2f2;
    color: #b91c1c
}

.bR
{
    background: #f5f0ff;
    color: #7c3aed
}

/* ── FILTER PILLS ── */
.pill
{
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid #e5ded6;
    background: transparent;
    color: #9a9a9a;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s
}

.pT
{
    border-color: #c0392b;
    background: #fdf0ee;
    color: #c0392b
}

.pI
{
    border-color: #3d7fff;
    background: #eef3ff;
    color: #3d7fff
}

.pC
{
    border-color: #2e7d32;
    background: #f1f8f2;
    color: #2e7d32
}

.pA
{
    border-color: #b91c1c;
    background: #fef2f2;
    color: #b91c1c
}

.pR
{
    border-color: #7c3aed;
    background: #f5f0ff;
    color: #7c3aed
}

/* ── AUTOCOMPLETE DROPDOWN ── */
#drp
{
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1.5px solid #e5ded6;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.13);
    max-height: 280px;
    overflow-y: auto;
    display: none
}

.di
{
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #e5ded6;
    transition: background .1s
}

    .di:last-child
    {
        border-bottom: none
    }

    .di:hover
    {
        background: #fdf0ee
    }

/* ── TABLE ── */
.dt
{
    width: 100%;
    border-collapse: collapse
}

    .dt th
    {
        padding: 11px 16px;
        text-align: left;
        font-size: 11px;
        color: #9a9a9a;
        font-weight: 700;
        letter-spacing: .5px;
        text-transform: uppercase;
        white-space: nowrap;
        background: #faf8f5;
        border-bottom: 1px solid #e5ded6
    }

    .dt td
    {
        padding: 13px 16px;
        border-bottom: 1px solid #e5ded6;
        font-size: 13px
    }

    .dt tr:hover td
    {
        background: #fdf0ee
    }

    .dt tr:last-child td
    {
        border-bottom: none
    }

/* ── KPI ── */
.kg
{
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 14px;
    margin-bottom: 24px
}

.kc
{
    background: #fff;
    border: 1px solid #e5ded6;
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05)
}

/* ── QTY CONTROLS ── */
.qc
{
    display: flex;
    align-items: center;
    gap: 4px
}

.qb
{
    width: 28px;
    height: 28px;
    border: 1px solid #e5ded6;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center
}

    .qb:hover
    {
        background: #fdf0ee
    }

/* ── MISC ── */
.er
{
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px
}

.nf
{
    background: #faf8f5;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    color: #4a4a4a;
    border-left: 3px solid #c0392b
}

.st
{
    font-size: 11px;
    color: #9a9a9a;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 14px
}

/* ── GRID HELPERS ── */
.g2
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.g2s
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.ga
{
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start
}

/* ── CATALOGO OVERLAY ── */
#catalogo-overlay
{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center
}

    #catalogo-overlay.on
    {
        display: flex
    }

#catalogo-panel
{
    background: #fff;
    border-radius: 18px 18px 0 0;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden
}

    #catalogo-panel .cp-hdr
    {
        padding: 14px 18px;
        border-bottom: 1px solid #e5ded6;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0
    }

    #catalogo-panel .cp-search
    {
        padding: 10px 16px;
        border-bottom: 1px solid #e5ded6;
        flex-shrink: 0
    }

    #catalogo-panel .cp-body
    {
        overflow-y: auto;
        flex: 1;
        padding-bottom: 0
    }

    #catalogo-panel .cp-footer
    {
        padding: 12px 16px;
        border-top: 1.5px solid #e5ded6;
        background: #fff;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 10px
    }

.cat-group
{
    margin-bottom: 0
}

.cat-title
{
    padding: 8px 16px 5px;
    font-size: 11px;
    font-weight: 700;
    color: #9a9a9a;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: #faf8f5;
    position: sticky;
    top: 0;
    z-index: 1
}

.cat-item
{
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f0ebe6;
    gap: 10px;
    transition: background .1s
}

    .cat-item.sel
    {
        background: #fdf0ee
    }

    .cat-item:last-child
    {
        border-bottom: none
    }

.cat-chk
{
    width: 20px;
    height: 20px;
    accent-color: #c0392b;
    cursor: pointer;
    flex-shrink: 0
}

.cat-info
{
    flex: 1;
    min-width: 0
}

.cat-item-nome
{
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.cat-item-cod
{
    font-size: 11px;
    color: #9a9a9a;
    margin-top: 1px
}

.cat-item-price
{
    font-size: 12px;
    font-weight: 700;
    color: #c0392b;
    white-space: nowrap;
    flex-shrink: 0
}

.cat-qta
{
    width: 58px;
    border: 1.5px solid #e5ded6;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 13px;
    text-align: center;
    outline: none;
    display: none;
    flex-shrink: 0
}

    .cat-qta:focus
    {
        border-color: #c0392b
    }

.cat-item.sel .cat-qta
{
    display: block
}

/* ── RESPONSIVE ── */
@media(max-width:600px)
{
    .kg, .g2, .g2s, .ga
    {
        grid-template-columns: 1fr !important
    }
}

@media(max-width:480px)
{
    .gdati
    {
        grid-template-columns: 1fr !important
    }
}

@media(max-width:600px)
{
    #ctbl table
    {
        min-width: 0 !important;
        width: 100%
    }

    #ctbl td:first-child, #ctbl th:first-child
    {
        min-width: 140px;
        max-width: 180px;
        word-break: break-word;
        white-space: normal
    }

    #ctbl td:not(:first-child), #ctbl th:not(:first-child)
    {
        white-space: nowrap;
        font-size: 12px
    }
}
