/* =====================================================================
   Módulo Pedidos — UI do cliente no menu público (carrinho + checkout).
   Usa a cor do estabelecimento via --tema (definida no <head> do menu).
   ===================================================================== */

/* Banner "pode pedir aqui" no topo do menu (convite ao pedido) */
.ped-banner {
    position: relative;
    display: flex; align-items: center; gap: 13px;
    background: #fff;
    border: 1px solid #eef0f3;
    color: #374151;
    border-radius: 16px;
    padding: 13px 16px 13px 20px;
    font-weight: 600; font-size: 14px; line-height: 1.4;
    margin-bottom: 18px;
    box-shadow: 0 10px 26px rgba(16, 24, 40, .08);
    overflow: hidden;
    animation: ped-banner-in .5s cubic-bezier(.16, .84, .44, 1) both;
}
/* Barra de destaque à esquerda com a cor do estabelecimento */
.ped-banner::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--tema, #FF6B35);
}
.ped-banner__ic {
    width: 40px; height: 40px; flex: 0 0 auto;
    display: inline-block;
    border-radius: 12px;
    background-color: var(--tema, #FF6B35);
    /* Carrinho branco (SVG) — alto contraste sobre a cor do estabelecimento.
       font-size:0 esconde o emoji 🛒 de fallback no HTML. */
    font-size: 0; color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 22px 22px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .14);
}
@keyframes ped-banner-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .ped-banner { animation: none; }
}

