/* 
 * RECAP.PRO - Módulo de Cadastros Genérico
 * Estrutura para Clientes, Produtos, Fornecedores, etc.
 */

.cadastro-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
}

.cadastro-header {
    height: 60px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 15px;
}

.cadastro-search {
    flex: 1;
    display: flex;
    gap: 10px;
}

.cadastro-search input {
    flex: 1;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #ccc;
    border-radius: 2px;
}

.cadastro-content {
    flex: 1;
    overflow: auto;
}

/* Área de formulário (quando aberto para edição/novo) */
.cadastro-form-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none; /* Só aparece ao clicar em Novo/Editar */
    align-items: center;
    justify-content: center;
}

.cadastro-form-overlay.show {
    display: flex;
}

.cadastro-form-panel {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    width: 860px;
    max-width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.cadastro-form-panel .cadastro-form-header {
    background: #f3f3f3;
    color: #333;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.cadastro-form-overlay.show {
    display: flex;
}

.cadastro-form-header {
    height: 50px;
    background: #555;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
}

.cadastro-form-body {
    flex: 1;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
}

.cadastro-form-panel .cadastro-form-footer {
    height: 60px;
    background: #f3f3f3;
    border-top: 1px solid #ddd;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
    gap: 10px;
}

/* Grid de formulário */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.config-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.config-form-group.full-width {
    grid-column: 1 / -1;
}

.config-form-group label {
    font-size: 11px;
    font-weight: 700;
    color: #666;
}

.config-form-group input,
.config-form-group select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid #ccc;
    border-radius: 2px;
}

.config-form-group input:focus,
.config-form-group select:focus {
    border-color: #555;
    outline: none;
}

/* Inputs que devem ser maiúsculos */
input[type="text"][data-uppercase] {
    text-transform: uppercase;
}

.config-form-group textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 2px;
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
    font-size: inherit;
}

/* Ajustes na tabela */
.pdv-table tr:nth-child(even) {
    background: #f9f9f9;
}

.pdv-table td {
    border-color: #eee;
}

/* Modal de Confirmação */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.show {
    display: flex;
}

.confirm-modal {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    width: 400px;
    max-width: 90%;
    padding: 20px;
    border-radius: 4px;
}

.confirm-modal h3 {
    margin: 0 0 15px;
    color: #333;
    font-size: 16px;
}

.confirm-modal p {
    margin: 0 0 20px;
    color: #666;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-buttons button {
    height: 36px;
    padding: 0 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.confirm-buttons .btn-cancel {
    background: #fff;
    color: #333;
}

.confirm-buttons .btn-confirm {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* Searchable Select Component */
.searchable-select {
    position: relative;
    width: 100%;
    z-index: 100;
}

.searchable-select:focus-within {
    z-index: 10000;
}

/* Elevate parent form-group when searchable select is active */
.config-form-group:has(.searchable-select:focus-within) {
    z-index: 200;
}

/* Contratos specific form group */
.contratos-form-group {
    position: relative;
    z-index: 1;
}
.contratos-form-group:focus-within,
.contratos-form-group:has(.searchable-select:focus-within) {
    z-index: 10000;
}

.searchable-select-input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    cursor: text;
    background: #fff;
    box-sizing: border-box;
}

.searchable-select-input:focus {
    border-color: #555;
    box-shadow: 0 0 0 2px rgba(0,120,212,0.15);
}

.searchable-select-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    pointer-events: none;
}

.searchable-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.searchable-select-dropdown.show {
    display: block;
}

.searchable-select-option {
    padding: 7px 10px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select-option:hover {
    background: #e8f0fe;
}

.searchable-select-option.selected {
    background: #555;
    color: #fff;
}

.searchable-select-empty {
    padding: 10px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

