/* assets/styles.css */
/* Version: 2.3 - 2026-01-07 - Sistema de toast notifications, animações e encomendas - Toast em linha única */

/* Importa o Bootstrap via CDN (caso prefira, pode colocar essa tag no header.php também) */
@import url('https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/css/bootstrap.min.css');

/* Estilos para o menu superior utilizando classes Bootstrap */
@keyframes blink {
    0%, 100% { outline-color: transparent; }
    50%      { outline-color: #ff6b6b; }
  }
  
  /* Aplica piscar a qualquer <tr> com esta classe */
  tr.blinking-border {
    outline: 3px solid transparent;      /* contorno inicial invisível */
    animation: blink 2.5s ease-in-out infinite;  /* pisca lentamente a cada 2.5s */
    border-radius: 4px;
  }

.top-menu {
    background-color: #343a40;
}
.top-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}
.top-menu ul li {
    margin-right: 10px;
}
.top-menu ul li a {
    color: #fff;
    text-decoration: none;
}
.top-menu ul li a:hover {
    text-decoration: underline;
}

/* Espaçamento sutil para a tabela: simula linhas separadas com transparência */
.table-custom {
    border-collapse: separate;
    border-spacing: 0 5px;
}

/* Personalização de linhas da tabela (mantendo a ideia de status por cor, se desejar) */
.table-custom tr.status-pending {
    background-color: rgba(226, 227, 229, 0.7);
}
.table-custom tr.status-green {
    background-color: rgba(212, 237, 218, 0.7);
}
.table-custom tr.status-orange {
    background-color: rgba(255, 229, 180, 0.7);
}
.table-custom tr.status-red {
    background-color: rgba(248, 215, 218, 0.7);
}
.table-custom tr.status-default {
    background-color: #ffffff;
}

/* Botões de ação adaptados para Bootstrap */
.btn.status-button {
    margin: 2px;
}
.btn.btn-dark.delete-button {
    margin: 2px;
}