/* Controlos de "adicionar" injetados no modal do item */
.ped-add { margin-top: 16px; border-top: 1px solid #eef0f3; padding-top: 14px; }
.ped-add__qtd { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ped-add__qtd label { font-weight: 700; font-size: 14px; color: #1f2937; }
.ped-stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid #e2e5ea; border-radius: 999px; overflow: hidden; }
.ped-stepper button {
    width: 38px; height: 38px; border: 0; background: #f6f7f9; color: #1f2937;
    font-size: 20px; font-weight: 700; cursor: pointer; line-height: 1;
}
.ped-stepper button:active { background: #eceef1; }
.ped-stepper span { min-width: 34px; text-align: center; font-weight: 800; font-size: 16px; }
.ped-add textarea {
    width: 100%; border: 1px solid #e2e5ea; border-radius: 12px; padding: 11px 13px;
    font-family: inherit; font-size: 14px; resize: vertical; min-height: 44px; box-sizing: border-box;
}
.ped-add__btn {
    width: 100%; margin-top: 12px; border: 0; border-radius: 12px; cursor: pointer;
    background: var(--tema); color: #fff; font-family: inherit; font-weight: 800; font-size: 15px;
    padding: 14px; display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* Botão flutuante do carrinho */
.ped-fab {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
    z-index: 120; display: none; align-items: center; gap: 12px;
    background: var(--tema); color: #fff; border: 0; cursor: pointer;
    border-radius: 999px; padding: 13px 18px 13px 16px; width: min(92vw, 460px);
    box-shadow: 0 10px 30px rgba(16,24,40,.28); font-family: inherit;
}
.ped-fab.on { display: flex; }
.ped-fab__badge {
    background: rgba(255,255,255,.25); border-radius: 999px; min-width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; padding: 0 8px;
}
.ped-fab__c { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 0; }
.ped-fab__txt { font-weight: 800; font-size: 15px; }
.ped-fab__hint { font-size: 11.5px; font-weight: 600; opacity: .92; }
.ped-fab__total { margin-left: auto; font-weight: 800; font-size: 15px; white-space: nowrap; }
.ped-fab__seta { font-size: 26px; font-weight: 800; line-height: 1; margin-left: 2px; }

/* Botão flutuante "Seguir pedido" (mostrado quando há um pedido ativo) */
.ped-seguir {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
    z-index: 121; display: inline-flex; align-items: center; gap: 8px;
    background: #111827; color: #fff; text-decoration: none;
    padding: 12px 18px; border-radius: 999px; font-weight: 700; font-size: 14.5px;
    box-shadow: 0 10px 28px rgba(16,24,40,.32); max-width: 92vw;
}
.ped-seguir b { font-weight: 800; }
.ped-seguir__ic { font-size: 16px; line-height: 1; }
.ped-seguir:active { transform: translateX(-50%) scale(.97); }
/* Se o carrinho (FAB) estiver visível, sobe para ficar acima dele. */
.ped-fab.on ~ .ped-seguir { bottom: 80px; }

/* Painel (bottom-sheet) */
.ped-ov { position: fixed; inset: 0; z-index: 130; display: none; }
.ped-ov.on { display: block; }
.ped-ov__fundo { position: absolute; inset: 0; background: rgba(15,23,42,.55); }
.ped-sheet {
    position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
    background: #fff; border-radius: 20px 20px 0 0; padding: 20px;
    box-shadow: 0 -8px 30px rgba(0,0,0,.2); animation: pedSubir .22s ease;
}
@keyframes pedSubir { from { transform: translate(-50%, 24px); opacity: .5; } }
.ped-sheet__cab { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ped-sheet__tit { margin: 0; font-size: 19px; font-weight: 800; color: #111827; }
.ped-sheet__x {
    margin-left: auto; border: 0; background: #f1f3f6; width: 34px; height: 34px;
    border-radius: 50%; font-size: 20px; cursor: pointer; color: #6b7280;
}

/* Linhas do carrinho */
.ped-linha { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid #f1f3f6; }
.ped-linha:first-child { border-top: 0; }
.ped-linha__q { flex: 0 0 auto; font-weight: 800; color: var(--tema); min-width: 30px; }
.ped-linha__c { flex: 1; min-width: 0; }
.ped-linha__t { font-weight: 700; font-size: 14.5px; color: #1f2937; }
.ped-linha__n { font-size: 12.5px; color: #6b7280; margin-top: 2px; white-space: pre-wrap; }
.ped-linha__p { font-weight: 700; color: #1f2937; white-space: nowrap; }
.ped-linha__ctrl { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.ped-qty { display: inline-flex; align-items: center; border: 1px solid #e5e7eb; border-radius: 999px; overflow: hidden; }
.ped-qty__b { width: 32px; height: 32px; border: 0; background: #f6f8fa; color: var(--tema);
    font-size: 19px; font-weight: 800; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; }
.ped-qty__b:active { background: #eceff3; }
.ped-qty__n { min-width: 30px; text-align: center; font-weight: 800; font-size: 14.5px; }
.ped-linha__rm { border: 0; background: none; color: #9ca3af; cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; }
.ped-linha__rm:hover { color: #dc2626; }

/* Estado FECHADO (horário) — aviso ao abrir o prato */
.ped-add.fechado .ped-add__qtd,
.ped-add.fechado [data-notas] { display: none; }
.ped-add__btn:disabled { background: #9ca3af; cursor: not-allowed; opacity: .9; }
.ped-vazio { text-align: center; color: #9ca3af; padding: 26px 0; }

.ped-total { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 2px solid #eef0f3; font-size: 18px; font-weight: 800; }

/* Formulário de checkout */
.ped-campo { margin-top: 14px; }
.ped-campo label { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 6px; }
.ped-campo input, .ped-campo select {
    width: 100%; box-sizing: border-box; padding: 12px 13px; font-family: inherit; font-size: 15px;
    border: 1px solid #e2e5ea; border-radius: 12px; background: #fff;
}
.ped-metodos { display: flex; flex-wrap: wrap; gap: 8px; }
.ped-metodo {
    flex: 1; min-width: 100px; text-align: center; padding: 12px 8px; border: 1.5px solid #e2e5ea;
    border-radius: 12px; font-weight: 700; font-size: 13.5px; cursor: pointer; user-select: none; color: #374151;
}
.ped-metodo input { display: none; }
.ped-metodo.sel { border-color: var(--tema); background: #fff3ec; color: var(--tema); }

.ped-btn {
    width: 100%; margin-top: 18px; border: 0; border-radius: 12px; cursor: pointer;
    background: var(--tema); color: #fff; font-family: inherit; font-weight: 800; font-size: 16px; padding: 15px;
}
.ped-btn[disabled] { opacity: .6; cursor: default; }
.ped-btn--sec { background: #f1f3f6; color: #374151; margin-top: 10px; }
.ped-erro { color: #dc2626; font-weight: 600; font-size: 13.5px; margin-top: 10px; text-align: center; }

/* Ecrã de sucesso */
.ped-ok { text-align: center; padding: 8px 0 4px; }
.ped-ok__ic { width: 64px; height: 64px; border-radius: 50%; background: #dcfce7; color: #16a34a; display: inline-flex; align-items: center; justify-content: center; font-size: 34px; margin-bottom: 12px; }
.ped-ok__num { font-size: 30px; font-weight: 800; color: var(--tema); margin: 6px 0; }
.ped-ok__msg { color: #4b5563; font-size: 14.5px; line-height: 1.6; margin: 0 0 6px; }
