/* Relevant subset of css/site.css - the .btn:focus and .form-floating
           rules were dropped since this page doesn't use those classes. */
html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

/* Color variables for prato types and shared UI accents */
:root {
    --color-frango: #d4a017;
    --color-bacalhau: #2e6f9e;
    --color-rojoes: #a0392b;
    --color-moelas: #6b4226;
    --color-febras: #4c7a3f;

    /* button / selection accents */
    --accent-selected-bg: azure;
    --accent-selected-border: darkblue;
    /* Frango variants */
    --color-frango-acompanhado: var(--color-frango);
    --color-frango-simples: #f1c569;
}



/* Integrate with the shared _Layout while maximizing available real estate.
           The footer is position:absolute with a fixed 60px height reserved via body's
           default margin-bottom, so we size the flex column to stop right above it. */
body.entradas-body {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
    overflow: hidden;
    margin-bottom: 60px;
}

    body.entradas-body header {
        flex: 0 0 auto;
    }

        body.entradas-body header nav {
            margin-bottom: 0 !important;
        }

    body.entradas-body > div.container {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

        /* <main> is the direct flex-row container splitting the page into the two
           50/50 panes (#selecao-section and #detalhes-section) - no extra wrapper div. */
        body.entradas-body > div.container > main {
            flex: 1 1 auto;
            min-height: 0;
            display: flex;
            flex-direction: row;
            padding-bottom: 0 !important;
            overflow: hidden;
            box-sizing: border-box;
            font-family: Segoe UI, Arial, sans-serif;
        }

            body.entradas-body > div.container > main,
            body.entradas-body > div.container > main * {
                box-sizing: border-box;
            }


/**************************** Senha / Voluntario / Mesa (left pane) ****************************/

#selecao-section {
    flex: 0 0 70%;
    width: 70%;
    min-width: 0;
    display: flex;
    flex-direction: row;
    border-right: 1px solid #ccc;
    overflow: hidden;
}

#senha-col,
#voluntario-col,
#mesa-col,
#pratos-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid #ddd;
    padding: 4px;
}

#senha-col,
#voluntario-col,
#mesa-col,
#pratos-col {
    flex: 0 0 25%;
    max-width: 25%;
}

#pratos-col {
    border-right: none;
}

    #senha-col > h2,
    #voluntario-col > h2,
    #mesa-col > h2,
    #pratos-col > h2 {
        margin: 0 0 4px 0;
        padding: 4px;
        font-size: 1rem;
        text-align: center;
        flex: 0 0 auto;
    }

/* Senha column */

#senha-numpad {
    /* Buttons are inline-block by default, so a plain block row already
               lays 3 of them out side by side - no flex needed here. */
    text-align: center;
    margin-bottom: 8px;
}

.numpad-btn {
    width: 3rem;
    height: 3rem;
    margin: 2px;
    padding: 0;
    font-size: 1.1rem;
    border-radius: 0;
}

#numpad-btn-del,
#numpad-btn-clear {
    border: none;
    background: none;
}

#senha-lista {
    /* <ul>/<li> are block-level, so the list stacks vertically on its own. */
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

    #senha-lista > li {
        margin-bottom: 4px;
    }

.senha-btn {
    width: 100%;
    padding: 8px;
    font-size: 1.1rem;
}

/* Voluntario column */

#voluntario-lista {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.voluntario-btn,
#voluntario-add-btn {
    /* display:block makes each button take its own line, stacking the list
               vertically without needing a flex-column wrapper. */
    display: block;
    width: 100%;
    margin-bottom: 4px;
    padding: 8px;
    font-size: 1rem;
}

#voluntario-add-btn {
    flex: 0 0 auto;
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    font-size: 1rem;
    border: 0px solid #d0d0d0;
    border-bottom: 1px solid #d0d0d0;
    border-radius: 0px;
}

    #voluntario-add-btn:focus {
        outline: none;
        border-color: #8fb8ff;
    }

/* Mesa column */

