/* Estilos para o plugin Portal do Recebimento (Versão Melhorada) */

/* Estilos gerais para os widgets */
.pdr-widget-container {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.07);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.pdr-widget-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* Estilos para os formulários */
.pdr-form {
    margin-top: 20px;
}

.pdr-form p {
    margin-bottom: 15px;
}

.pdr-form label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.pdr-form input[type="text"],
.pdr-form input[type="email"],
.pdr-form input[type="date"],
.pdr-form input[type="time"],
.pdr-form input[type="number"],
.pdr-form input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.pdr-form input[type="text"]:focus,
.pdr-form input[type="email"]:focus,
.pdr-form input[type="date"]:focus,
.pdr-form input[type="time"]:focus,
.pdr-form input[type="number"]:focus,
.pdr-form input[type="file"]:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

/* Estilos para os botões */
.pdr-form input[type="submit"],
.pdr-widget-container form input[type="submit"] {
    background-color: #0073aa;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdr-form input[type="submit"]:hover,
.pdr-widget-container form input[type="submit"]:hover {
    background-color: #005a87;
}

/* Botões específicos */
.pdr-widget-container form input[name="approve_slot"] { background-color: #28a745; }
.pdr-widget-container form input[name="approve_slot"]:hover { background-color: #218838; }
.pdr-widget-container form input[name="reject_slot"] { background-color: #dc3545; }
.pdr-widget-container form input[name="reject_slot"]:hover { background-color: #c82333; }
.pdr-widget-container form input[name="relist_slot"] { background-color: #ffc107; color: #212529; }
.pdr-widget-container form input[name="relist_slot"]:hover { background-color: #e0a800; }

/* === NOVOS ESTILOS PARA LISTAS E CARDS === */

.pdr-widget-container ul {
    list-style-type: none;
    padding: 0;
    margin-top: 20px;
}

.pdr-widget-container li {
    background-color: #ffffff;
    border: 1px solid #e9e9e9;
    border-left-width: 5px;
    border-left-color: #0073aa; /* Cor padrão (Azul para disponível) */
    padding: 15px 20px;
    margin-bottom: 12px;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap; /* Permite que os itens quebrem linha em telas menores */
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pdr-widget-container li:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* Container para as informações principais (data, fornecedor, etc.) */
.pdr-widget-container li > span {
    flex-grow: 1;
    margin-right: 15px;
    font-size: 15px;
    color: #444;
    line-height: 1.5;
}

.pdr-widget-container li > span strong {
    font-weight: 600;
    color: #111;
}

/* Container para os botões ou status */
.pdr-widget-container li > strong,
.pdr-widget-container li > form {
    flex-shrink: 0; /* Impede que os botões e status encolham */
}

/* === NOVOS ESTILOS PARA AS TAGS DE STATUS === */

.pdr-widget-container li > strong {
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 100px; /* Largura mínima */
    text-align: center;
}

/* Aprovado (Verde) */
.pdr-widget-container li.status-aprovado { border-left-color: #28a745; }
.pdr-widget-container li.status-aprovado > strong { background-color: #28a745; }

/* Pendente (Laranja) */
.pdr-widget-container li.status-pendente { border-left-color: #fd7e14; }
.pdr-widget-container li.status-pendente > strong { background-color: #fd7e14; }

/* Rejeitado (Vermelho) */
.pdr-widget-container li.status-rejeitado { border-left-color: #dc3545; }
.pdr-widget-container li.status-rejeitado > strong { background-color: #dc3545; }


/* Ajuste para os formulários dentro dos cards (botões de ação) */
.pdr-widget-container li form {
    display: flex !important;
    flex-direction: column;
    align-content: stretch;
    align-items: stretch;
}


/* Mensagens de sucesso e erro */
.success p, .error p {
    margin: 0 0 20px 0;
    padding: 15px;
    border-radius: 4px;
    border-left-width: 5px;
    border-left-style: solid;
}

.success p {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.error p {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Autocomplete do jQuery UI */
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    z-index: 1000; /* Garante que fique acima de outros elementos */
}
.ui-menu-item {
    padding: 10px;
    cursor: pointer;
}
.ui-menu-item:hover {
    background: #f0f0f0;
}

/* === NOVOS ESTILOS PARA O UPLOADER DE FICHEIROS === */

/* Oculta o input de ficheiro original */
.pdr-file-input-hidden {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

/* Estiliza a label para parecer um botão */
.pdr-file-input-label {
    background-color: #6c757d; /* Cinza */
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block; /* Importante para a label */
    margin: 0 10px;
}

.pdr-file-input-label:hover {
    background-color: #5a6268;
}

/* Container da lista de pré-visualização */
.pdr-file-list-preview {
    margin-top: 15px;
    width: 100%;
    display: none; /* Começa oculto */
}

/* Item individual na lista de pré-visualização */
.pdr-file-item {
    background-color: #f8f9fa;
    border: 1px solid #e9e9e9;
    border-radius: 4px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 14px;
}

.pdr-file-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
    color: #333;
}

/* Botão de remover (X) */
.pdr-remove-file {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    line-height: 22px;
    padding: 0;
    text-align: center;
    flex-shrink: 0;
}

.pdr-remove-file:hover {
    background: #c82333;
}

/* Desabilita o botão de submissão */
.pdr-submit-button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}
.pdr-submit-button:disabled:hover {
    background-color: #aaa;
}

/* === NOVOS ESTILOS PARA CANCELAMENTO E AUTOR/APROVADOR === */

/* Cor do novo status 'Cancelado Pendente' (Laranja) */
.pdr-widget-container li.status-cancelado_pendente { border-left-color: #fd7e14; }
.pdr-widget-container li.status-cancelado_pendente > strong { background-color: #fd7e14; }

/* Botão de Cancelar (laranja) */
.pdr-widget-container form input[name="cancel_slot"] { background-color: #fd7e14; }
.pdr-widget-container form input[name="cancel_slot"]:hover { background-color: #e66a00; }

/* Botão de Apagar (preto/cinza escuro) */
.pdr-widget-container form input[name="delete_slot"] { background-color: #343a40; }
.pdr-widget-container form input[name="delete_slot"]:hover { background-color: #23272b; }

/* Container para as informações do Autor/Aprovador */
.pdr-user-info {
    font-size: 13px;
    color: #555;
    margin-top: 10px;
    border-top: 1px dashed #eee;
    padding-top: 10px;
}
.pdr-user-info div {
    margin-bottom: 5px;
}
.pdr-user-info strong {
    color: #111;
}

/* Nova classe de mensagem de Informação (azul) */
.info p {
    color: #004085;
    background-color: #cce5ff;
    border-color: #b8daff;
}

/* === ESTILOS DO MODAL === */

.pdr-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.pdr-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.pdr-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
}

.pdr-modal-close:hover,
.pdr-modal-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.pdr-action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}
.pdr-action-buttons .button {
    padding: 10px 20px;
    font-size: 16px;
}

/* Layout em Grade para o Formulário de Agendamento */
.pdr-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.pdr-field-wrapper {
    display: flex;
    flex-direction: column;
}

.pdr-field-wrapper label {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
    color: #444;
}

.pdr-field-wrapper input,
.pdr-field-wrapper textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.pdr-upload-section {
    background-color: #f0f4f8;
    padding: 15px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    text-align: center;
}

@media (max-width: 600px) {
    .pdr-form-grid {
        grid-template-columns: 1fr;
    }
}

