/* Seção Fichas - modelos e visualização */
:root {
    --fichas-radius: 16px;
    --fichas-radius-btn: 12px;
    --fichas-btn-dark: #343a40;
}

.fichas-section {
    margin-bottom: var(--espacamento-xl);
}

.fichas-section .section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cinza-escuro);
    margin: 0 0 var(--espacamento-xs);
}

.fichas-section .section-subtitle {
    font-size: 0.95rem;
    color: var(--cinza-medio);
    margin: 0 0 var(--espacamento-lg);
}

/* Card de fundo da seção Modelos de ficha */
.fichas-models-card {
    background: var(--branco);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: var(--espacamento-lg);
}

.fichas-models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--espacamento-lg);
    margin-bottom: var(--espacamento-xl);
}

.ficha-model-card {
    background: var(--branco);
    border-radius: var(--fichas-radius);
    box-shadow: var(--sombra-suave);
    padding: var(--espacamento-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: box-shadow 0.2s ease;
}

.ficha-model-card:hover {
    box-shadow: var(--sombra-media);
}

.ficha-model-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--cinza-claro);
    color: var(--cinza-escuro);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: var(--espacamento-md);
}

.ficha-model-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cinza-escuro);
    margin: 0 0 var(--espacamento-md);
    line-height: 1.3;
}

.ficha-model-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--espacamento-sm);
    justify-content: center;
}

.ficha-model-actions .btn-sm {
    padding: var(--espacamento-xs) var(--espacamento-sm);
    font-size: 0.875rem;
    border-radius: var(--fichas-radius-btn);
}

/* Botões dos cards em tom escuro (cinza/preto) */
.ficha-model-actions .btn-primary {
    background: var(--fichas-btn-dark);
    color: var(--branco);
    border: none;
}

.ficha-model-actions .btn-primary:hover {
    background: #2c3136;
    color: var(--branco);
}

.ficha-model-actions .btn-secondary {
    background: var(--branco);
    color: var(--fichas-btn-dark);
    border: 2px solid var(--fichas-btn-dark);
}

.ficha-model-actions .btn-secondary:hover {
    background: rgba(52, 58, 64, 0.08);
    color: var(--fichas-btn-dark);
    border-color: var(--fichas-btn-dark);
}

/* Alinhar barra de busca e filtro na mesma linha */
#fichas-page .search-section {
    align-items: center;
}

#fichas-page .search-section .filter-group {
    display: flex;
    align-items: center;
    gap: var(--espacamento-sm);
}

#fichas-page .search-section .filter-group .filter-select {
    height: 48px;
    border-radius: var(--fichas-radius-btn);
    min-width: 220px;
}

#fichas-page .search-section .search-input {
    border-radius: var(--fichas-radius-btn);
}

#fichas-page .search-section .search-btn {
    border-radius: var(--fichas-radius-btn);
}

/* Card “Visualizar fichas” no mesmo padrão da seção Procedimentos */
.fichas-results {
    margin-top: 2rem;
    background: var(--branco);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    min-height: 400px;
    overflow: hidden;
}

.fichas-results .search-section {
    padding: var(--espacamento-lg);
    border-bottom: 1px solid var(--cinza-claro);
    background: var(--branco);
}

.fichas-results .results-header {
    padding: var(--espacamento-md) var(--espacamento-lg) var(--espacamento-sm);
    border-bottom: 1px solid var(--cinza-claro);
    background: var(--branco);
}

.fichas-results-content {
    background: var(--branco);
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fichas-results-content.has-table {
    display: block;
    min-height: auto;
    align-items: unset;
    justify-content: unset;
}

.fichas-table-container {
    overflow-x: auto;
}

.fichas-table {
    width: 100%;
    border-collapse: collapse;
}

.fichas-table th,
.fichas-table td {
    padding: var(--espacamento-sm) var(--espacamento-md);
    text-align: left;
    border-bottom: 1px solid var(--cinza-claro);
}

.fichas-table th {
    background: var(--cinza-claro);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--cinza-escuro);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fichas-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Coluna Ações: largura mínima para os 3 ícones ficarem sempre na mesma linha (tablet/iPad) */
.fichas-table th:last-child,
.fichas-table td:last-child {
    width: 1%;
    min-width: 140px;
    white-space: nowrap;
    vertical-align: middle;
    text-align: center;
}

.fichas-actions-cell {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fichas-actions-cell .btn-action {
    flex-shrink: 0;
}

.fichas-table .btn-action {
    background: none;
    border: none;
    color: var(--cinza-escuro);
    cursor: pointer;
    padding: var(--espacamento-xs);
    border-radius: var(--fichas-radius-btn);
    transition: background-color 0.2s ease, color 0.2s ease;
    width: 36px;
    height: 36px;
    min-width: 36px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fichas-table .btn-action.btn-view:hover {
    background: var(--cinza-claro);
    color: var(--fichas-btn-dark);
}

.fichas-table .btn-action.btn-edit:hover {
    background: rgba(33, 150, 243, 0.12);
    color: #1976d2;
}

.fichas-table .btn-action.btn-delete:hover {
    background: rgba(244, 67, 54, 0.12);
    color: #d32f2f;
}

/* Modal Nova ficha – tamanho maior e barra de pesquisa em largura total */
#fichaSelectClientModal .modal-content {
    min-height: 420px;
    width: 95%;
    max-width: 560px;
    overflow: visible;
}

#fichaSelectClientModal .modal-body {
    overflow: visible;
    padding-bottom: var(--espacamento-lg);
    min-height: 200px;
}

#fichaSelectClientModal .form-group {
    width: 100%;
    max-width: none;
}

#fichaSelectClientModal .client-search-container {
    position: relative;
    width: 100%;
}

#fichaSelectClientModal .client-search-container .form-input {
    width: 100%;
    box-sizing: border-box;
}

#fichaSelectClientModal .client-suggestions {
    max-height: 280px;
    width: 100%;
    box-sizing: border-box;
    z-index: 10001;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

#fichaSelectClientModal .modal-description {
    margin: 0 0 var(--espacamento-md);
    color: var(--cinza-escuro);
}
