* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    padding-left: 0px;
    padding-right: 0px;
}

.header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 25px 30px;
    text-align: center;
    position: relative; /* allow absolutely positioned logout button */
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
}

.header p {
    opacity: 0.9;
    font-size: 1em;
}

.user-info{
  position: absolute;
  top: 14px;
  left: 18px;
  background: rgba(255,255,255,0.12);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  transition: background 0.2s ease, transform 0.08s ease;
}

/* Logout button positioned at top-right of header */
.logout-button {
    position: absolute;
    top: 14px;
    right: 18px;
    background: rgba(255,255,255,0.12);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    transition: background 0.2s ease, transform 0.08s ease;
}

.logout-button:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-2px);
}

.logout-button i { font-size: 1.05em; }

.logout-button:active { transform: translateY(0); }

/* Tabs de Navegação */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    flex: 1;
    padding: 18px;
    text-align: center;
    cursor: pointer;
    background: #f8f9fa;
    border: none;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: #fff;
    color: #ff6b35;
}

.tab.active {
    background: white;
    color: #ff6b35;
    border-bottom: 3px solid #ff6b35;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

.main-content {
    padding: 0;
}

/* Tabela de Pedidos */
.pedidos-section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    color: #333;
    font-size: 1.4em;
}

/* Botão Recarregar */
.btn-recarregar {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.btn-recarregar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.btn-recarregar:active {
    transform: translateY(0);
}

.btn-recarregar.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-recarregar .icon {
    font-size: 1.2em;
    transition: transform 0.6s ease;
}

.btn-recarregar.loading .icon {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Notificação de novos pedidos */
.notification-badge {
    position: relative;
    display: inline-block;
}

.badge-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    min-width: 280px;
    border-left: 4px solid #28a745;
    animation: slideInRight 0.3s ease;
}

.toast.show {
    display: flex;
}

.toast.success {
    border-left-color: #28a745;
}

.toast.info {
    border-left-color: #17a2b8;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 1.5em;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.toast-message {
    font-size: 0.9em;
    color: #666;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: #333;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

tbody tr {
    cursor: pointer;
    transition: all 0.3s ease;
}

tbody tr:hover {
    background: #fff5f0;
}

tbody tr.selected {
    background: #ffe8dc;
    border-left: 4px solid #ff6b35;
}

/* Invoice rows that appear under an order */
tbody tr.invoice-row {
    background: linear-gradient(90deg, rgba(255,243,236,1) 0%, rgba(255,250,248,1) 100%);
    font-style: normal;
    color: #4a4a4a;
}

/* Invoice rows should not be clickable like orders */
tbody tr.invoice-row {
    cursor: default;
    pointer-events: none;
}

tbody tr.invoice-row:hover {
    background: linear-gradient(90deg, rgba(255,243,236,1) 0%, rgba(255,250,248,1) 100%);
}

tbody tr.invoice-row .invoice-label {
    display: inline-flex;
    gap: 8px;
    align-items: baseline;
    color: #ff6b35;
    font-weight: 600;
}

tbody tr.invoice-row td {
    padding-left: 28px; /* Indent to show relation to parent */
}

tbody tr.novo-pedido {
    animation: highlight 2s ease;
}

@keyframes highlight {
    0%, 100% {
        background: #fff5f0;
    }
    50% {
        background: #ffd4b8;
    }
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

.status-conferido {
    background: #d4edda;
    color: #155724;
}

.status-finalizado {
    background: #d4edda;
    color: #155724;
}

.status-erro{
    background: #f8d7da;
    color: #721c24;
}

.valor-pedido {
    color: #ff6b35;
    font-weight: 600;
    font-size: 1em;
}

/* Botão Receber */
.action-buttons {
    margin-top: 20px;
    text-align: right;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-receber {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-receber.active {
    opacity: 1;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-receber.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

/* Modal de Recebimento - ULTRA OTIMIZADO */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    padding: 10px;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 1200px;
    width: 100%;
    height: 96vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
}

.modal-header h2 {
    margin-bottom: 2px;
    font-size: 1.3em;
}

.modal-header p {
    opacity: 0.9;
    font-size: 0.85em;
}

.modal-body {
    padding: 15px 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Layout em 3 colunas */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 15px;
    flex: 1;
    overflow: hidden;
}

.pedido-info {
    background: #fff5f0;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
    overflow-y: auto;
}

.pedido-info::-webkit-scrollbar,
.itens-pedido::-webkit-scrollbar,
.payment-forms-container::-webkit-scrollbar {
    width: 5px;
}

.pedido-info::-webkit-scrollbar-track,
.itens-pedido::-webkit-scrollbar-track,
.payment-forms-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.pedido-info::-webkit-scrollbar-thumb,
.itens-pedido::-webkit-scrollbar-thumb,
.payment-forms-container::-webkit-scrollbar-thumb {
    background: #ff6b35;
    border-radius: 3px;
}

.pedido-info h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1em;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 4px 0;
    font-size: 0.85em;
}

.info-label {
    color: #666;
    font-weight: 600;
}

.info-value {
    color: #333;
    font-weight: 500;
}

.itens-pedido {
    background: #fff5f0;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
    overflow-y: auto;
}

.itens-pedido h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1em;
}

.item-sector {
    color: #333;
    font-weight: 500;
    font-size: 0.8em;
    padding-top: 5px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.8em;
    padding-left: 6px;
}

.item-row:last-child {
    border-bottom: none;
}

.item-name {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.item-qty {
    color: #666;
    margin: 0 10px;
    font-size: 0.9em;
}

.item-price {
    color: #ff6b35;
    font-weight: 600;
}

/* Coluna Central - Formas de Pagamento */
.payment-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.formas-pagamento h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1em;
}

.payment-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.payment-option {
    background: #fff5f0;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.payment-option:hover {
    border-color: #ff6b35;
    transform: translateY(-2px);
}

.payment-option.selected {
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

.payment-option input[type="checkbox"] {
    display: none;
}

.payment-label {
    display: block;
    font-weight: 600;
    font-size: 0.85em;
}

/* Container dos formulários com scroll */
.payment-forms-container {
    flex: 1;
    overflow-y: auto;
    background: #fff5f0;
    border-radius: 8px;
    padding: 10px;
    border-left: 4px solid #ff6b35;
}

.payment-form {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
}

.payment-form:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.payment-form h4 {
    color: #ff6b35;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.form-group {
    margin-bottom: 8px;
}

.form-group label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.8em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

/* Resumo de Valores - Coluna Direita */
.resumo-valores {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 12px;
    border-radius: 8px;
    overflow-y: auto;
}

.resumo-valores h3 {
    margin-bottom: 10px;
    font-size: 1em;
}

.valor-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    font-size: 0.85em;
}

.valor-row:last-child {
    border-bottom: none;
    border-top: 2px solid rgba(255,255,255,0.4);
    margin-top: 8px;
    padding-top: 8px;
    font-size: 1em;
    font-weight: 700;
}

.valor-label {
    font-weight: 500;
}

.valor-amount {
    font-weight: 700;
}

.troco-display {
    background: #28a745;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    margin-top: 8px;
    font-size: 0.9em;
    font-weight: 700;
}

.valor-restante {
    background: #dc3545;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    margin-top: 8px;
    font-size: 0.9em;
    font-weight: 700;
}

/* Botões do Modal */
.modal-footer {
    padding: 12px 20px;
    background: #fff5f0;
    border-top: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    flex-shrink: 0;
}

.btn-close-item{
    padding: 4px 8px;
    color: #ff6b35;
    border-radius: 12px;
}

.btn-cancelar {
    background: #6c757d;
    color: white;
    flex: 1;
    padding: 10px 20px;
}

.btn-cancelar:hover {
    background: #5a6268;
}

.btn-finalizar {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    flex: 2;
    opacity: 0.5;
    cursor: not-allowed;
    padding: 10px 20px;
}

.btn-finalizar.active {
    opacity: 1;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.btn-finalizar.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
}

/* Mensagem de Sucesso */
.success-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 2000;
    max-width: 500px;
}

.success-message.show {
    display: block;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 3em;
    color: white;
}

.success-message h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.success-message p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 25px;
}

.btn-fechar {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 12px 40px;
}

.btn-fechar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

/* Tabela de Finalizados */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1.1em;
}

/* Detalhes do Pedido Finalizado */
.detalhes-finalizados {
    background: #fff5f0;
    padding: 20px;
    border-radius: 10px;
    margin-top: 15px;
    border-left: 4px solid #ff6b35;
}

.detalhe-section {
    margin-bottom: 20px;
}

.detalhe-section h4 {
    color: #ff6b35;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.detalhe-item {
    background: white;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detalhe-label {
    color: #666;
    font-weight: 500;
}

.detalhe-value {
    color: #333;
    font-weight: 600;
}
/* the login box */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-box {
    width: 420px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 22px;
    text-align: center;
}

.login-body {
    padding: 22px;
}

.form-group input {
    height: 44px;
    font-size: 0.95em;
}

.login-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.helper-text {
    font-size: 0.85em;
    color: #666;
}

.field-error {
    color: #dc3545;
    font-size: 0.82em;
    margin-top: 6px;
    display: none;
}

/* Responsivo */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .payment-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        height: 98vh;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5em;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .payment-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    table {
        font-size: 0.85em;
    }

    th, td {
        padding: 10px 8px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        padding: 15px;
    }

    .toast {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}