#mesa-grid {
    /* Rows are block-level divs, so they stack vertically on their own;
               only the 3-across split within a row needs flex. */
    flex: 1 1 auto;
    overflow-y: hidden;
    min-height: 0;
}

    #mesa-grid > div {
        display: flex;
        gap: 8px;
        margin-bottom: 8px;
    }

.mesa-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px;
    font-size: 1rem;
    border-radius: 0;
}

#mesa-outro {
    flex: 0 0 auto;
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    font-size: 1rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    color: #333;
}

    #mesa-outro:focus {
        outline: none;
        border-color: #8fb8ff;
    }

/* Shared look for senha/mesa/numpad/voluntario buttons */
.senha-btn,
.mesa-btn,
.numpad-btn,
.voluntario-btn {
    background-color: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    color: #6b6b6b;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

    .senha-btn:hover,
    .mesa-btn:hover,
    .numpad-btn:hover,
    .voluntario-btn:hover {
        background-color: #f5f5f5;
        border-color: #b0b0b0;
    }

    .senha-btn:active,
    .mesa-btn:active,
    .voluntario-btn:active {
        background-color: #e9e9e9;
    }

    .senha-btn.selected,
    .mesa-btn.selected,
    .voluntario-btn.selected {
        /*
                background-color: #ffc107;
                border-color: #d39e00;
                */
        background-color: var(--accent-selected-bg);
        border-color: var(--accent-selected-border);
    }


/**************************** Detalhes do Pedido (right pane) ****************************/

#detalhes-section {
    flex: 0 0 30%;
    width: 30% ;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    overflow: hidden;
}

    #detalhes-section > h2 {
        flex: 0 0 auto;
        margin: 0 0 4px 0;
        padding: 4px;
        font-size: 1rem;
        text-align: center;
    }

#pedido-totais-row {
    flex: 0 0 auto;
    padding: 8px;
}

.pedido-totais-values,
.pedido-totais-labels {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.pedido-totais-values {
    font-size: 1.5rem;
    font-weight: 700;
}

.pedido-totais-labels {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
}

.pedido-totais-values > span,
.pedido-totais-labels > span {
    flex: 1 1 0;
    min-width: 0;
}

#pratos-row {
    /* Now living in a narrow 25% column, so groups stack vertically and
               the column scrolls instead of wrapping horizontally. */
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 4px 0;
}

.prato-btn-group {
    display: block;
    margin: 0 0 8px 0;
}

    .prato-btn-group > .prato-btn {
        /* display:block stacks the "1 X" / "0,5 X" buttons vertically within
               their group without needing a flex-column wrapper. */
        display: block;
        width: 100%;
        margin-bottom: 6px;
    }

