/* Estilização Geral */
:root {
    --primary-color: #2563eb;
    --secondary-color: #4f46e5;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --light-gray: #f3f4f6;
    --medium-gray: #d1d5db;
    --dark-gray: #4b5563;
    --text-color: #1f2937;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Inter', sans-serif; background-color: var(--light-gray); color: var(--text-color); line-height: 1.6; display: flex; flex-direction: column; }

/* Cabeçalho e Navegação */
.main-header { padding: 15px 20px; background-color: var(--white); box-shadow: var(--shadow); text-align: right; flex-shrink: 0; }
.btn-manage { background-color: var(--secondary-color); color: var(--white); }
.main-header .btn { margin-left: 10px; }

/* Container Principal do PDV */
.pos-container { display: flex; flex-grow: 1; overflow: hidden; }
.products-panel { flex: 3; display: flex; flex-direction: column; padding: 20px; background: var(--white); border-right: 1px solid var(--medium-gray); }
.products-header { margin-bottom: 20px; }
.products-header h1 { font-size: 2rem; }
.search-bar { margin-top: 15px; }
#product-search { width: 100%; padding: 12px 15px; border: 1px solid var(--medium-gray); border-radius: 8px; font-size: 1rem; }
.products-grid { flex-grow: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; overflow-y: auto; padding-right: 10px; }
.product-btn { background-color: var(--white); border: 1px solid var(--medium-gray); border-radius: 8px; padding: 10px; cursor: pointer; text-align: center; transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; justify-content: space-between; height: 150px; }
.product-btn:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.product-btn img { max-width: 70px; height: 70px; margin: 0 auto 10px; border-radius: 5px; object-fit: cover; }
.product-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 5px; }
.product-price { font-weight: 500; font-size: 0.9rem; color: var(--primary-color); }

/* Painel de Vendas */
.sales-panel { flex: 2; display: flex; flex-direction: column; background-color: var(--light-gray); padding: 20px; }
.sales-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.sales-header h2 { font-size: 1.5rem; }
.sales-list-container { flex-grow: 1; background: var(--white); border-radius: 8px; overflow-y: auto; padding: 10px; border: 1px solid var(--medium-gray); }
.sales-list { list-style: none; }
.sales-list-item { display: flex; align-items: center; padding: 15px 10px; border-bottom: 1px solid var(--light-gray); }
.item-info { flex-grow: 1; }
.item-name { font-weight: 600; }
.item-price { color: var(--dark-gray); font-size: 0.9rem; }
.quantity-controls { display: flex; align-items: center; margin: 0 15px; }
.quantity-btn { background: var(--medium-gray); color: var(--text-color); border: none; width: 28px; height: 28px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; line-height: 28px; }
.item-quantity { margin: 0 15px; font-weight: 500; min-width: 20px; text-align: center; }
.item-total { font-weight: 600; min-width: 70px; text-align: right; }
.remove-item-btn { background: none; border: none; color: var(--danger-color); font-size: 1.5rem; cursor: pointer; margin-left: 15px; padding: 5px; }
.no-items { text-align: center; padding: 40px; color: var(--dark-gray); }

/* Resumo da Venda */
.sales-summary { padding-top: 20px; }
.summary-line { display: flex; justify-content: space-between; padding: 10px 0; font-size: 1.1rem; }
.summary-line.total { font-size: 1.5rem; font-weight: 700; border-top: 2px solid var(--medium-gray); margin-top: 10px; }

/* Botões */
.btn { padding: 12px 20px; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background-color 0.3s, transform 0.2s; }
.btn:hover { transform: scale(1.02); }
.btn-new-sale { background-color: var(--danger-color); color: var(--white); }
.btn-finalize { background-color: var(--accent-color); color: var(--white); width: 100%; margin-top: 15px; padding: 15px; font-size: 1.2rem; }
.btn-finalize:disabled { background-color: var(--medium-gray); cursor: not-allowed; transform: none; }

/* Páginas de Gerir e Configurações */
.manage-container { max-width: 800px; margin: 20px auto; padding: 20px; background-color: var(--white); border-radius: 8px; box-shadow: var(--shadow); }
.manage-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--medium-gray); padding-bottom: 20px; margin-bottom: 20px; }
.manage-header h1 { font-size: 1.8rem; }
.manage-content { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.form-container h2, .list-container h2 { font-size: 1.5rem; margin-bottom: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; }
.form-group input { width: 100%; padding: 12px 15px; border: 1px solid var(--medium-gray); border-radius: 8px; font-size: 1rem; }
.form-group input[type="file"] { padding: 8px; }
.form-group-inline { display: flex; gap: 10px; }
.form-group-inline input { flex-grow: 1; }

/* Listas de Itens (Produtos, Formas de Pagamento) */
.item-list { list-style: none; max-height: 400px; overflow-y: auto; border: 1px solid var(--medium-gray); border-radius: 8px; }
.item-list-item { display: flex; align-items: center; padding: 10px; border-bottom: 1px solid var(--light-gray); }
.item-list-item:last-child { border-bottom: none; }
.item-list-img { width: 50px; height: 50px; border-radius: 5px; margin-right: 15px; object-fit: cover; }
.item-list-name { flex-grow: 1; font-weight: 500; }
.item-list-price { margin: 0 15px; }
.item-list-actions .btn-edit, .item-list-actions .btn-delete { font-size: 0.8rem; padding: 5px 10px; margin-left: 5px; }
.btn-edit { background-color: var(--primary-color); color: var(--white); }
.btn-delete { background-color: var(--danger-color); color: var(--white); }

/* Modais */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--white); padding: 30px; border-radius: 12px; text-align: center; width: 90%; max-width: 450px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.modal-content h3 { font-size: 1.5rem; margin-bottom: 20px; }
.modal-content .form-group { text-align: left; }
.modal-content button { margin-top: 10px; }
.payment-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.payment-options .btn { width: 100%; }

