﻿/* ===== VARIÁVEIS E ESTILOS BASE ===== */
:root {
    --color-primary: #28a745;
    --color-danger: #d9534f;
    --color-text: #333;
    --color-text-light: #666;
    --color-border: #ddd;
    --color-bg-light: #f8f8f8;
    --shadow-default: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ===== UTILITÁRIOS ===== */
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.truncate-multiline {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.break-word {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.no-wrap {
    white-space: nowrap;
}

/* ===== ESTRUTURA PRINCIPAL ===== */
.sidebar-pedido {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    opacity: 0;
    transition: right 0.3s ease-in-out, opacity 0.3s ease-in-out;
    pointer-events: none;
}

    .sidebar-pedido.active {
        right: 0;
        opacity: 1;
        pointer-events: auto;
    }

/* ===== CABEÇALHO ===== */
.sidebar-pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.2em; /* tamanho ajustado conforme solicitado */
    font-weight: bold;
    color: var(--color-text);
    line-height: 1.2; /* garante alinhamento vertical */
}

    .sidebar-pedido-header button {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        background: none;
        border: none;
        font-size: 1.2em;
        cursor: pointer;
        color: var(--color-danger);
        line-height: 1; /* alinha verticalmente com o texto */
        height: 100%; /* força alinhamento com o header */
        user-select: none;
    }

    .sidebar-pedido-header h3 {
        margin: 0;
    }

/* ===== CONTEÚDO ===== */
.sidebar-pedido-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--color-bg-light);
}

.lista-pedidos-pedido {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===== ITENS DO PEDIDO ===== */
.pedido-item-pedido {
    background: #fff;
    padding: 0.5em;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-default);
    border: 1px solid var(--color-border);
}

.pedido-item-header {
    display: flex;
    gap: 1rem;
    position: relative;
}

    .pedido-item-header img {
        width: 70px;
        height: 70px;
        border-radius: 0.75rem;
        object-fit: cover;
    }

/* ===== CORREÇÃO DO ALINHAMENTO - NOME E AÇÕES ===== */
.pedido-info-pedido {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}


.pedido-info-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.5rem;
}
    .pedido-info-top strong {
        flex: 1;
        font-size: 1rem;
        color: var(--color-text);
        overflow: hidden; /* esconde o texto que ultrapassar o limite */
        text-overflow: ellipsis; /* exibe reticências quando o texto ultrapassar o espaço */
        max-width: 100%; /* assegura que o elemento ocupe o espaço disponível */
    }

.acoes-pedido {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

    .acoes-pedido .editar-container,
    .acoes-pedido .lixeira-container {
        cursor: pointer;
        user-select: none;
    }

    .acoes-pedido i {
        font-size: 1.1rem;
        transition: color 0.3s;
        color: var(--color-text-light);
    }

    .acoes-pedido .lixeira-container i:hover {
        color: darkred;
    }

/* ===== SABORES E ADICIONAIS ===== */
.sabores-container-pedido,
.adicionais-container-pedido {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-top: 0.5rem;
}

    .sabores-container-pedido ul,
    .adicionais-container-pedido ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .sabores-container-pedido li,
    .adicionais-container-pedido li {
        font-size: 0.875rem;
        color: #444;
        padding: 0.2rem 0;
        word-break: break-word;
    }

/* ===== DETALHES DE PREÇO ===== */
.preco-detalhado-pedido {
    background: var(--color-bg-light);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

    .preco-detalhado-pedido p {
        display: flex;
        justify-content: space-between;
        margin: 0.25rem 0;
        color: var(--color-text);
        flex-wrap: nowrap;
    }

        .preco-detalhado-pedido p strong {
            white-space: nowrap;
            margin-right: 0.5rem;
        }

.subtotal {
    font-weight: bold;
    font-size: 1rem;
    color: var(--color-danger);
}

/* ===== BOTÕES E INTERAÇÕES ===== */
.lixeira-container, .editar-container {
    cursor: pointer;
    user-select: none;
}

    .lixeira-container i, .editar-container i {
        font-size: 1.125rem;
        transition: color 0.3s;
    }

        .lixeira-container i:hover {
            color: darkred;
        }

.btn-finalizar-pedido {
    width: 100%;
    padding: 0.75rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
    white-space: nowrap;
}

    .btn-finalizar-pedido:hover {
        background: #218838;
    }

    .btn-finalizar-pedido.disabled {
        opacity: 0.6;
        cursor: not-allowed;
        background-color: #ccc;
    }

/* ===== RODAPÉ ===== */
.sidebar-pedido-footer {
    padding: 1em;
    border-top: 1px solid var(--color-border);
    background: #fff;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
}

.resumo-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

    .resumo-total strong {
        font-size: 1.25rem;
        color: var(--color-primary);
    }

.resumo-taxas {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 5px;
}

    .resumo-taxas p {
        margin: 2px 0;
        display: flex;
        justify-content: space-between;
    }

.resumo-minimo {
    margin-top: 0.5rem;
    color: #c0392b;
    font-weight: bold;
}

    .resumo-minimo p {
        margin-bottom: 0;
    }

/* ===== ELEMENTOS RECOLHÍVEIS ===== */
details {
    margin: 0.5em 0;
    border-radius: 4px;
    padding: 0.5em;
}

    details summary {
        font-weight: bold;
        cursor: pointer;
        background-color: whitesmoke;
        padding: 0.5em;
        border-radius: 0.5em;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .sidebar-pedido-header h3 {
        font-size: 1em !important;
    }

    .sidebar-pedido {
        left: 0;
        right: 0;
        width: 100% !important;
        max-width: 100%;
        transform: translateY(20px);
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
        .sidebar-pedido.active {
            transform: translateY(0);
        }

    .sidebar-pedido-header,
    .sidebar-pedido-content {
        padding: 0.75rem;
    }

    .pedido-item-header {
        gap: 0.75rem;
    }

        .pedido-item-header img {
            width: 60px;
            height: 60px;
        }

    .pedido-info-pedido strong {
        font-size: 0.95rem;
    }

    .sabores-container-pedido li,
    .adicionais-container-pedido li {
        font-size: 0.8rem;
    }

    .preco-detalhado-pedido {
        font-size: 0.8rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
    }

    .btn-finalizar-pedido {
        font-size: 0.95rem;
        padding: 0.65rem;
    }

    details summary {
        font-size: 0.9rem;
        padding-right: 1.5em;
    }
}

/* ===== ACESSIBILIDADE ===== */
button:focus,
.lixeira-container:focus,
.editar-container:focus {
    outline: none;
}
