/* ======== LAYOUT BASE ======== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #050505;
    color: #f4f4f4;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: flex;
    min-height: 100vh;
}

/* ======== SIDEBAR ESQUERDA ======== */

#sidebar-esquerda {
    width: 240px;
    background: #0f0f0f;
    border-right: 1px solid #262626;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

#sidebar-esquerda h1 {
    margin: 0 0 20px;
    font-size: 22px;
}

#sidebar-esquerda nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #2c2c2c;
    background: #141414;
    color: #e5e5e5;
    cursor: pointer;
    font-size: 14px;
}

.btn-nav i {
    width: 18px;
}

.btn-nav.ativo {
    border-color: #f5b301;
    box-shadow: 0 0 0 1px rgba(245, 179, 1, 0.3);
}

/* ======== CONTEÚDO CENTRAL ======== */

#conteudo-central {
    flex: 1;
    padding: 20px 24px;
    min-width: 0;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}

.page-header h2 {
    margin: 0 0 4px;
}

.page-header p {
    margin: 0;
    color: #a1a1a1;
    font-size: 14px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ======== BOTÕES ======== */

.btn-primary,
.btn-ghost {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #f5b301, #f39c12);
    color: #111;
    font-weight: 600;
}

.btn-ghost {
    background: #171717;
    color: #e5e5e5;
    border: 1px solid #2b2b2b;
}

/* ======== INFO CARD (Produtos) ======== */

.info-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #141414;
    border-radius: 10px;
    padding: 8px 12px;
    border: 1px solid #292929;
}

.info-card i {
    color: #f5b301;
}

.info-card span {
    font-weight: 600;
}

.info-card small {
    display: block;
    font-size: 11px;
    color: #a1a1a1;
}

/* ======== GRID DE PRODUTOS ======== */

.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.produto-card {
    background: radial-gradient(circle at top, #1b1b1b 0, #111 60%);
    border-radius: 12px;
    border: 1px solid #262626;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.produto-card img {
    width: 100%;
    border-radius: 10px;
    object-fit: cover;
    max-height: 140px;
}

.produto-card .produto-nome {
    margin: 4px 0 0;
    font-weight: 600;
}

.produto-card .produto-preco {
    margin: 0;
    color: #f5b301;
    font-weight: 600;
}

.produto-card small {
    color: #a1a1a1;
    font-size: 12px;
}

.produto-acoes {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

.btn-icone {
    border-radius: 999px;
    border: 1px solid #2b2b2b;
    background: #181818;
    color: #f0f0f0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
}

/* ======== CARRINHO SOBREPOSTO ======== */

#btn-carrinho-flutuante {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

#carrinho-painel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 100%;
    height: 100vh;
    background: #050505;
    border-left: 1px solid #262626;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    z-index: 60;
}

#carrinho-painel.aberto {
    transform: translateX(0);
}

.carrinho-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #262626;
}

.carrinho-topo h3 {
    margin: 0;
}

.carrinho-topo button {
    background: transparent;
    border: none;
    color: #e5e5e5;
    font-size: 18px;
    cursor: pointer;
}

#carrinho-itens {
    flex: 1;
    padding: 10px 14px;
    overflow-y: auto;
}

.carrinho-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.carrinho-item button {
    border-radius: 999px;
    border: none;
    background: #222;
    color: #f5f5f5;
    width: 26px;
    height: 26px;
    cursor: pointer;
}

.carrinho-footer {
    padding: 12px 16px 16px;
    border-top: 1px solid #262626;
}

.carrinho-total {
    margin-bottom: 8px;
}

.btn-finalizar {
    width: 100%;
    border-radius: 8px;
    padding: 10px;
    border: none;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

/* ======== MODAL GENÉRICO ======== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 70;
}

.modal-conteudo {
    background: #111;
    border-radius: 12px;
    border: 1px solid #363636;
    padding: 18px;
    width: 420px;
}

.modal-conteudo.large {
    width: 760px;
    max-width: 95vw;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
}

.modal-header button {
    background: transparent;
    border: none;
    color: #e5e5e5;
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    margin-top: 16px;
}

.modal-acoes {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* ======== LAYOUT MODAL PRODUTO ======== */

.modal-produto-layout {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr;
    gap: 16px;
}

.preview-card {
    background: #161616;
    border-radius: 10px;
    border: 1px solid #2c2c2c;
    padding: 14px;
    display: flex;
    gap: 10px;
}

.preview-img {
    width: 68px;
    height: 68px;
    border-radius: 10px;
    background: #202020;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 24px;
}

.preview-info h3 {
    margin: 0 0 4px;
}

.preview-info p {
    margin: 0 0 4px;
    color: #f5b301;
}

.preview-info small {
    color: #a1a1a1;
}

/* ======== FORMULÁRIOS ======== */

.produto-form,
.empresa-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 13px;
    color: #d4d4d4;
}