/* Responsividade */
@media (max-width: 1024px) {
    .pos-container, .manage-content { flex-direction: column; grid-template-columns: 1fr; }
    .products-panel { border-right: none; border-bottom: 1px solid var(--medium-gray); min-height: 50vh; }
}

/* Estilos para o Letreiro Animado */
.marquee-container {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 10px 0;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 500;
}

#store-name-marquee {
    display: inline-block;
    padding-left: 100%;
    /* A animação terá 20 segundos de duração e se repetirá infinitamente */
    animation: marquee 20s linear infinite;
}

/* Animação que move o texto da direita para a esquerda */
@keyframes marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* Estilos para a Página de Relatório/Fechamento */
.report-controls {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--medium-gray);
}

#report-container {
    padding: 20px;
    border: 1px solid var(--medium-gray);
    border-radius: 8px;
    background-color: var(--white);
    min-height: 200px;
}

.report-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--dark-gray);
}

.report-header {
    text-align: center;
    margin-bottom: 30px;
}
.report-header h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.report-section {
    margin-bottom: 30px;
}
.report-section h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}
.report-table th, .report-table td {
    padding: 12px;
    border-bottom: 1px solid var(--medium-gray);
    text-align: left;
}
.report-table th {
    background-color: var(--light-gray);
}
.report-table .text-right {
    text-align: right;
}

.report-summary {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--medium-gray);
    text-align: right;
    font-size: 1.2rem;
}
.report-summary p {
    margin-bottom: 10px;
}
.report-summary p:last-child {
    font-weight: 700;
    font-size: 1.4rem;
}

.report-actions {
    text-align: right;
    margin-top: 20px;
}

/* Estilos para Impressão */
@media print {
    body {
        background-color: #fff;
    }
    .no-print {
        display: none !important;
    }
    .manage-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: none;
    }
    #report-container {
        border: none;
    }
}

/* Estilos para a Página de Recibo */
.receipt-body {
    background-color: #fff;
    display: flex;
    justify-content: center;
    font-family: 'Roboto Mono', monospace;
    color: #000;
}

.receipt-container {
    width: 300px; /* Largura comum para impressoras térmicas de 80mm */
    padding: 15px;
    font-size: 12px;
}

.receipt-header {
    text-align: center;
    margin-bottom: 10px;
}
.receipt-header h2 {
    font-size: 16px;
    margin: 0;
}
.receipt-header p {
    margin: 2px 0;
}

.receipt-container hr {
    border: none;
    border-top: 1px dashed #000;
    margin: 10px 0;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.receipt-summary {
    margin-top: 10px;
}

.receipt-summary .summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}
.receipt-summary .summary-line.total {
    font-weight: bold;
    font-size: 14px;
    border-top: 1px dashed #000;
    padding-top: 5px;
    margin-top: 5px;
}

.receipt-footer {
    text-align: center;
    margin-top: 20px;
}

/* Esconde o corpo principal ao imprimir o recibo */
@media print {
    body:not(.receipt-body) {
        display: none;
    }
    .receipt-body {
        margin: 0;
        padding: 0;
    }
}
/* Estilos para o Modal de Troco */
.change-details {
    margin-bottom: 20px;
    text-align: left;
}

.change-details p {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.change-details .form-group input {
    font-size: 1.5rem;
    text-align: right;
}

.change-result {
    font-size: 1.8rem !important;
    font-weight: 700;
    color: var(--accent-color);
    text-align: center;
    margin-top: 10px;
}
/* Estilos para o Controlo de Stock */
.product-btn {
    position: relative; /* Necessário para o posicionamento do indicador de stock */
}

.stock-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.product-btn.low-stock {
    border: 2px solid orange;
}

.product-btn.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
    border: 2px solid var(--danger-color);
}

.product-btn.out-of-stock::after {
    content: 'ESGOTADO';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(239, 68, 68, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: 700;
}

.item-list-stock {
    margin: 0 15px;
    font-weight: 600;
    color: var(--primary-color);
}