.prato-btn {
    width: 100%;
    height: 60px;
    border: 2px solid #333;
    border-radius: 4px;
    background: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}

    .prato-btn:hover {
        background: #f0f0f0;
    }

    /* support both data-tipo attributes and new tipo-<name> classes */
    .prato-btn[data-tipo^="Frango" i][data-prato-nome*="Simples" i] {
        border-color: var(--color-frango-simples);
    }
    .prato-btn[data-tipo^="Frango" i][data-prato-nome*="acompanhado" i] {
        border-color: var(--color-frango-acompanhado);
    }

    .prato-btn[data-tipo="Bacalhau"] {
        border-color: var(--color-bacalhau);
    }

    .prato-btn[data-tipo="Rojões"] {
        border-color: var(--color-rojoes);
    }

    .prato-btn[data-tipo="Moelas"] {
        border-color: var(--color-moelas);
    }

    .prato-btn[data-tipo="Febras"] {
        border-color: var(--color-febras);
    }

    /* Frango-specific variants by prato name */
    .prato-btn[data-tipo^="Frango" i][data-prato-nome*="simples" i] {
        border-color: var(--color-frango-simples);
    }
    .prato-btn[data-tipo^="Frango" i][data-prato-nome*="acompanhado" i] {
        border-color: var(--color-frango-acompanhado);
    }

        #pedido-list {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            padding: 8px 8px 0 0;
        }

        .pedido-list-empty {
            color: #777;
            font-style: italic;
            padding: 12px 0;
        }

        .pedido-group {
            display: block;
        }

            .pedido-group + .pedido-group {
                margin-top: 6px;
            }

        .pedido-row {
            position: relative;
            border: 2px solid #333;
            border-radius: 4px;
            padding: 8px 12px 8px 24px;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

            .pedido-row .pedido-senha:empty,
            .pedido-row .pedido-mesa:empty,
            .pedido-row .pedido-voluntario:empty {
                background-color: #fdecea;
                min-width: 3em;
                min-height: 1em;
            }

        .pedido-row-locked {
            background-color: #f5f5f5;
        }

        .pedido-row::before {
            content: "";
            position: absolute;
            top: 6px;
            bottom: 6px;
            left: 6px;
            width: 8px;
            border-radius: 4px;
            background: #ccc;
        }

.pedido-row[data-tipo*="Frango"][data-prato-nome*="Simples"]::before {
    background: var(--color-frango);
}

.pedido-row[data-tipo="Bacalhau"]::before {
    background: var(--color-bacalhau);
}

.pedido-row[data-tipo="Rojões"]::before {
    background: var(--color-rojoes);
}

.pedido-row[data-tipo="Moelas"]::before {
    background: var(--color-moelas);
}

.pedido-row[data-tipo="Febras"]::before {
    background: var(--color-febras);
}

/* Frango variants by prato name */
.pedido-row[data-tipo*="Frango"][data-prato-nome*="Simples" i]::before,
.pedido-row[data-tipo*="frango"][data-prato-nome*="simples" i]::before {
    background: var(--color-frango-simples);
}
.pedido-row[data-tipo*="Frango"][data-prato-nome*="Acompanhado" i]::before,
.pedido-row[data-tipo*="frango"][data-prato-nome*="acompanhado" i]::before {
    background: var(--color-frango-acompanhado);
}

        .pedido-row.hidden {
            display: none;
        }

        .pedido-remove-btn {
            position: absolute;
            top: -8px;
            right: -8px;
            width: 22px;
            height: 22px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            line-height: 0;
            border: 1px solid #888;
            border-radius: 50%;
            background: #fff;
            color: #888;
            cursor: pointer;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
        }

            .pedido-remove-btn:hover {
                background: #eee;
                border-color: #666;
                color: #666;
            }

        .pedido-info {
            flex: 1 1 auto;
            min-width: 0;
        }

        .pedido-header .pedido-label,
        .pedido-values > * {
            /* Spans are inline by default, so they sit side by side on their own;
               margin-right replaces the flex "gap". */
            display: inline-block;
            margin-right: 16px;
        }

        .pedido-label {
            font-size: 0.75rem;
            color: #666;
        }

        .pedido-values {
            font-weight: 600;
        }

        .pedido-prato {
            margin-top: 4px;
        }

        .pedido-levar,
        .pedido-qty,
        .pedido-lock {
            flex: 0 0 auto;
            text-align: center;
        }

            .pedido-levar .pedido-label,
            .pedido-qty .pedido-label,
            .pedido-lock .pedido-label {
                /* display:block puts the control on its own line below the label,
               without needing a flex-column wrapper per group. */
                display: block;
                margin-bottom: 4px;
            }

        .pedido-qty-value {
            font-size: 1.1rem;
            font-weight: 700;
        }

        .pedido-lock-btn {
            border: none;
            background: none;
            padding: 4px;
            line-height: 0;
            color: #555;
            border-radius: 50%;
            cursor: pointer;
        }

        .pedido-row.blocked .pedido-lock-btn {
            background-color: #fdecea;
            color: #c0392b;
        }

        #pedido-acoes {
            flex: 0 0 auto;
            display: flex;
            justify-content: flex-end;
            padding: 8px 0;
        }

        #btn-imprimir {
            padding: 10px 24px;
            border: 2px solid #333;
            border-radius: 4px;
            background: #fff;
            font-size: 1rem;
            cursor: pointer;
        }

            #btn-imprimir:hover {
                background: #f0f0f0;
            }