input,
textarea,
select {
    background: #151515;
    border-radius: 8px;
    border: 1px solid #333;
    padding: 8px 10px;
    color: #f4f4f4;
    font-size: 14px;
}

textarea {
    min-height: 70px;
    resize: vertical;
}

/* ======== CARD DE EMPRESA ======== */

.card-form {
    background: #101010;
    border-radius: 12px;
    border: 1px solid #262626;
    padding: 18px 18px 20px;
}

.card-form-header h3 {
    margin: 0 0 6px;
}

.card-form-header p {
    margin: 0 0 14px;
    color: #a1a1a1;
    font-size: 13px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 10px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ======== RESPONSIVO ======== */

@media (max-width: 980px) {
    body {
        flex-direction: column;
    }

    #sidebar-esquerda {
        width: 100%;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid #262626;
    }

    #sidebar-esquerda h1 {
        margin-bottom: 0;
        margin-right: 16px;
    }

    #sidebar-esquerda nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    #conteudo-central {
        padding: 16px;
    }

    .modal-produto-layout {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ==== AJUSTES PRODUTOS & CARDÁPIO (PIXEL) ==== */

/* wrapper dos cards */
.produto-card-inner {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* imagem 100x100 fixa (lista + preview) */
.produto-img-wrapper,
.produto-img,
.preview-img {
    width: 100px;
    min-width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}

.produto-img img,
.preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* texto não estourar pro lado */
.produto-info {
    flex: 1;
    min-width: 0;
}

.produto-desc,
.preview-info small {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ações do card alinhadas à direita */
.produto-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* botões admin (editar/copiar/excluir) */
.produto-admin-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    border: none;
    background: #171717;
    color: #f5f5f5;
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn:hover {
    background: #222;
}

/* ======== LAYOUT CARDS CARDÁPIO (COMPACTO HORIZONTAL) ======== */
.produto-card {
    padding: 12px;
}

.produto-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* imagem 100x100 fixa */
.produto-img-wrapper,
.produto-img {
    width: 100px;
    min-width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}

.produto-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.produto-img i {
    font-size: 26px;
    color: #555;
}

/* texto quebra para baixo sem estourar o card */
.produto-info {
    flex: 1;
    min-width: 0;
}

.produto-nome {
    margin: 0 0 4px;
    font-weight: 600;
}

.produto-preco {
    margin: 0 0 4px;
    color: #f5b301;
    font-weight: 600;
}

.produto-desc {
    margin: 0;
    font-size: 13px;
    color: #a1a1a1;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* botão sempre alinhado à direita */
.produto-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.btn-primary.btn-add-carrinho {
    white-space: nowrap;
}

/* IMPEDIR QUE TEXTO ESTOURE PARA OS LADOS */
.produto-info {
    min-width: 0;
    flex: 1;
}

.produto-desc {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* IMAGENS 100×100 FIXAS */
.produto-img-wrapper,
.produto-img,
.preview-img {
    width: 100px !important;
    height: 100px !important;
}

/* AÇÕES DO PRODUTO */
.produto-admin-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

a, a:visited, a:hover, a:active {
    text-decoration: none !important;
}

button, .btn, .action-btn {
    text-decoration: none !important;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #111;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    border-left: 4px solid #4cc9f0;
    box-shadow: 0 0 12px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(-20px);
    transition: all .3s ease;
    z-index: 9999;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.reorder-banner {
    margin-top: 10px;
    background: #222;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #4cc9f0;
    color: #fff;
    width: 100%;
}

.toast {
    position: fixed;
    top: 20px;
    right: -300px;
    padding: 14px 20px;
    background: #111;
    border-left: 4px solid #4cc9f0;
    color: #fff;
    font-size: 15px;
    border-radius: 8px;
    box-shadow: 0 0 10px #0008;
    opacity: 0;
    transition: 0.3s ease;
    z-index: 999999;
}

.toast.success { border-color: #22c55e; }
.toast.error { border-color: #ef4444; }

.toast.show {
    right: 20px;
    opacity: 1;
}