/* Estilos para o formulário de cadastro */
.product-form-container {
    max-width: 600px;
    margin: 20px auto;
}
.product-form-container h2 {
    text-align: center;
}
.product-form-container .form-group {
    margin-bottom: 15px;
}
.product-form-container label {
    display: block;
    margin-bottom: 5px;
}
.product-form-container input[type="text"] {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

/* Mensagens de erro e sucesso */
.error-message {
    color: red;
}
.success-message {
    color: green;
}

/* Ajustes para container das views */
.login-container, .product-list-container, .product-management-container {
    padding: 20px;
}
/* Personalização de linhas da tabela com espaçamento sutil */
.table-custom {
    border-collapse: separate;
    border-spacing: 0 5px;
}

/* Cores dos status conforme a nova solicitação */
.table-custom tr.status-pendente {
    background-color: #ffffff; /* Pendente: fundo branco */
}
.table-custom tr.status-green {
    background-color: #70fa90; /* Pedido: fundo verde claro */
}
.table-custom tr.status-orange {
    background-color: #f8e39f; /* Sem estoque no fornecedor: fundo amarelo */
}
.table-custom tr.status-red {
    background-color: #f88891; /* Não disponível: fundo vermelho claro */
}
.table-custom tr.status-default {
    background-color: #ffffff;
}

/* ========================================
   ESTILOS DE ENCOMENDA
   ======================================== */

/* Linha de produto marcada como encomenda - amarelo claro */
.table-custom tr.encomenda-highlight {
    background-color: #fff9c4 !important; /* Amarelo claro */
}

/* Quando encomenda tem status, o amarelo sobrepõe mas mantém leve transparência */
.table-custom tr.encomenda-highlight.status-green {
    background: linear-gradient(135deg, #fff9c4 60%, #70fa90 100%);
}

.table-custom tr.encomenda-highlight.status-orange {
    background: linear-gradient(135deg, #fff9c4 60%, #f8e39f 100%);
}

.table-custom tr.encomenda-highlight.status-red {
    background: linear-gradient(135deg, #fff9c4 60%, #f88891 100%);
}

/* Célula de encomenda */
.encomenda-cell {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.encomenda-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ffc107;
}

.encomenda-checkbox:checked {
    accent-color: #ffc107;
}

.cliente-nome {
    display: block;
    font-size: 10px;
    color: #6c757d;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

/* ========================================
   MODAL DE ENCOMENDA
   ======================================== */

.encomenda-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.encomenda-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.encomenda-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #fff9c4;
    border-radius: 8px 8px 0 0;
}

.encomenda-modal-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.encomenda-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
}

.encomenda-modal-close:hover {
    color: #333;
}

.encomenda-modal-body {
    padding: 20px;
}

.encomenda-modal-body .form-group {
    margin-bottom: 0;
}

.encomenda-modal-body .form-control {
    border: 2px solid #ced4da;
    padding: 10px 12px;
    font-size: 15px;
    border-radius: 6px;
}

.encomenda-modal-body .form-control:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

.encomenda-modal-body .form-control.is-invalid {
    border-color: #dc3545;
}

.encomenda-modal-body .invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
}

.encomenda-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.encomenda-modal-footer .btn {
    padding: 8px 20px;
    font-size: 14px;
}

.nome-produto {
    /* Permite que o texto quebre normalmente */
    white-space: normal;
    /* Define o container como uma caixa flexível para poder usar o line-clamp */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    /* Limita a 2 linhas */
    -webkit-line-clamp: 2;
    /* Esconde o que ultrapassar sem mostrar reticências */
    
    text-overflow: clip;
    /* Opcional: defina uma largura máxima para forçar a quebra */
    max-width: 500px; /* ajuste conforme necessário */
    line-height: 1.2;  /* altura de linha desejada */
}

/* ========================================
   SISTEMA DE TOAST NOTIFICATIONS
   ======================================== */

/* Container de toasts - fixado no topo centralizado */
#toast-container {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

/* Toast individual - compacto em uma linha */
.toast {
    background: white;
    border-radius: 6px;
    padding: 8px 16px;
    min-width: 200px;
    max-width: 500px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.25s ease-out;
    cursor: pointer;
    position: relative;
}

/* Toast visível - desce do topo */
.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Toast saindo - sobe para o topo */
.toast.hide {
    transform: translateY(-100px);
    opacity: 0;
}

/* Ícone do toast - menor */
.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Conteúdo do toast - em uma linha */
.toast-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.toast-title {
    font-weight: 600;
    font-size: 13px;
    color: #1a1a1a;
    white-space: nowrap;
    flex-shrink: 0;
}

.toast-message {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Barra de progresso do toast - mais fina */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(0, 0, 0, 0.05);
    width: 100%;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: progress 3s linear forwards;
}

/* Tipos de toast - borda mais fina */
.toast.success {
    border-left: 3px solid #28a745;
}

.toast.success .toast-icon {
    color: #28a745;
}

.toast.success .toast-progress-bar {
    background: #28a745;
}

.toast.error {
    border-left: 3px solid #dc3545;
}

.toast.error .toast-icon {
    color: #dc3545;
}

.toast.error .toast-progress-bar {
    background: #dc3545;
}

.toast.info {
    border-left: 3px solid #17a2b8;
}

.toast.info .toast-icon {
    color: #17a2b8;
}

.toast.info .toast-progress-bar {
    background: #17a2b8;
}

.toast.warning {
    border-left: 3px solid #ffc107;
}

.toast.warning .toast-icon {
    color: #ffc107;
}

.toast.warning .toast-progress-bar {
    background: #ffc107;
}

/* Animação da barra de progresso */
@keyframes progress {
    to {
        transform: scaleX(0);
    }
}

/* Hover no toast */
.toast:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

/* ========================================
   ANIMAÇÕES DE HIGHLIGHT
   ======================================== */

/* Highlight para novo item no histórico */
@keyframes highlightFadeIn {
    0% {
        background-color: #d4edda;
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

.new-contact-highlight {
    animation: highlightFadeIn 2s ease-out;
    border-left: 4px solid #28a745 !important;
}

/* ========================================
   FEEDBACK NO BOTÃO
   ======================================== */

/* Botão com estado de sucesso */
.btn-saving {
    pointer-events: none;
    opacity: 0.7;
}

.btn-success-feedback {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    position: relative;
    overflow: hidden;
}

.btn-success-feedback::before {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 20px;
    font-weight: bold;
    color: white;
    animation: checkmark 0.5s ease-out forwards;
}

@keyframes checkmark {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

/* ========================================
   ESTILOS PARA COMENTÁRIOS
   ======================================== */

.comentarios-row {
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
}

.comentarios-container {
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    margin: 10px 0;
}

.comentarios-list {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.comentario-item {
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.comentario-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.comentario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.comentario-header strong {
    color: #333;
    font-size: 14px;
}

.comentario-header em {
    color: #666;
    font-size: 12px;
    font-style: normal;
}

.btn-delete-comment {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-delete-comment:hover {
    background-color: #c82333;
}

.comentario-text {
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.comentario-form {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.comentario-form .form-group {
    margin-bottom: 10px;
}

.comentario-form .form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
}

.comentario-form .form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.comment-button {
    position: relative;
}

.comment-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.comment-icon {
    font-size: 18px;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

@media (max-width: 768px) {
    #toast-container {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
        width: 100%;
        padding: 8px 12px;
    }
    
    .toast-content {
        gap: 4px;
    }
    
    .toast-title {
        font-size: 12px;
    }
    
    .toast-message {
        font-size: 12px;
    }
    
    .toast-icon {
        font-size: 14px;
    }
    
    .comentarios-container {
        padding: 15px;
    }
    
    .comentario-item {
        padding: 10px;
    }
}
